diff options
-rw-r--r-- | src/libxl/libxl_driver.c | 18 | ||||
-rw-r--r-- | src/lxc/lxc_driver.c | 18 | ||||
-rw-r--r-- | src/qemu/qemu_driver.c | 18 | ||||
-rw-r--r-- | src/remote/remote_driver.c | 62 | ||||
-rw-r--r-- | src/test/test_driver.c | 14 | ||||
-rw-r--r-- | src/uml/uml_driver.c | 18 | ||||
-rw-r--r-- | src/vbox/vbox_tmpl.c | 24 | ||||
-rw-r--r-- | src/xen/xen_driver.c | 10 |
8 files changed, 86 insertions, 96 deletions
diff --git a/src/libxl/libxl_driver.c b/src/libxl/libxl_driver.c index 46504dca8..b9382ee70 100644 --- a/src/libxl/libxl_driver.c +++ b/src/libxl/libxl_driver.c @@ -1115,8 +1115,8 @@ libxlClose(virConnectPtr conn ATTRIBUTE_UNUSED) libxlDriverPrivatePtr driver = conn->privateData; libxlDriverLock(driver); - virDomainEventCallbackListRemoveConn(conn, - driver->domainEventState->callbacks); + virDomainEventStateDeregisterConn(conn, + driver->domainEventState); libxlDriverUnlock(driver); conn->privateData = NULL; return 0; @@ -3404,9 +3404,9 @@ libxlDomainEventRegister(virConnectPtr conn, int ret; libxlDriverLock(driver); - ret = virDomainEventCallbackListAdd(conn, - driver->domainEventState->callbacks, - callback, opaque, freecb); + ret = virDomainEventStateRegister(conn, + driver->domainEventState, + callback, opaque, freecb); libxlDriverUnlock(driver); return ret; @@ -3851,10 +3851,10 @@ libxlDomainEventRegisterAny(virConnectPtr conn, virDomainPtr dom, int eventID, int ret; libxlDriverLock(driver); - if (virDomainEventCallbackListAddID(conn, - driver->domainEventState->callbacks, - dom, eventID, callback, opaque, - freecb, &ret) < 0) + if (virDomainEventStateRegisterID(conn, + driver->domainEventState, + dom, eventID, callback, opaque, + freecb, &ret) < 0) ret = -1; libxlDriverUnlock(driver); diff --git a/src/lxc/lxc_driver.c b/src/lxc/lxc_driver.c index 6b17c75be..6a9ebde82 100644 --- a/src/lxc/lxc_driver.c +++ b/src/lxc/lxc_driver.c @@ -179,8 +179,8 @@ static int lxcClose(virConnectPtr conn) lxc_driver_t *driver = conn->privateData; lxcDriverLock(driver); - virDomainEventCallbackListRemoveConn(conn, - driver->domainEventState->callbacks); + virDomainEventStateDeregisterConn(conn, + driver->domainEventState); lxcProcessAutoDestroyRun(driver, conn); lxcDriverUnlock(driver); @@ -2126,9 +2126,9 @@ lxcDomainEventRegister(virConnectPtr conn, int ret; lxcDriverLock(driver); - ret = virDomainEventCallbackListAdd(conn, - driver->domainEventState->callbacks, - callback, opaque, freecb); + ret = virDomainEventStateRegister(conn, + driver->domainEventState, + callback, opaque, freecb); lxcDriverUnlock(driver); return ret; @@ -2164,10 +2164,10 @@ lxcDomainEventRegisterAny(virConnectPtr conn, int ret; lxcDriverLock(driver); - if (virDomainEventCallbackListAddID(conn, - driver->domainEventState->callbacks, - dom, eventID, - callback, opaque, freecb, &ret) < 0) + if (virDomainEventStateRegisterID(conn, + driver->domainEventState, + dom, eventID, + callback, opaque, freecb, &ret) < 0) ret = -1; lxcDriverUnlock(driver); diff --git a/src/qemu/qemu_driver.c b/src/qemu/qemu_driver.c index 2b77c8c6b..662fd6d30 100644 --- a/src/qemu/qemu_driver.c +++ b/src/qemu/qemu_driver.c @@ -900,8 +900,8 @@ static int qemudClose(virConnectPtr conn) { /* Get rid of callbacks registered for this conn */ qemuDriverLock(driver); - virDomainEventCallbackListRemoveConn(conn, - driver->domainEventState->callbacks); + virDomainEventStateDeregisterConn(conn, + driver->domainEventState); qemuProcessAutoDestroyRun(driver, conn); qemuDriverUnlock(driver); @@ -7959,9 +7959,9 @@ qemuDomainEventRegister(virConnectPtr conn, int ret; qemuDriverLock(driver); - ret = virDomainEventCallbackListAdd(conn, - driver->domainEventState->callbacks, - callback, opaque, freecb); + ret = virDomainEventStateRegister(conn, + driver->domainEventState, + callback, opaque, freecb); qemuDriverUnlock(driver); return ret; @@ -7997,10 +7997,10 @@ qemuDomainEventRegisterAny(virConnectPtr conn, int ret; qemuDriverLock(driver); - if (virDomainEventCallbackListAddID(conn, - driver->domainEventState->callbacks, - dom, eventID, - callback, opaque, freecb, &ret) < 0) + if (virDomainEventStateRegisterID(conn, + driver->domainEventState, + dom, eventID, + callback, opaque, freecb, &ret) < 0) ret = -1; qemuDriverUnlock(driver); diff --git a/src/remote/remote_driver.c b/src/remote/remote_driver.c index a0cf7d356..84a371057 100644 --- a/src/remote/remote_driver.c +++ b/src/remote/remote_driver.c @@ -3124,13 +3124,8 @@ static int remoteDomainEventRegister(virConnectPtr conn, remoteDriverLock(priv); - if (priv->domainEventState->timer < 0) { - remoteError(VIR_ERR_NO_SUPPORT, "%s", _("no event support")); - goto done; - } - - if ((count = virDomainEventCallbackListAdd(conn, priv->domainEventState->callbacks, - callback, opaque, freecb)) < 0) { + if ((count = virDomainEventStateRegister(conn, priv->domainEventState, + callback, opaque, freecb)) < 0) { remoteError(VIR_ERR_RPC, "%s", _("adding cb to list")); goto done; } @@ -3155,17 +3150,16 @@ static int remoteDomainEventDeregister(virConnectPtr conn, { struct private_data *priv = conn->privateData; int rv = -1; + int count; remoteDriverLock(priv); - if (virDomainEventStateDeregister(conn, - priv->domainEventState, - callback) < 0) + if ((count = virDomainEventStateDeregister(conn, + priv->domainEventState, + callback)) < 0) goto done; - if (virDomainEventCallbackListCountID(conn, - priv->domainEventState->callbacks, - VIR_DOMAIN_EVENT_ID_LIFECYCLE) == 0) { + if (count == 0) { /* Tell the server when we are the last callback deregistering */ if (call (conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER, (xdrproc_t) xdr_void, (char *) NULL, @@ -3763,16 +3757,11 @@ static int remoteDomainEventRegisterAny(virConnectPtr conn, remoteDriverLock(priv); - if (priv->domainEventState->timer < 0) { - remoteError(VIR_ERR_NO_SUPPORT, "%s", _("no event support")); - goto done; - } - - if ((count = virDomainEventCallbackListAddID(conn, - priv->domainEventState->callbacks, - dom, eventID, - callback, opaque, freecb, - &callbackID)) < 0) { + if ((count = virDomainEventStateRegisterID(conn, + priv->domainEventState, + dom, eventID, + callback, opaque, freecb, + &callbackID)) < 0) { remoteError(VIR_ERR_RPC, "%s", _("adding cb to list")); goto done; } @@ -3785,9 +3774,9 @@ static int remoteDomainEventRegisterAny(virConnectPtr conn, if (call (conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_REGISTER_ANY, (xdrproc_t) xdr_remote_domain_events_register_any_args, (char *) &args, (xdrproc_t) xdr_void, (char *)NULL) == -1) { - virDomainEventCallbackListRemoveID(conn, - priv->domainEventState->callbacks, - callbackID); + virDomainEventStateDeregisterID(conn, + priv->domainEventState, + callbackID); goto done; } } @@ -3807,27 +3796,28 @@ static int remoteDomainEventDeregisterAny(virConnectPtr conn, int rv = -1; remote_domain_events_deregister_any_args args; int eventID; + int count; remoteDriverLock(priv); - if ((eventID = virDomainEventCallbackListEventID(conn, - priv->domainEventState->callbacks, - callbackID)) < 0) { + if ((eventID = virDomainEventStateEventID(conn, + priv->domainEventState, + callbackID)) < 0) { remoteError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); goto done; } - if (virDomainEventStateDeregisterID(conn, - priv->domainEventState, - callbackID) < 0) + if ((count = virDomainEventStateDeregisterID(conn, + priv->domainEventState, + callbackID)) < 0) { + remoteError(VIR_ERR_RPC, _("unable to find callback ID %d"), callbackID); goto done; + } /* If that was the last callback for this eventID, we need to disable * events on the server */ - if (virDomainEventCallbackListCountID(conn, - priv->domainEventState->callbacks, - eventID) == 0) { - args.eventID = eventID; + if (count == 0) { + args.eventID = callbackID; if (call (conn, priv, 0, REMOTE_PROC_DOMAIN_EVENTS_DEREGISTER_ANY, (xdrproc_t) xdr_remote_domain_events_deregister_any_args, (char *) &args, diff --git a/src/test/test_driver.c b/src/test/test_driver.c index 590ef3ebd..1c5bd8462 100644 --- a/src/test/test_driver.c +++ b/src/test/test_driver.c @@ -5404,9 +5404,9 @@ testDomainEventRegister(virConnectPtr conn, int ret; testDriverLock(driver); - ret = virDomainEventCallbackListAdd(conn, - driver->domainEventState->callbacks, - callback, opaque, freecb); + ret = virDomainEventStateRegister(conn, + driver->domainEventState, + callback, opaque, freecb); testDriverUnlock(driver); return ret; @@ -5442,10 +5442,10 @@ testDomainEventRegisterAny(virConnectPtr conn, int ret; testDriverLock(driver); - if (virDomainEventCallbackListAddID(conn, - driver->domainEventState->callbacks, - dom, eventID, - callback, opaque, freecb, &ret) < 0) + if (virDomainEventStateRegisterID(conn, + driver->domainEventState, + dom, eventID, + callback, opaque, freecb, &ret) < 0) ret = -1; testDriverUnlock(driver); diff --git a/src/uml/uml_driver.c b/src/uml/uml_driver.c index 420488d8b..4d875c8e3 100644 --- a/src/uml/uml_driver.c +++ b/src/uml/uml_driver.c @@ -1194,8 +1194,8 @@ static int umlClose(virConnectPtr conn) { struct uml_driver *driver = conn->privateData; umlDriverLock(driver); - virDomainEventCallbackListRemoveConn(conn, - driver->domainEventState->callbacks); + virDomainEventStateDeregisterConn(conn, + driver->domainEventState); umlProcessAutoDestroyRun(driver, conn); umlDriverUnlock(driver); @@ -2447,9 +2447,9 @@ umlDomainEventRegister(virConnectPtr conn, int ret; umlDriverLock(driver); - ret = virDomainEventCallbackListAdd(conn, - driver->domainEventState->callbacks, - callback, opaque, freecb); + ret = virDomainEventStateRegister(conn, + driver->domainEventState, + callback, opaque, freecb); umlDriverUnlock(driver); return ret; @@ -2483,10 +2483,10 @@ umlDomainEventRegisterAny(virConnectPtr conn, int ret; umlDriverLock(driver); - if (virDomainEventCallbackListAddID(conn, - driver->domainEventState->callbacks, - dom, eventID, - callback, opaque, freecb, &ret) < 0) + if (virDomainEventStateRegisterID(conn, + driver->domainEventState, + dom, eventID, + callback, opaque, freecb, &ret) < 0) ret = -1; umlDriverUnlock(driver); diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c index c4ae6b6fc..1c6456fc4 100644 --- a/src/vbox/vbox_tmpl.c +++ b/src/vbox/vbox_tmpl.c @@ -7188,12 +7188,12 @@ static int vboxDomainEventRegister (virConnectPtr conn, * later you can iterate over them */ - ret = virDomainEventCallbackListAdd(conn, data->domainEvents->callbacks, - callback, opaque, freecb); - VIR_DEBUG("virDomainEventCallbackListAdd (ret = %d) ( conn: %p, " - "data->domainEvents->callbacks: %p, callback: %p, opaque: %p, " - "freecb: %p )", ret, conn, data->domainEvents->callbacks, callback, - opaque, freecb); + ret = virDomainEventStateRegister(conn, data->domainEvents, + callback, opaque, freecb); + VIR_DEBUG("virDomainEventStateRegister (ret = %d) ( conn: %p, " + "callback: %p, opaque: %p, " + "freecb: %p )", ret, conn, callback, + opaque, freecb); } } @@ -7280,13 +7280,13 @@ static int vboxDomainEventRegisterAny(virConnectPtr conn, * later you can iterate over them */ - if (virDomainEventCallbackListAddID(conn, data->domainEvents->callbacks, - dom, eventID, - callback, opaque, freecb, &ret) < 0) + if (virDomainEventStateRegisterID(conn, data->domainEvents, + dom, eventID, + callback, opaque, freecb, &ret) < 0) ret = -1; - VIR_DEBUG("virDomainEventCallbackListAddID (ret = %d) ( conn: %p, " - "data->domainEvents->callbacks: %p, callback: %p, opaque: %p, " - "freecb: %p )", ret, conn, data->domainEvents->callbacks, callback, + VIR_DEBUG("virDomainEventStateRegisterID (ret = %d) ( conn: %p, " + "callback: %p, opaque: %p, " + "freecb: %p )", ret, conn, callback, opaque, freecb); } } diff --git a/src/xen/xen_driver.c b/src/xen/xen_driver.c index 57170c6a2..2fc0c2882 100644 --- a/src/xen/xen_driver.c +++ b/src/xen/xen_driver.c @@ -1847,8 +1847,8 @@ xenUnifiedDomainEventRegister(virConnectPtr conn, return -1; } - ret = virDomainEventCallbackListAdd(conn, priv->domainEvents->callbacks, - callback, opaque, freefunc); + ret = virDomainEventStateRegister(conn, priv->domainEvents, + callback, opaque, freefunc); xenUnifiedUnlock(priv); return (ret); @@ -1897,9 +1897,9 @@ xenUnifiedDomainEventRegisterAny(virConnectPtr conn, return -1; } - if (virDomainEventCallbackListAddID(conn, priv->domainEvents->callbacks, - dom, eventID, - callback, opaque, freefunc, &ret) < 0) + if (virDomainEventStateRegisterID(conn, priv->domainEvents, + dom, eventID, + callback, opaque, freefunc, &ret) < 0) ret = -1; xenUnifiedUnlock(priv); |