On Wed, Dec 11, 2013 at 11:38:02AM +0100, Cédric Bosdonnat wrote:
---
src/network/bridge_driver.c | 90 ++++++++++++++++++++++++++++++++++++
src/network/bridge_driver_platform.h | 3 ++
2 files changed, 93 insertions(+)
ACK
+static int
+networkConnectNetworkEventRegisterAny(virConnectPtr conn,
+ virNetworkPtr net,
+ int eventID,
+ virConnectNetworkEventGenericCallback callback,
+ void *opaque,
+ virFreeCallback freecb)
+{
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
+ int ret = -1;
+
+ networkDriverLock(driver);
+
+ if (virConnectNetworkEventRegisterAnyEnsureACL(conn) < 0)
+ goto cleanup;
+
+ if (virNetworkEventStateRegisterID(conn, driver->networkEventState,
+ net, eventID,
+ VIR_OBJECT_EVENT_CALLBACK(callback),
+ opaque, freecb, &ret) < 0)
+ ret = -1;
+
+ networkDriverUnlock(driver);
+
+cleanup:
+ return ret;
+}
Opps, locking is wrong - if the ACL check fails we leave the driver locked.
We can actually do without locking entirely, since the event state struct
is self-locking, so I'll remove the lock/unlock
+
+static int
+networkConnectNetworkEventDeregisterAny(virConnectPtr conn,
+ int callbackID)
+{
+ virNetworkDriverStatePtr driver = conn->networkPrivateData;
+ int ret = -1;
+
+ if (virConnectNetworkEventDeregisterAnyEnsureACL(conn) < 0)
+ goto cleanup;
+
+
+ networkDriverLock(driver);
+ ret = virObjectEventStateDeregisterID(conn,
+ driver->networkEventState,
+ callbackID);
+ networkDriverUnlock(driver);
+
+cleanup:
+ return ret;
+}
Daniel
--
|:
http://berrange.com -o-
http://www.flickr.com/photos/dberrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|:
http://entangle-photo.org -o-
http://live.gnome.org/gtk-vnc :|