but left virDomainEventRegister and its Deregister brother as these are legacy functions only for domain lifecycle events. --- cfg.mk | 4 +- src/conf/domain_event.c | 100 ++++++++++++++++++++-------------------- src/conf/domain_event.h | 26 +++++------ src/libvirt_private.syms | 10 ++-- src/libxl/libxl_conf.h | 2 +- src/libxl/libxl_driver.c | 8 ++-- src/lxc/lxc_conf.h | 2 +- src/lxc/lxc_driver.c | 22 ++++----- src/lxc/lxc_process.c | 6 +-- src/parallels/parallels_utils.h | 2 +- src/qemu/qemu_conf.h | 2 +- src/qemu/qemu_domain.c | 2 +- src/qemu/qemu_driver.c | 6 +-- src/remote/remote_driver.c | 14 +++--- src/test/test_driver.c | 10 ++-- src/uml/uml_conf.h | 2 +- src/uml/uml_driver.c | 8 ++-- src/vbox/vbox_tmpl.c | 14 +++--- src/xen/xen_driver.c | 8 ++-- src/xen/xen_driver.h | 2 +- tests/qemuhotplugtest.c | 2 +- 21 files changed, 126 insertions(+), 126 deletions(-) diff --git a/cfg.mk b/cfg.mk index bd3dd48..c256164 100644 --- a/cfg.mk +++ b/cfg.mk @@ -126,8 +126,8 @@ useless_free_options = \ --name=virDomainDiskDefFree \ --name=virDomainEventCallbackListFree \ --name=virDomainEventFree \ - --name=virDomainEventQueueFree \ - --name=virDomainEventStateFree \ + --name=virObjectEventQueueFree \ + --name=virObjectEventStateFree \ --name=virDomainFSDefFree \ --name=virDomainGraphicsDefFree \ --name=virDomainHostdevDefFree \ diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index a4af23a..b29da12 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -51,7 +51,7 @@ struct _virObjectEventQueue { virDomainEventPtr *events; }; -struct _virDomainEventState { +struct _virObjectEventState { /* The list of domain event callbacks */ virDomainEventCallbackListPtr callbacks; /* The queue of object events */ @@ -576,25 +576,25 @@ virObjectEventQueueNew(void) } static void -virDomainEventStateLock(virDomainEventStatePtr state) +virObjectEventStateLock(virObjectEventStatePtr state) { virMutexLock(&state->lock); } static void -virDomainEventStateUnlock(virDomainEventStatePtr state) +virObjectEventStateUnlock(virObjectEventStatePtr state) { virMutexUnlock(&state->lock); } /** - * virDomainEventStateFree: - * @list: virDomainEventStatePtr to free + * virObjectEventStateFree: + * @list: virObjectEventStatePtr to free * - * Free a virDomainEventStatePtr and its members, and unregister the timer. + * Free a virObjectEventStatePtr and its members, and unregister the timer. */ void -virDomainEventStateFree(virDomainEventStatePtr state) +virObjectEventStateFree(virObjectEventStatePtr state) { if (!state) return; @@ -610,23 +610,23 @@ virDomainEventStateFree(virDomainEventStatePtr state) } -static void virDomainEventStateFlush(virDomainEventStatePtr state); +static void virObjectEventStateFlush(virObjectEventStatePtr state); static void virDomainEventTimer(int timer ATTRIBUTE_UNUSED, void *opaque) { - virDomainEventStatePtr state = opaque; + virObjectEventStatePtr state = opaque; - virDomainEventStateFlush(state); + virObjectEventStateFlush(state); } /** - * virDomainEventStateNew: + * virObjectEventStateNew: */ -virDomainEventStatePtr -virDomainEventStateNew(void) +virObjectEventStatePtr +virObjectEventStateNew(void) { - virDomainEventStatePtr state = NULL; + virObjectEventStatePtr state = NULL; if (VIR_ALLOC(state) < 0) goto error; @@ -649,7 +649,7 @@ virDomainEventStateNew(void) return state; error: - virDomainEventStateFree(state); + virObjectEventStateFree(state); return NULL; } @@ -1434,7 +1434,7 @@ virObjectEventQueueDispatch(virObjectEventQueuePtr queue, } void -virDomainEventStateQueue(virDomainEventStatePtr state, +virObjectEventStateQueue(virObjectEventStatePtr state, virDomainEventPtr event) { if (state->timer < 0) { @@ -1442,7 +1442,7 @@ virDomainEventStateQueue(virDomainEventStatePtr state, return; } - virDomainEventStateLock(state); + virObjectEventStateLock(state); if (virObjectEventQueuePush(state->queue, event) < 0) { VIR_DEBUG("Error adding event to queue"); @@ -1451,32 +1451,32 @@ virDomainEventStateQueue(virDomainEventStatePtr state, if (state->queue->count == 1) virEventUpdateTimeout(state->timer, 0); - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); } static void -virDomainEventStateDispatchFunc(virConnectPtr conn, +virObjectEventStateDispatchFunc(virConnectPtr conn, virDomainEventPtr event, virConnectDomainEventGenericCallback cb, void *cbopaque, void *opaque) { - virDomainEventStatePtr state = opaque; + virObjectEventStatePtr state = opaque; /* Drop the lock whle dispatching, for sake of re-entrancy */ - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); virDomainEventDispatchDefaultFunc(conn, event, cb, cbopaque, NULL); - virDomainEventStateLock(state); + virObjectEventStateLock(state); } static void -virDomainEventStateFlush(virDomainEventStatePtr state) +virObjectEventStateFlush(virObjectEventStatePtr state) { virObjectEventQueue tempQueue; - virDomainEventStateLock(state); + virObjectEventStateLock(state); state->isDispatching = true; /* Copy the queue, so we're reentrant safe when dispatchFunc drops the @@ -1489,21 +1489,21 @@ virDomainEventStateFlush(virDomainEventStatePtr state) virObjectEventQueueDispatch(&tempQueue, state->callbacks, - virDomainEventStateDispatchFunc, + virObjectEventStateDispatchFunc, state); /* Purge any deleted callbacks */ virDomainEventCallbackListPurgeMarked(state->callbacks); state->isDispatching = false; - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); } /** * virDomainEventStateRegister: * @conn: connection to associate with callback - * @state: domain event state + * @state: object event state * @callback: function to remove from event * @opaque: data blob to pass to callback * @freecb: callback to free @opaque @@ -1515,14 +1515,14 @@ virDomainEventStateFlush(virDomainEventStatePtr state) */ int virDomainEventStateRegister(virConnectPtr conn, - virDomainEventStatePtr state, + virObjectEventStatePtr state, virConnectDomainEventCallback callback, void *opaque, virFreeCallback freecb) { int ret = -1; - virDomainEventStateLock(state); + virObjectEventStateLock(state); if ((state->callbacks->count == 0) && (state->timer == -1) && @@ -1546,7 +1546,7 @@ virDomainEventStateRegister(virConnectPtr conn, } cleanup: - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); return ret; } @@ -1554,7 +1554,7 @@ cleanup: /** * virDomainEventStateRegisterID: * @conn: connection to associate with callback - * @state: domain event state + * @state: object event state * @eventID: ID of the event type to register for * @cb: function to remove from event * @opaque: data blob to pass to callback @@ -1568,7 +1568,7 @@ cleanup: */ int virDomainEventStateRegisterID(virConnectPtr conn, - virDomainEventStatePtr state, + virObjectEventStatePtr state, virDomainPtr dom, int eventID, virConnectDomainEventGenericCallback cb, @@ -1578,7 +1578,7 @@ virDomainEventStateRegisterID(virConnectPtr conn, { int ret = -1; - virDomainEventStateLock(state); + virObjectEventStateLock(state); if ((state->callbacks->count == 0) && (state->timer == -1) && @@ -1603,7 +1603,7 @@ virDomainEventStateRegisterID(virConnectPtr conn, } cleanup: - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); return ret; } @@ -1611,7 +1611,7 @@ cleanup: /** * virDomainEventStateDeregister: * @conn: connection to associate with callback - * @state: domain event state + * @state: object event state * @callback: function to remove from event * * Unregister the function @callback with connection @conn, @@ -1621,12 +1621,12 @@ cleanup: */ int virDomainEventStateDeregister(virConnectPtr conn, - virDomainEventStatePtr state, + virObjectEventStatePtr state, virConnectDomainEventCallback callback) { int ret; - virDomainEventStateLock(state); + virObjectEventStateLock(state); if (state->isDispatching) ret = virDomainEventCallbackListMarkDelete(conn, state->callbacks, callback); @@ -1640,15 +1640,15 @@ virDomainEventStateDeregister(virConnectPtr conn, virObjectEventQueueClear(state->queue); } - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); return ret; } /** - * virDomainEventStateDeregisterID: + * virObjectEventStateDeregisterID: * @conn: connection to associate with callback - * @state: domain event state + * @state: object event state * @callbackID: ID of the function to remove from event * * Unregister the function @callbackID with connection @conn, @@ -1657,13 +1657,13 @@ virDomainEventStateDeregister(virConnectPtr conn, * Returns: the number of callbacks still registered, or -1 on error */ int -virDomainEventStateDeregisterID(virConnectPtr conn, - virDomainEventStatePtr state, +virObjectEventStateDeregisterID(virConnectPtr conn, + virObjectEventStatePtr state, int callbackID) { int ret; - virDomainEventStateLock(state); + virObjectEventStateLock(state); if (state->isDispatching) ret = virDomainEventCallbackListMarkDeleteID(conn, state->callbacks, callbackID); @@ -1678,15 +1678,15 @@ virDomainEventStateDeregisterID(virConnectPtr conn, virObjectEventQueueClear(state->queue); } - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); return ret; } /** - * virDomainEventStateEventID: + * virObjectEventStateEventID: * @conn: connection associated with the callback - * @state: domain event state + * @state: object event state * @callbackID: the callback to query * * Query what event ID type is associated with the @@ -1695,15 +1695,15 @@ virDomainEventStateDeregisterID(virConnectPtr conn, * Returns 0 on success, -1 on error */ int -virDomainEventStateEventID(virConnectPtr conn, - virDomainEventStatePtr state, +virObjectEventStateEventID(virConnectPtr conn, + virObjectEventStatePtr state, int callbackID) { int ret; - virDomainEventStateLock(state); + virObjectEventStateLock(state); ret = virDomainEventCallbackListEventID(conn, state->callbacks, callbackID); - virDomainEventStateUnlock(state); + virObjectEventStateUnlock(state); return ret; } diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h index 2fe7731..c08f770 100644 --- a/src/conf/domain_event.h +++ b/src/conf/domain_event.h @@ -44,8 +44,8 @@ typedef virDomainEvent *virDomainEventPtr; typedef struct _virObjectEventQueue virObjectEventQueue; typedef virObjectEventQueue *virObjectEventQueuePtr; -typedef struct _virDomainEventState virDomainEventState; -typedef virDomainEventState *virDomainEventStatePtr; +typedef struct _virObjectEventState virObjectEventState; +typedef virObjectEventState *virObjectEventStatePtr; virDomainEventPtr virDomainEventNew(int id, const char *name, const unsigned char *uuid, int type, int detail); virDomainEventPtr virDomainEventNewFromDom(virDomainPtr dom, int type, int detail); @@ -139,22 +139,22 @@ virDomainEventPtr virDomainEventDeviceRemovedNewFromDom(virDomainPtr dom, void virDomainEventFree(virDomainEventPtr event); -void virDomainEventStateFree(virDomainEventStatePtr state); -virDomainEventStatePtr -virDomainEventStateNew(void); +void virObjectEventStateFree(virObjectEventStatePtr state); +virObjectEventStatePtr +virObjectEventStateNew(void); void -virDomainEventStateQueue(virDomainEventStatePtr state, +virObjectEventStateQueue(virObjectEventStatePtr state, virDomainEventPtr event) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int virDomainEventStateRegister(virConnectPtr conn, - virDomainEventStatePtr state, + virObjectEventStatePtr state, virConnectDomainEventCallback callback, void *opaque, virFreeCallback freecb) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int virDomainEventStateRegisterID(virConnectPtr conn, - virDomainEventStatePtr state, + virObjectEventStatePtr state, virDomainPtr dom, int eventID, virConnectDomainEventGenericCallback cb, @@ -164,17 +164,17 @@ int virDomainEventStateRegisterID(virConnectPtr conn, ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(5); int virDomainEventStateDeregister(virConnectPtr conn, - virDomainEventStatePtr state, + virObjectEventStatePtr state, virConnectDomainEventCallback callback) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2) ATTRIBUTE_NONNULL(3); int -virDomainEventStateDeregisterID(virConnectPtr conn, - virDomainEventStatePtr state, +virObjectEventStateDeregisterID(virConnectPtr conn, + virObjectEventStatePtr state, int callbackID) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); int -virDomainEventStateEventID(virConnectPtr conn, - virDomainEventStatePtr state, +virObjectEventStateEventID(virConnectPtr conn, + virObjectEventStatePtr state, int callbackID) ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2); diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms index 50fe00e..3933b40 100644 --- a/src/libvirt_private.syms +++ b/src/libvirt_private.syms @@ -444,17 +444,17 @@ virDomainEventRebootNewFromObj; virDomainEventRTCChangeNewFromDom; virDomainEventRTCChangeNewFromObj; virDomainEventStateDeregister; -virDomainEventStateDeregisterID; -virDomainEventStateEventID; -virDomainEventStateFree; -virDomainEventStateNew; -virDomainEventStateQueue; virDomainEventStateRegister; virDomainEventStateRegisterID; virDomainEventTrayChangeNewFromDom; virDomainEventTrayChangeNewFromObj; virDomainEventWatchdogNewFromDom; virDomainEventWatchdogNewFromObj; +virObjectEventStateDeregisterID; +virObjectEventStateEventID; +virObjectEventStateFree; +virObjectEventStateNew; +virObjectEventStateQueue; # conf/domain_nwfilter.h diff --git a/src/libxl/libxl_conf.h b/src/libxl/libxl_conf.h index 8ba0ee4..ffa93bd 100644 --- a/src/libxl/libxl_conf.h +++ b/src/libxl/libxl_conf.h @@ -105,7 +105,7 @@ struct _libxlDriverPrivate { virDomainXMLOptionPtr xmlopt; /* Immutable pointer, self-locking APIs */ - virDomainEventStatePtr domainEventState; + virObjectEventStatePtr domainEventState; /* Immutable pointer, self-locking APIs */ virPortAllocatorPtr reservedVNCPorts; diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 1b42f14..bc5f653 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -102,7 +102,7 @@ libxlDomObjFromDomain(virDomainPtr dom) static void libxlDomainEventQueue(libxlDriverPrivatePtr driver, virDomainEventPtr event) { - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); } static int @@ -778,7 +778,7 @@ libxlStateCleanup(void) virObjectUnref(libxl_driver->domains); virObjectUnref(libxl_driver->reservedVNCPorts); - virDomainEventStateFree(libxl_driver->domainEventState); + virObjectEventStateFree(libxl_driver->domainEventState); virSysinfoDefFree(libxl_driver->hostsysinfo); virMutexDestroy(&libxl_driver->lock); @@ -888,7 +888,7 @@ libxlStateInitialize(bool privileged, /* read the host sysinfo */ libxl_driver->hostsysinfo = virSysinfoRead(); - libxl_driver->domainEventState = virDomainEventStateNew(); + libxl_driver->domainEventState = virObjectEventStateNew(); if (!libxl_driver->domainEventState) goto error; @@ -4145,7 +4145,7 @@ libxlConnectDomainEventDeregisterAny(virConnectPtr conn, int callbackID) if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0) return -1; - ret = virDomainEventStateDeregisterID(conn, + ret = virObjectEventStateDeregisterID(conn, driver->domainEventState, callbackID); diff --git a/src/lxc/lxc_conf.h b/src/lxc/lxc_conf.h index a6208a2..f6cbfc9 100644 --- a/src/lxc/lxc_conf.h +++ b/src/lxc/lxc_conf.h @@ -97,7 +97,7 @@ struct _virLXCDriver { virUSBDeviceListPtr activeUsbHostdevs; /* Immutable pointer, self-locking APIs */ - virDomainEventStatePtr domainEventState; + virObjectEventStatePtr domainEventState; /* Immutable pointer. self-locking APIs */ virSecurityManagerPtr securityManager; diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 61a90ca..391226b 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -496,7 +496,7 @@ cleanup: if (vm) virObjectUnlock(vm); if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(caps); virObjectUnref(cfg); return dom; @@ -547,7 +547,7 @@ cleanup: if (vm) virObjectUnlock(vm); if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(cfg); return ret; } @@ -944,7 +944,7 @@ cleanup: if (vm) virObjectUnlock(vm); if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(cfg); return ret; } @@ -1054,7 +1054,7 @@ cleanup: if (vm) virObjectUnlock(vm); if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); virObjectUnref(caps); virObjectUnref(cfg); return dom; @@ -1245,7 +1245,7 @@ lxcConnectDomainEventDeregisterAny(virConnectPtr conn, if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0) return -1; - ret = virDomainEventStateDeregisterID(conn, + ret = virObjectEventStateDeregisterID(conn, driver->domainEventState, callbackID); @@ -1302,7 +1302,7 @@ cleanup: if (vm) virObjectUnlock(vm); if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); return ret; } @@ -1398,7 +1398,7 @@ static int lxcStateInitialize(bool privileged, if (!(lxc_driver->domains = virDomainObjListNew())) goto cleanup; - lxc_driver->domainEventState = virDomainEventStateNew(); + lxc_driver->domainEventState = virObjectEventStateNew(); if (!lxc_driver->domainEventState) goto cleanup; @@ -1486,7 +1486,7 @@ static void lxcNotifyLoadDomain(virDomainObjPtr vm, int newVM, void *opaque) VIR_DOMAIN_EVENT_DEFINED, VIR_DOMAIN_EVENT_DEFINED_ADDED); if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); } } @@ -1528,7 +1528,7 @@ static int lxcStateCleanup(void) virNWFilterUnRegisterCallbackDriver(&lxcCallbackDriver); virObjectUnref(lxc_driver->domains); - virDomainEventStateFree(lxc_driver->domainEventState); + virObjectEventStateFree(lxc_driver->domainEventState); virObjectUnref(lxc_driver->closeCallbacks); @@ -2372,7 +2372,7 @@ static int lxcDomainSuspend(virDomainPtr dom) cleanup: if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); if (vm) virObjectUnlock(vm); virObjectUnref(cfg); @@ -2422,7 +2422,7 @@ static int lxcDomainResume(virDomainPtr dom) cleanup: if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); if (vm) virObjectUnlock(vm); virObjectUnref(cfg); diff --git a/src/lxc/lxc_process.c b/src/lxc/lxc_process.c index c51c4d5..8214f62 100644 --- a/src/lxc/lxc_process.c +++ b/src/lxc/lxc_process.c @@ -82,7 +82,7 @@ lxcProcessAutoDestroy(virDomainObjPtr dom, } if (event) - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); return dom; } @@ -533,7 +533,7 @@ static void virLXCProcessMonitorEOFNotify(virLXCMonitorPtr mon, if (vm) virObjectUnlock(vm); if (event) { - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); } } @@ -1399,7 +1399,7 @@ virLXCProcessAutostartDomain(virDomainObjPtr vm, VIR_DOMAIN_EVENT_STARTED, VIR_DOMAIN_EVENT_STARTED_BOOTED); if (event) - virDomainEventStateQueue(data->driver->domainEventState, event); + virObjectEventStateQueue(data->driver->domainEventState, event); } } virObjectUnlock(vm); diff --git a/src/parallels/parallels_utils.h b/src/parallels/parallels_utils.h index 12403ea..6215553 100644 --- a/src/parallels/parallels_utils.h +++ b/src/parallels/parallels_utils.h @@ -44,7 +44,7 @@ struct _parallelsConn { virNetworkObjList networks; virCapsPtr caps; virDomainXMLOptionPtr xmlopt; - virDomainEventStatePtr domainEventState; + virObjectEventStatePtr domainEventState; }; typedef struct _parallelsConn parallelsConn; diff --git a/src/qemu/qemu_conf.h b/src/qemu/qemu_conf.h index f9ff7af..f26f7b9 100644 --- a/src/qemu/qemu_conf.h +++ b/src/qemu/qemu_conf.h @@ -207,7 +207,7 @@ struct _virQEMUDriver { virQEMUCapsCachePtr qemuCapsCache; /* Immutable pointer, self-locking APIs */ - virDomainEventStatePtr domainEventState; + virObjectEventStatePtr domainEventState; /* Immutable pointer. self-locking APIs */ virSecurityManagerPtr securityManager; diff --git a/src/qemu/qemu_domain.c b/src/qemu/qemu_domain.c index 346fec3..a5fc8d6 100644 --- a/src/qemu/qemu_domain.c +++ b/src/qemu/qemu_domain.c @@ -120,7 +120,7 @@ qemuDomainAsyncJobPhaseFromString(enum qemuDomainAsyncJob job, void qemuDomainEventQueue(virQEMUDriverPtr driver, virDomainEventPtr event) { - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); } diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 47d8a09..8183643 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -597,7 +597,7 @@ qemuStateInitialize(bool privileged, goto error; /* Init domain events */ - qemu_driver->domainEventState = virDomainEventStateNew(); + qemu_driver->domainEventState = virObjectEventStateNew(); if (!qemu_driver->domainEventState) goto error; @@ -1015,7 +1015,7 @@ qemuStateCleanup(void) { ebtablesContextFree(qemu_driver->ebtables); /* Free domain callback list */ - virDomainEventStateFree(qemu_driver->domainEventState); + virObjectEventStateFree(qemu_driver->domainEventState); virLockManagerPluginUnref(qemu_driver->lockManager); @@ -9951,7 +9951,7 @@ qemuConnectDomainEventDeregisterAny(virConnectPtr conn, if (virConnectDomainEventDeregisterAnyEnsureACL(conn) < 0) goto cleanup; - if (virDomainEventStateDeregisterID(conn, + if (virObjectEventStateDeregisterID(conn, driver->domainEventState, callbackID) < 0) goto cleanup; diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index c43ce1d..e7c319e 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -92,7 +92,7 @@ struct private_data { char *hostname; /* Original hostname */ bool serverKeepAlive; /* Does server support keepalive protocol? */ - virDomainEventStatePtr domainEventState; + virObjectEventStatePtr domainEventState; }; enum { @@ -880,7 +880,7 @@ doRemoteOpen(virConnectPtr conn, goto failed; } - if (!(priv->domainEventState = virDomainEventStateNew())) + if (!(priv->domainEventState = virObjectEventStateNew())) goto failed; /* Successful. */ @@ -1085,7 +1085,7 @@ doRemoteClose(virConnectPtr conn, struct private_data *priv) /* See comment for remoteType. */ VIR_FREE(priv->type); - virDomainEventStateFree(priv->domainEventState); + virObjectEventStateFree(priv->domainEventState); priv->domainEventState = NULL; return ret; @@ -5122,7 +5122,7 @@ static int remoteConnectDomainEventRegisterAny(virConnectPtr conn, if (call(conn, priv, 0, REMOTE_PROC_CONNECT_DOMAIN_EVENT_REGISTER_ANY, (xdrproc_t) xdr_remote_connect_domain_event_register_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *)NULL) == -1) { - virDomainEventStateDeregisterID(conn, + virObjectEventStateDeregisterID(conn, priv->domainEventState, callbackID); goto done; @@ -5148,14 +5148,14 @@ static int remoteConnectDomainEventDeregisterAny(virConnectPtr conn, remoteDriverLock(priv); - if ((eventID = virDomainEventStateEventID(conn, + if ((eventID = virObjectEventStateEventID(conn, priv->domainEventState, callbackID)) < 0) { virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); goto done; } - if ((count = virDomainEventStateDeregisterID(conn, + if ((count = virObjectEventStateDeregisterID(conn, priv->domainEventState, callbackID)) < 0) { virReportError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); @@ -6692,7 +6692,7 @@ done: static void remoteDomainEventQueue(struct private_data *priv, virDomainEventPtr event) { - virDomainEventStateQueue(priv->domainEventState, event); + virObjectEventStateQueue(priv->domainEventState, event); } /* get_nonnull_domain and get_nonnull_network turn an on-wire diff --git a/src/test/test_driver.c b/src/test/test_driver.c index c1f1cd4..ba24f69 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -99,7 +99,7 @@ struct _testConn { int numCells; testCell cells[MAX_CELLS]; - virDomainEventStatePtr domainEventState; + virObjectEventStatePtr domainEventState; }; typedef struct _testConn testConn; typedef struct _testConn *testConnPtr; @@ -1444,7 +1444,7 @@ static virDrvOpenStatus testConnectOpen(virConnectPtr conn, privconn = conn->privateData; testDriverLock(privconn); - privconn->domainEventState = virDomainEventStateNew(); + privconn->domainEventState = virObjectEventStateNew(); if (!privconn->domainEventState) { testDriverUnlock(privconn); testConnectClose(conn); @@ -1467,7 +1467,7 @@ static int testConnectClose(virConnectPtr conn) virNetworkObjListFree(&privconn->networks); virInterfaceObjListFree(&privconn->ifaces); virStoragePoolObjListFree(&privconn->pools); - virDomainEventStateFree(privconn->domainEventState); + virObjectEventStateFree(privconn->domainEventState); VIR_FREE(privconn->path); testDriverUnlock(privconn); @@ -6018,7 +6018,7 @@ testConnectDomainEventDeregisterAny(virConnectPtr conn, int ret; testDriverLock(driver); - ret = virDomainEventStateDeregisterID(conn, + ret = virObjectEventStateDeregisterID(conn, driver->domainEventState, callbackID); testDriverUnlock(driver); @@ -6031,7 +6031,7 @@ testConnectDomainEventDeregisterAny(virConnectPtr conn, static void testDomainEventQueue(testConnPtr driver, virDomainEventPtr event) { - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); } static virDrvOpenStatus testSecretOpen(virConnectPtr conn, diff --git a/src/uml/uml_conf.h b/src/uml/uml_conf.h index 7f7ea05..c23a177 100644 --- a/src/uml/uml_conf.h +++ b/src/uml/uml_conf.h @@ -66,7 +66,7 @@ struct uml_driver { virDomainXMLOptionPtr xmlopt; /* Event handling */ - virDomainEventStatePtr domainEventState; + virObjectEventStatePtr domainEventState; /* Mapping of 'char *uuidstr' -> virConnectPtr * of guests which will be automatically killed diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 9ac896a..e9bc6d4 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -475,7 +475,7 @@ umlStateInitialize(bool privileged, if (!(uml_driver->domains = virDomainObjListNew())) goto error; - uml_driver->domainEventState = virDomainEventStateNew(); + uml_driver->domainEventState = virObjectEventStateNew(); if (!uml_driver->domainEventState) goto error; @@ -677,7 +677,7 @@ umlStateCleanup(void) { virObjectUnref(uml_driver->domains); - virDomainEventStateFree(uml_driver->domainEventState); + virObjectEventStateFree(uml_driver->domainEventState); VIR_FREE(uml_driver->logDir); VIR_FREE(uml_driver->configDir); @@ -2680,7 +2680,7 @@ umlConnectDomainEventDeregisterAny(virConnectPtr conn, return -1; umlDriverLock(driver); - ret = virDomainEventStateDeregisterID(conn, + ret = virObjectEventStateDeregisterID(conn, driver->domainEventState, callbackID); umlDriverUnlock(driver); @@ -2693,7 +2693,7 @@ umlConnectDomainEventDeregisterAny(virConnectPtr conn, static void umlDomainEventQueue(struct uml_driver *driver, virDomainEventPtr event) { - virDomainEventStateQueue(driver->domainEventState, event); + virObjectEventStateQueue(driver->domainEventState, event); } static int umlConnectListAllDomains(virConnectPtr conn, diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index 983a595..cfb2ca0 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -213,7 +213,7 @@ typedef struct { #else /* !(VBOX_API_VERSION == 2002) */ /* Async event handling */ - virDomainEventStatePtr domainEvents; + virObjectEventStatePtr domainEvents; int fdWatch; # if VBOX_API_VERSION <= 3002 @@ -990,7 +990,7 @@ static void vboxUninitialize(vboxGlobalData *data) { #if VBOX_API_VERSION == 2002 /* No domainEventCallbacks in 2.2.* version */ #else /* !(VBOX_API_VERSION == 2002) */ - virDomainEventStateFree(data->domainEvents); + virObjectEventStateFree(data->domainEvents); #endif /* !(VBOX_API_VERSION == 2002) */ VIR_FREE(data); } @@ -1055,7 +1055,7 @@ static virDrvOpenStatus vboxConnectOpen(virConnectPtr conn, #else /* !(VBOX_API_VERSION == 2002) */ - if (!(data->domainEvents = virDomainEventStateNew())) { + if (!(data->domainEvents = virObjectEventStateNew())) { vboxUninitialize(data); return VIR_DRV_OPEN_ERROR; } @@ -6988,7 +6988,7 @@ vboxCallbackOnMachineStateChange(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, ev = virDomainEventNewFromDom(dom, event, detail); if (ev) - virDomainEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); + virObjectEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); } } @@ -7092,7 +7092,7 @@ vboxCallbackOnMachineRegistered(IVirtualBoxCallback *pThis ATTRIBUTE_UNUSED, ev = virDomainEventNewFromDom(dom, event, detail); if (ev) - virDomainEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); + virObjectEventStateQueue(g_pVBoxGlobalData->domainEvents, ev); } } @@ -7317,7 +7317,7 @@ static int vboxConnectDomainEventRegister(virConnectPtr conn, ret = virDomainEventStateRegister(conn, data->domainEvents, callback, opaque, freecb); - VIR_DEBUG("virDomainEventStateRegister (ret = %d) (conn: %p, " + VIR_DEBUG("virObjectEventStateRegister (ret = %d) (conn: %p, " "callback: %p, opaque: %p, " "freecb: %p)", ret, conn, callback, opaque, freecb); @@ -7440,7 +7440,7 @@ static int vboxConnectDomainEventDeregisterAny(virConnectPtr conn, */ vboxDriverLock(data); - cnt = virDomainEventStateDeregisterID(conn, data->domainEvents, + cnt = virObjectEventStateDeregisterID(conn, data->domainEvents, callbackID); if (data->vboxCallback && cnt == 0) { diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 9ba1b10..82c1887 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -453,7 +453,7 @@ xenUnifiedConnectOpen(virConnectPtr conn, virConnectAuthPtr auth, unsigned int f return VIR_DRV_OPEN_ERROR; } - if (!(priv->domainEvents = virDomainEventStateNew())) { + if (!(priv->domainEvents = virObjectEventStateNew())) { virMutexDestroy(&priv->lock); VIR_FREE(priv); return VIR_DRV_OPEN_ERROR; @@ -551,7 +551,7 @@ xenUnifiedConnectClose(virConnectPtr conn) virObjectUnref(priv->caps); virObjectUnref(priv->xmlopt); - virDomainEventStateFree(priv->domainEvents); + virObjectEventStateFree(priv->domainEvents); #if WITH_XEN_INOTIFY if (priv->opened[XEN_UNIFIED_INOTIFY_OFFSET]) @@ -2409,7 +2409,7 @@ xenUnifiedConnectDomainEventDeregisterAny(virConnectPtr conn, return -1; } - ret = virDomainEventStateDeregisterID(conn, + ret = virObjectEventStateDeregisterID(conn, priv->domainEvents, callbackID); @@ -2951,7 +2951,7 @@ void xenUnifiedDomainEventDispatch(xenUnifiedPrivatePtr priv, if (!priv) return; - virDomainEventStateQueue(priv->domainEvents, event); + virObjectEventStateQueue(priv->domainEvents, event); } void xenUnifiedLock(xenUnifiedPrivatePtr priv) diff --git a/src/xen/xen_driver.h b/src/xen/xen_driver.h index a363161..a4b9149 100644 --- a/src/xen/xen_driver.h +++ b/src/xen/xen_driver.h @@ -159,7 +159,7 @@ struct _xenUnifiedPrivate { int nbNodeCells; int nbNodeCpus; - virDomainEventStatePtr domainEvents; + virObjectEventStatePtr domainEvents; /* Location of config files, either /etc * or /var/lib/xen */ diff --git a/tests/qemuhotplugtest.c b/tests/qemuhotplugtest.c index 961dfc6..8036adc 100644 --- a/tests/qemuhotplugtest.c +++ b/tests/qemuhotplugtest.c @@ -344,7 +344,7 @@ mymain(void) if (VIR_STRDUP_QUIET(driver.config->spicePassword, "123456") < 0) return EXIT_FAILURE; - if (!(driver.domainEventState = virDomainEventStateNew())) + if (!(driver.domainEventState = virObjectEventStateNew())) return EXIT_FAILURE; driver.lockManager = virLockManagerPluginNew("nop", "qemu", -- 1.8.4.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list