mirror of
https://gitlab.com/libvirt/libvirt.git
synced 2024-10-30 01:43:23 +00:00
remote: check & report OOM in make_nonnull_XXX methods
The make_nonnull_XXX methods can all fail due to OOM but this was being silently ignored and thus also not checked by callers. Make the methods propagate errors and use ATTRIBUTE_RETURN_CHECK to force callers to deal with it. Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
parent
600462834f
commit
dc54b3ecc9
@ -113,11 +113,13 @@ get_nonnull_server(virNetDaemonPtr dmn, admin_nonnull_server srv)
|
|||||||
return virNetDaemonGetServer(dmn, srv.name);
|
return virNetDaemonGetServer(dmn, srv.name);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int ATTRIBUTE_RETURN_CHECK
|
||||||
make_nonnull_server(admin_nonnull_server *srv_dst,
|
make_nonnull_server(admin_nonnull_server *srv_dst,
|
||||||
virNetServerPtr srv_src)
|
virNetServerPtr srv_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(srv_dst->name, virNetServerGetName(srv_src)));
|
if (VIR_STRDUP(srv_dst->name, virNetServerGetName(srv_src)) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static virNetServerClientPtr
|
static virNetServerClientPtr
|
||||||
@ -126,13 +128,14 @@ get_nonnull_client(virNetServerPtr srv, admin_nonnull_client clnt)
|
|||||||
return virNetServerGetClient(srv, clnt.id);
|
return virNetServerGetClient(srv, clnt.id);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_client(admin_nonnull_client *clt_dst,
|
make_nonnull_client(admin_nonnull_client *clt_dst,
|
||||||
virNetServerClientPtr clt_src)
|
virNetServerClientPtr clt_src)
|
||||||
{
|
{
|
||||||
clt_dst->id = virNetServerClientGetID(clt_src);
|
clt_dst->id = virNetServerClientGetID(clt_src);
|
||||||
clt_dst->timestamp = virNetServerClientGetTimestamp(clt_src);
|
clt_dst->timestamp = virNetServerClientGetTimestamp(clt_src);
|
||||||
clt_dst->transport = virNetServerClientGetTransport(clt_src);
|
clt_dst->transport = virNetServerClientGetTransport(clt_src);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Functions */
|
/* Functions */
|
||||||
|
@ -91,16 +91,16 @@ static virNWFilterPtr get_nonnull_nwfilter(virConnectPtr conn, remote_nonnull_nw
|
|||||||
static virNWFilterBindingPtr get_nonnull_nwfilter_binding(virConnectPtr conn, remote_nonnull_nwfilter_binding binding);
|
static virNWFilterBindingPtr get_nonnull_nwfilter_binding(virConnectPtr conn, remote_nonnull_nwfilter_binding binding);
|
||||||
static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr dom, remote_nonnull_domain_snapshot snapshot);
|
static virDomainSnapshotPtr get_nonnull_domain_snapshot(virDomainPtr dom, remote_nonnull_domain_snapshot snapshot);
|
||||||
static virNodeDevicePtr get_nonnull_node_device(virConnectPtr conn, remote_nonnull_node_device dev);
|
static virNodeDevicePtr get_nonnull_node_device(virConnectPtr conn, remote_nonnull_node_device dev);
|
||||||
static void make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src);
|
static int make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src);
|
static int make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src);
|
static int make_nonnull_interface(remote_nonnull_interface *interface_dst, virInterfacePtr interface_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src);
|
static int make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src);
|
static int make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src);
|
static int make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src);
|
static int make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_nwfilter(remote_nonnull_nwfilter *net_dst, virNWFilterPtr nwfilter_src);
|
static int make_nonnull_nwfilter(remote_nonnull_nwfilter *net_dst, virNWFilterPtr nwfilter_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_nwfilter_binding(remote_nonnull_nwfilter_binding *binding_dst, virNWFilterBindingPtr binding_src);
|
static int make_nonnull_nwfilter_binding(remote_nonnull_nwfilter_binding *binding_dst, virNWFilterBindingPtr binding_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
static void make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src);
|
static int make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src) ATTRIBUTE_RETURN_CHECK;
|
||||||
|
|
||||||
static int
|
static int
|
||||||
remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
|
remoteSerializeDomainDiskErrors(virDomainDiskErrorPtr errors,
|
||||||
@ -313,7 +313,8 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.event = event;
|
data.event = event;
|
||||||
data.detail = detail;
|
data.detail = detail;
|
||||||
|
|
||||||
@ -333,6 +334,11 @@ remoteRelayDomainEventLifecycle(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_lifecycle_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -352,7 +358,8 @@ remoteRelayDomainEventReboot(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -368,6 +375,11 @@ remoteRelayDomainEventReboot(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_reboot_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -390,7 +402,8 @@ remoteRelayDomainEventRTCChange(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.offset = offset;
|
data.offset = offset;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
@ -407,6 +420,11 @@ remoteRelayDomainEventRTCChange(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_rtc_change_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -428,7 +446,8 @@ remoteRelayDomainEventWatchdog(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.action = action;
|
data.action = action;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
@ -445,6 +464,11 @@ remoteRelayDomainEventWatchdog(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_watchdog_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -472,7 +496,8 @@ remoteRelayDomainEventIOError(virConnectPtr conn,
|
|||||||
if (VIR_STRDUP(data.srcPath, srcPath) < 0 ||
|
if (VIR_STRDUP(data.srcPath, srcPath) < 0 ||
|
||||||
VIR_STRDUP(data.devAlias, devAlias) < 0)
|
VIR_STRDUP(data.devAlias, devAlias) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.action = action;
|
data.action = action;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
@ -490,8 +515,8 @@ remoteRelayDomainEventIOError(virConnectPtr conn,
|
|||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
error:
|
error:
|
||||||
VIR_FREE(data.srcPath);
|
xdr_free((xdrproc_t)xdr_remote_domain_event_io_error_msg,
|
||||||
VIR_FREE(data.devAlias);
|
&data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -524,7 +549,8 @@ remoteRelayDomainEventIOErrorReason(virConnectPtr conn,
|
|||||||
goto error;
|
goto error;
|
||||||
data.action = action;
|
data.action = action;
|
||||||
|
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -542,9 +568,8 @@ remoteRelayDomainEventIOErrorReason(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(data.srcPath);
|
xdr_free((xdrproc_t)xdr_remote_domain_event_io_error_reason_msg,
|
||||||
VIR_FREE(data.devAlias);
|
&data);
|
||||||
VIR_FREE(data.reason);
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -598,7 +623,8 @@ remoteRelayDomainEventGraphics(virConnectPtr conn,
|
|||||||
VIR_STRDUP(data.subject.subject_val[i].name, subject->identities[i].name) < 0)
|
VIR_STRDUP(data.subject.subject_val[i].name, subject->identities[i].name) < 0)
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -616,18 +642,8 @@ remoteRelayDomainEventGraphics(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(data.authScheme);
|
xdr_free((xdrproc_t)xdr_remote_domain_event_graphics_msg,
|
||||||
VIR_FREE(data.local.node);
|
&data);
|
||||||
VIR_FREE(data.local.service);
|
|
||||||
VIR_FREE(data.remote.node);
|
|
||||||
VIR_FREE(data.remote.service);
|
|
||||||
if (data.subject.subject_val != NULL) {
|
|
||||||
for (i = 0; i < data.subject.subject_len; i++) {
|
|
||||||
VIR_FREE(data.subject.subject_val[i].type);
|
|
||||||
VIR_FREE(data.subject.subject_val[i].name);
|
|
||||||
}
|
|
||||||
VIR_FREE(data.subject.subject_val);
|
|
||||||
}
|
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -655,7 +671,8 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
data.type = type;
|
data.type = type;
|
||||||
data.status = status;
|
data.status = status;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -671,6 +688,11 @@ remoteRelayDomainEventBlockJob(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_block_job_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -691,7 +713,8 @@ remoteRelayDomainEventControlError(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -707,6 +730,11 @@ remoteRelayDomainEventControlError(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_control_error_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -749,7 +777,8 @@ remoteRelayDomainEventDiskChange(virConnectPtr conn,
|
|||||||
goto error;
|
goto error;
|
||||||
data.reason = reason;
|
data.reason = reason;
|
||||||
|
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -767,8 +796,8 @@ remoteRelayDomainEventDiskChange(virConnectPtr conn,
|
|||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(oldSrcPath_p);
|
xdr_free((xdrproc_t)xdr_remote_domain_event_disk_change_msg,
|
||||||
VIR_FREE(newSrcPath_p);
|
&data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -797,7 +826,8 @@ remoteRelayDomainEventTrayChange(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
data.reason = reason;
|
data.reason = reason;
|
||||||
|
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -813,6 +843,11 @@ remoteRelayDomainEventTrayChange(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_tray_change_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -833,7 +868,8 @@ remoteRelayDomainEventPMWakeup(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -849,6 +885,11 @@ remoteRelayDomainEventPMWakeup(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_pmwakeup_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -869,7 +910,8 @@ remoteRelayDomainEventPMSuspend(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -885,6 +927,11 @@ remoteRelayDomainEventPMSuspend(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_pmsuspend_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -905,7 +952,8 @@ remoteRelayDomainEventBalloonChange(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.actual = actual;
|
data.actual = actual;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
@ -922,6 +970,11 @@ remoteRelayDomainEventBalloonChange(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_balloon_change_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -943,7 +996,8 @@ remoteRelayDomainEventPMSuspendDisk(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -959,6 +1013,11 @@ remoteRelayDomainEventPMSuspendDisk(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_pmsuspend_disk_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -983,7 +1042,8 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn,
|
|||||||
if (VIR_STRDUP(data.devAlias, devAlias) < 0)
|
if (VIR_STRDUP(data.devAlias, devAlias) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (callback->legacy) {
|
if (callback->legacy) {
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -1001,6 +1061,11 @@ remoteRelayDomainEventDeviceRemoved(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_device_removed_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1029,13 +1094,19 @@ remoteRelayDomainEventBlockJob2(virConnectPtr conn,
|
|||||||
return -1;
|
return -1;
|
||||||
data.type = type;
|
data.type = type;
|
||||||
data.status = status;
|
data.status = status;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2,
|
REMOTE_PROC_DOMAIN_EVENT_BLOCK_JOB_2,
|
||||||
(xdrproc_t)xdr_remote_domain_event_block_job_2_msg, &data);
|
(xdrproc_t)xdr_remote_domain_event_block_job_2_msg, &data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_block_job_2_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1059,7 +1130,8 @@ remoteRelayDomainEventTunable(virConnectPtr conn,
|
|||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (virTypedParamsSerialize(params, nparams,
|
if (virTypedParamsSerialize(params, nparams,
|
||||||
(virTypedParameterRemotePtr *) &data.params.params_val,
|
(virTypedParameterRemotePtr *) &data.params.params_val,
|
||||||
@ -1075,6 +1147,11 @@ remoteRelayDomainEventTunable(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_callback_tunable_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1099,7 +1176,8 @@ remoteRelayDomainEventAgentLifecycle(virConnectPtr conn,
|
|||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
data.state = state;
|
data.state = state;
|
||||||
data.reason = reason;
|
data.reason = reason;
|
||||||
@ -1110,6 +1188,11 @@ remoteRelayDomainEventAgentLifecycle(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_callback_agent_lifecycle_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1135,7 +1218,8 @@ remoteRelayDomainEventDeviceAdded(virConnectPtr conn,
|
|||||||
if (VIR_STRDUP(data.devAlias, devAlias) < 0)
|
if (VIR_STRDUP(data.devAlias, devAlias) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -1144,6 +1228,11 @@ remoteRelayDomainEventDeviceAdded(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_callback_device_added_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1167,7 +1256,8 @@ remoteRelayDomainEventMigrationIteration(virConnectPtr conn,
|
|||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
data.iteration = iteration;
|
data.iteration = iteration;
|
||||||
|
|
||||||
@ -1177,6 +1267,11 @@ remoteRelayDomainEventMigrationIteration(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_callback_migration_iteration_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1201,7 +1296,8 @@ remoteRelayDomainEventJobCompleted(virConnectPtr conn,
|
|||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
if (virTypedParamsSerialize(params, nparams,
|
if (virTypedParamsSerialize(params, nparams,
|
||||||
(virTypedParameterRemotePtr *) &data.params.params_val,
|
(virTypedParameterRemotePtr *) &data.params.params_val,
|
||||||
@ -1216,6 +1312,11 @@ remoteRelayDomainEventJobCompleted(virConnectPtr conn,
|
|||||||
(xdrproc_t)xdr_remote_domain_event_callback_job_completed_msg,
|
(xdrproc_t)xdr_remote_domain_event_callback_job_completed_msg,
|
||||||
&data);
|
&data);
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_callback_job_completed_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1241,7 +1342,8 @@ remoteRelayDomainEventDeviceRemovalFailed(virConnectPtr conn,
|
|||||||
if (VIR_STRDUP(data.devAlias, devAlias) < 0)
|
if (VIR_STRDUP(data.devAlias, devAlias) < 0)
|
||||||
return -1;
|
return -1;
|
||||||
|
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -1250,6 +1352,11 @@ remoteRelayDomainEventDeviceRemovalFailed(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_callback_device_removal_failed_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1285,7 +1392,8 @@ remoteRelayDomainEventMetadataChange(virConnectPtr conn,
|
|||||||
data.nsuri = nsurip;
|
data.nsuri = nsurip;
|
||||||
}
|
}
|
||||||
|
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -1294,6 +1402,11 @@ remoteRelayDomainEventMetadataChange(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_domain_event_callback_metadata_change_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -1329,15 +1442,18 @@ remoteRelayDomainEventBlockThreshold(virConnectPtr conn,
|
|||||||
}
|
}
|
||||||
data.threshold = threshold;
|
data.threshold = threshold;
|
||||||
data.excess = excess;
|
data.excess = excess;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD,
|
REMOTE_PROC_DOMAIN_EVENT_BLOCK_THRESHOLD,
|
||||||
(xdrproc_t)xdr_remote_domain_event_block_threshold_msg, &data);
|
(xdrproc_t)xdr_remote_domain_event_block_threshold_msg, &data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(data.dev);
|
xdr_free((xdrproc_t)xdr_remote_domain_event_block_threshold_msg,
|
||||||
|
&data);
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1391,7 +1507,8 @@ remoteRelayNetworkEventLifecycle(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_network(&data.net, net);
|
if (make_nonnull_network(&data.net, net) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
data.event = event;
|
data.event = event;
|
||||||
data.detail = detail;
|
data.detail = detail;
|
||||||
@ -1401,6 +1518,11 @@ remoteRelayNetworkEventLifecycle(virConnectPtr conn,
|
|||||||
(xdrproc_t)xdr_remote_network_event_lifecycle_msg, &data);
|
(xdrproc_t)xdr_remote_network_event_lifecycle_msg, &data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_network_event_lifecycle_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static virConnectNetworkEventGenericCallback networkEventCallbacks[] = {
|
static virConnectNetworkEventGenericCallback networkEventCallbacks[] = {
|
||||||
@ -1428,7 +1550,8 @@ remoteRelayStoragePoolEventLifecycle(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_storage_pool(&data.pool, pool);
|
if (make_nonnull_storage_pool(&data.pool, pool) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
data.event = event;
|
data.event = event;
|
||||||
data.detail = detail;
|
data.detail = detail;
|
||||||
@ -1439,6 +1562,11 @@ remoteRelayStoragePoolEventLifecycle(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_storage_pool_event_lifecycle_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1458,7 +1586,8 @@ remoteRelayStoragePoolEventRefresh(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_storage_pool(&data.pool, pool);
|
if (make_nonnull_storage_pool(&data.pool, pool) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -1467,6 +1596,11 @@ remoteRelayStoragePoolEventRefresh(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_storage_pool_event_refresh_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static virConnectStoragePoolEventGenericCallback storageEventCallbacks[] = {
|
static virConnectStoragePoolEventGenericCallback storageEventCallbacks[] = {
|
||||||
@ -1495,7 +1629,8 @@ remoteRelayNodeDeviceEventLifecycle(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_node_device(&data.dev, dev);
|
if (make_nonnull_node_device(&data.dev, dev) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
data.event = event;
|
data.event = event;
|
||||||
data.detail = detail;
|
data.detail = detail;
|
||||||
@ -1506,6 +1641,11 @@ remoteRelayNodeDeviceEventLifecycle(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_node_device_event_lifecycle_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1525,7 +1665,8 @@ remoteRelayNodeDeviceEventUpdate(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_node_device(&data.dev, dev);
|
if (make_nonnull_node_device(&data.dev, dev) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -1534,6 +1675,11 @@ remoteRelayNodeDeviceEventUpdate(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_node_device_event_update_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static virConnectNodeDeviceEventGenericCallback nodeDeviceEventCallbacks[] = {
|
static virConnectNodeDeviceEventGenericCallback nodeDeviceEventCallbacks[] = {
|
||||||
@ -1562,7 +1708,8 @@ remoteRelaySecretEventLifecycle(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_secret(&data.secret, secret);
|
if (make_nonnull_secret(&data.secret, secret) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
data.event = event;
|
data.event = event;
|
||||||
data.detail = detail;
|
data.detail = detail;
|
||||||
@ -1573,6 +1720,11 @@ remoteRelaySecretEventLifecycle(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_secret_event_lifecycle_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
@ -1592,7 +1744,8 @@ remoteRelaySecretEventValueChanged(virConnectPtr conn,
|
|||||||
|
|
||||||
/* build return data */
|
/* build return data */
|
||||||
memset(&data, 0, sizeof(data));
|
memset(&data, 0, sizeof(data));
|
||||||
make_nonnull_secret(&data.secret, secret);
|
if (make_nonnull_secret(&data.secret, secret) < 0)
|
||||||
|
goto error;
|
||||||
data.callbackID = callback->callbackID;
|
data.callbackID = callback->callbackID;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
remoteDispatchObjectEventSend(callback->client, remoteProgram,
|
||||||
@ -1601,6 +1754,11 @@ remoteRelaySecretEventValueChanged(virConnectPtr conn,
|
|||||||
&data);
|
&data);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
|
error:
|
||||||
|
xdr_free((xdrproc_t)xdr_remote_secret_event_value_changed_msg,
|
||||||
|
&data);
|
||||||
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static virConnectSecretEventGenericCallback secretEventCallbacks[] = {
|
static virConnectSecretEventGenericCallback secretEventCallbacks[] = {
|
||||||
@ -1643,7 +1801,8 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr conn,
|
|||||||
VIR_STRDUP(*details_p, details) < 0))
|
VIR_STRDUP(*details_p, details) < 0))
|
||||||
goto error;
|
goto error;
|
||||||
data.details = details_p;
|
data.details = details_p;
|
||||||
make_nonnull_domain(&data.dom, dom);
|
if (make_nonnull_domain(&data.dom, dom) < 0)
|
||||||
|
goto error;
|
||||||
|
|
||||||
remoteDispatchObjectEventSend(callback->client, qemuProgram,
|
remoteDispatchObjectEventSend(callback->client, qemuProgram,
|
||||||
QEMU_PROC_DOMAIN_MONITOR_EVENT,
|
QEMU_PROC_DOMAIN_MONITOR_EVENT,
|
||||||
@ -1652,8 +1811,9 @@ remoteRelayDomainQemuMonitorEvent(virConnectPtr conn,
|
|||||||
return;
|
return;
|
||||||
|
|
||||||
error:
|
error:
|
||||||
VIR_FREE(data.event);
|
xdr_free((xdrproc_t)xdr_qemu_domain_monitor_event_msg,
|
||||||
VIR_FREE(details_p);
|
&data);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
static
|
static
|
||||||
@ -4647,7 +4807,8 @@ remoteDispatchDomainMigrateFinish3(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
args->cancelled)))
|
args->cancelled)))
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
make_nonnull_domain(&ret->dom, dom);
|
if (make_nonnull_domain(&ret->dom, dom) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
/* remoteDispatchClientRequest will free cookie
|
/* remoteDispatchClientRequest will free cookie
|
||||||
*/
|
*/
|
||||||
@ -5583,7 +5744,8 @@ remoteDispatchDomainMigrateFinish3Params(virNetServerPtr server ATTRIBUTE_UNUSED
|
|||||||
if (!dom)
|
if (!dom)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
make_nonnull_domain(&ret->dom, dom);
|
if (make_nonnull_domain(&ret->dom, dom) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
ret->cookie_out.cookie_out_len = cookieoutlen;
|
ret->cookie_out.cookie_out_len = cookieoutlen;
|
||||||
ret->cookie_out.cookie_out_val = cookieout;
|
ret->cookie_out.cookie_out_val = cookieout;
|
||||||
@ -5738,7 +5900,9 @@ remoteDispatchDomainCreateXMLWithFiles(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
args->flags)) == NULL)
|
args->flags)) == NULL)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
make_nonnull_domain(&ret->dom, dom);
|
if (make_nonnull_domain(&ret->dom, dom) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
rv = 0;
|
rv = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -5788,7 +5952,9 @@ static int remoteDispatchDomainCreateWithFiles(virNetServerPtr server ATTRIBUTE_
|
|||||||
args->flags) < 0)
|
args->flags) < 0)
|
||||||
goto cleanup;
|
goto cleanup;
|
||||||
|
|
||||||
make_nonnull_domain(&ret->dom, dom);
|
if (make_nonnull_domain(&ret->dom, dom) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
rv = 0;
|
rv = 0;
|
||||||
|
|
||||||
cleanup:
|
cleanup:
|
||||||
@ -6684,7 +6850,8 @@ remoteDispatchConnectGetAllDomainStats(virNetServerPtr server ATTRIBUTE_UNUSED,
|
|||||||
for (i = 0; i < nrecords; i++) {
|
for (i = 0; i < nrecords; i++) {
|
||||||
remote_domain_stats_record *dst = ret->retStats.retStats_val + i;
|
remote_domain_stats_record *dst = ret->retStats.retStats_val + i;
|
||||||
|
|
||||||
make_nonnull_domain(&dst->dom, retStats[i]->dom);
|
if (make_nonnull_domain(&dst->dom, retStats[i]->dom) < 0)
|
||||||
|
goto cleanup;
|
||||||
|
|
||||||
if (virTypedParamsSerialize(retStats[i]->params,
|
if (virTypedParamsSerialize(retStats[i]->params,
|
||||||
retStats[i]->nparams,
|
retStats[i]->nparams,
|
||||||
@ -7104,77 +7271,113 @@ get_nonnull_node_device(virConnectPtr conn, remote_nonnull_node_device dev)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Make remote_nonnull_domain and remote_nonnull_network. */
|
/* Make remote_nonnull_domain and remote_nonnull_network. */
|
||||||
static void
|
static int
|
||||||
make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src)
|
make_nonnull_domain(remote_nonnull_domain *dom_dst, virDomainPtr dom_src)
|
||||||
{
|
{
|
||||||
dom_dst->id = dom_src->id;
|
dom_dst->id = dom_src->id;
|
||||||
ignore_value(VIR_STRDUP_QUIET(dom_dst->name, dom_src->name));
|
if (VIR_STRDUP(dom_dst->name, dom_src->name) < 0)
|
||||||
|
return -1;
|
||||||
memcpy(dom_dst->uuid, dom_src->uuid, VIR_UUID_BUFLEN);
|
memcpy(dom_dst->uuid, dom_src->uuid, VIR_UUID_BUFLEN);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src)
|
make_nonnull_network(remote_nonnull_network *net_dst, virNetworkPtr net_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(net_dst->name, net_src->name));
|
if (VIR_STRDUP(net_dst->name, net_src->name) < 0)
|
||||||
|
return -1;
|
||||||
memcpy(net_dst->uuid, net_src->uuid, VIR_UUID_BUFLEN);
|
memcpy(net_dst->uuid, net_src->uuid, VIR_UUID_BUFLEN);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_interface(remote_nonnull_interface *interface_dst,
|
make_nonnull_interface(remote_nonnull_interface *interface_dst,
|
||||||
virInterfacePtr interface_src)
|
virInterfacePtr interface_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(interface_dst->name, interface_src->name));
|
if (VIR_STRDUP(interface_dst->name, interface_src->name) < 0)
|
||||||
ignore_value(VIR_STRDUP_QUIET(interface_dst->mac, interface_src->mac));
|
return -1;
|
||||||
|
if (VIR_STRDUP(interface_dst->mac, interface_src->mac) < 0) {
|
||||||
|
VIR_FREE(interface_dst->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src)
|
make_nonnull_storage_pool(remote_nonnull_storage_pool *pool_dst, virStoragePoolPtr pool_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(pool_dst->name, pool_src->name));
|
if (VIR_STRDUP(pool_dst->name, pool_src->name) < 0)
|
||||||
|
return -1;
|
||||||
memcpy(pool_dst->uuid, pool_src->uuid, VIR_UUID_BUFLEN);
|
memcpy(pool_dst->uuid, pool_src->uuid, VIR_UUID_BUFLEN);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src)
|
make_nonnull_storage_vol(remote_nonnull_storage_vol *vol_dst, virStorageVolPtr vol_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(vol_dst->pool, vol_src->pool));
|
if (VIR_STRDUP(vol_dst->pool, vol_src->pool) < 0)
|
||||||
ignore_value(VIR_STRDUP_QUIET(vol_dst->name, vol_src->name));
|
return -1;
|
||||||
ignore_value(VIR_STRDUP_QUIET(vol_dst->key, vol_src->key));
|
if (VIR_STRDUP(vol_dst->name, vol_src->name) < 0) {
|
||||||
|
VIR_FREE(vol_dst->pool);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
if (VIR_STRDUP(vol_dst->key, vol_src->key) < 0) {
|
||||||
|
VIR_FREE(vol_dst->pool);
|
||||||
|
VIR_FREE(vol_dst->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src)
|
make_nonnull_node_device(remote_nonnull_node_device *dev_dst, virNodeDevicePtr dev_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(dev_dst->name, dev_src->name));
|
if (VIR_STRDUP(dev_dst->name, dev_src->name) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src)
|
make_nonnull_secret(remote_nonnull_secret *secret_dst, virSecretPtr secret_src)
|
||||||
{
|
{
|
||||||
memcpy(secret_dst->uuid, secret_src->uuid, VIR_UUID_BUFLEN);
|
memcpy(secret_dst->uuid, secret_src->uuid, VIR_UUID_BUFLEN);
|
||||||
secret_dst->usageType = secret_src->usageType;
|
secret_dst->usageType = secret_src->usageType;
|
||||||
ignore_value(VIR_STRDUP_QUIET(secret_dst->usageID, secret_src->usageID));
|
if (VIR_STRDUP(secret_dst->usageID, secret_src->usageID) < 0)
|
||||||
|
return -1;
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_nwfilter(remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src)
|
make_nonnull_nwfilter(remote_nonnull_nwfilter *nwfilter_dst, virNWFilterPtr nwfilter_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(nwfilter_dst->name, nwfilter_src->name));
|
if (VIR_STRDUP(nwfilter_dst->name, nwfilter_src->name) < 0)
|
||||||
|
return -1;
|
||||||
memcpy(nwfilter_dst->uuid, nwfilter_src->uuid, VIR_UUID_BUFLEN);
|
memcpy(nwfilter_dst->uuid, nwfilter_src->uuid, VIR_UUID_BUFLEN);
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_nwfilter_binding(remote_nonnull_nwfilter_binding *binding_dst, virNWFilterBindingPtr binding_src)
|
make_nonnull_nwfilter_binding(remote_nonnull_nwfilter_binding *binding_dst, virNWFilterBindingPtr binding_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(binding_dst->portdev, binding_src->portdev));
|
if (VIR_STRDUP(binding_dst->portdev, binding_src->portdev) < 0)
|
||||||
ignore_value(VIR_STRDUP_QUIET(binding_dst->filtername, binding_src->filtername));
|
return -1;
|
||||||
|
if (VIR_STRDUP(binding_dst->filtername, binding_src->filtername) < 0) {
|
||||||
|
VIR_FREE(binding_dst->portdev);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static int
|
||||||
make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src)
|
make_nonnull_domain_snapshot(remote_nonnull_domain_snapshot *snapshot_dst, virDomainSnapshotPtr snapshot_src)
|
||||||
{
|
{
|
||||||
ignore_value(VIR_STRDUP_QUIET(snapshot_dst->name, snapshot_src->name));
|
if (VIR_STRDUP(snapshot_dst->name, snapshot_src->name) < 0)
|
||||||
make_nonnull_domain(&snapshot_dst->dom, snapshot_src->domain);
|
return -1;
|
||||||
|
if (make_nonnull_domain(&snapshot_dst->dom, snapshot_src->domain) < 0) {
|
||||||
|
VIR_FREE(snapshot_dst->name);
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -786,12 +786,12 @@ elsif ($mode eq "server") {
|
|||||||
if ($call->{ProcName} eq "DomainCreateWithFlags") {
|
if ($call->{ProcName} eq "DomainCreateWithFlags") {
|
||||||
# SPECIAL: virDomainCreateWithFlags updates the given
|
# SPECIAL: virDomainCreateWithFlags updates the given
|
||||||
# domain object instead of returning a new one
|
# domain object instead of returning a new one
|
||||||
push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
|
push(@ret_list, "if (make_nonnull_$1(&ret->$2, $2) < 0)\n goto cleanup;\n");
|
||||||
$single_ret_var = undef;
|
$single_ret_var = undef;
|
||||||
$single_ret_by_ref = 1;
|
$single_ret_by_ref = 1;
|
||||||
} else {
|
} else {
|
||||||
push(@vars_list, "vir${type_name}Ptr $2 = NULL");
|
push(@vars_list, "vir${type_name}Ptr $2 = NULL");
|
||||||
push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
|
push(@ret_list, "if (make_nonnull_$1(&ret->$2, $2) < 0)\n goto cleanup;\n");
|
||||||
push(@free_list,
|
push(@free_list,
|
||||||
" virObjectUnref($2);");
|
" virObjectUnref($2);");
|
||||||
$single_ret_var = $2;
|
$single_ret_var = $2;
|
||||||
@ -907,11 +907,11 @@ elsif ($mode eq "server") {
|
|||||||
|
|
||||||
if ($1 eq "client") {
|
if ($1 eq "client") {
|
||||||
push(@vars_list, "virNetServer${type_name}Ptr $2 = NULL");
|
push(@vars_list, "virNetServer${type_name}Ptr $2 = NULL");
|
||||||
push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
|
push(@ret_list, "if (make_nonnull_$1(&ret->$2, $2) < 0)\n goto cleanup;\n");
|
||||||
push(@ret_list, "make_nonnull_server(&ret->$2.srv, srv);");
|
push(@ret_list, "if (make_nonnull_server(&ret->$2.srv, srv) < 0)\n goto cleanup;\n");
|
||||||
} else {
|
} else {
|
||||||
push(@vars_list, "virNet${type_name}Ptr $2 = NULL");
|
push(@vars_list, "virNet${type_name}Ptr $2 = NULL");
|
||||||
push(@ret_list, "make_nonnull_$1(&ret->$2, $2);");
|
push(@ret_list, "if (make_nonnull_$1(&ret->$2, $2) < 0)\n goto cleanup;\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
push(@free_list,
|
push(@free_list,
|
||||||
@ -1175,12 +1175,15 @@ elsif ($mode eq "server") {
|
|||||||
print " ret->$single_ret_list_name.${single_ret_list_name}_len = nresults;\n";
|
print " ret->$single_ret_list_name.${single_ret_list_name}_len = nresults;\n";
|
||||||
if ($modern_ret_is_nested) {
|
if ($modern_ret_is_nested) {
|
||||||
print " for (i = 0; i < nresults; i++) {\n";
|
print " for (i = 0; i < nresults; i++) {\n";
|
||||||
print " make_nonnull_$modern_ret_struct_name(ret->$single_ret_list_name.${single_ret_list_name}_val + i, result[i]);\n";
|
print " if (make_nonnull_$modern_ret_struct_name(ret->$single_ret_list_name.${single_ret_list_name}_val + i, result[i]) < 0)\n";
|
||||||
print " make_nonnull_$modern_ret_nested_struct_name(&ret->$single_ret_list_name.${single_ret_list_name}_val[i].srv, srv);\n";
|
print " goto cleanup;\n";
|
||||||
|
print " if (make_nonnull_$modern_ret_nested_struct_name(&ret->$single_ret_list_name.${single_ret_list_name}_val[i].srv, srv) < 0)\n";
|
||||||
|
print " goto cleanup;\n";
|
||||||
print " }\n";
|
print " }\n";
|
||||||
} else {
|
} else {
|
||||||
print " for (i = 0; i < nresults; i++)\n";
|
print " for (i = 0; i < nresults; i++)\n";
|
||||||
print " make_nonnull_$modern_ret_struct_name(ret->$single_ret_list_name.${single_ret_list_name}_val + i, result[i]);\n";
|
print " if (make_nonnull_$modern_ret_struct_name(ret->$single_ret_list_name.${single_ret_list_name}_val + i, result[i]) < 0)\n";
|
||||||
|
print " goto cleanup;\n";
|
||||||
}
|
}
|
||||||
print " } else {\n";
|
print " } else {\n";
|
||||||
print " ret->$single_ret_list_name.${single_ret_list_name}_len = 0;\n";
|
print " ret->$single_ret_list_name.${single_ret_list_name}_len = 0;\n";
|
||||||
|
Loading…
Reference in New Issue
Block a user