On Fri, Nov 29, 2013 at 04:18:44PM +0100, Cédric Bosdonnat wrote:
Added a parent class virObjectEvent for future event types
---
cfg.mk | 2 -
src/conf/domain_event.c | 620 +++++++++++++++++++++++++++++++----------------
src/conf/domain_event.h | 5 +-
src/libvirt_private.syms | 1 -
src/qemu/qemu_driver.c | 2 +-
src/test/test_driver.c | 4 +-
6 files changed, 414 insertions(+), 220 deletions(-)
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index fa5c190..ff4f69a 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
+static void virDomainEventDispose(void *obj)
+{
+ virDomainEventPtr event = obj;
+
+ VIR_DEBUG("obj=%p", event);
+
+ if (!event)
+ return;
We guarantee that 'obj' != NULL for dispose handlers I believe.
+
+ switch (virObjectEventGetEventID(event)) {
+ case VIR_DOMAIN_EVENT_ID_IO_ERROR_REASON:
+ case VIR_DOMAIN_EVENT_ID_IO_ERROR:
+ VIR_FREE(event->data.ioError.srcPath);
+ VIR_FREE(event->data.ioError.devAlias);
+ VIR_FREE(event->data.ioError.reason);
+ break;
+
+ case VIR_DOMAIN_EVENT_ID_GRAPHICS:
+ if (event->data.graphics.local) {
+ VIR_FREE(event->data.graphics.local->node);
+ VIR_FREE(event->data.graphics.local->service);
+ VIR_FREE(event->data.graphics.local);
+ }
+ if (event->data.graphics.remote) {
+ VIR_FREE(event->data.graphics.remote->node);
+ VIR_FREE(event->data.graphics.remote->service);
+ VIR_FREE(event->data.graphics.remote);
+ }
+ VIR_FREE(event->data.graphics.authScheme);
+ if (event->data.graphics.subject) {
+ size_t i;
+ for (i = 0; i < event->data.graphics.subject->nidentity; i++) {
+ VIR_FREE(event->data.graphics.subject->identities[i].type);
+ VIR_FREE(event->data.graphics.subject->identities[i].name);
+ }
+ VIR_FREE(event->data.graphics.subject);
+ }
+ break;
+
+ case VIR_DOMAIN_EVENT_ID_BLOCK_JOB:
+ VIR_FREE(event->data.blockJob.path);
+ break;
+
+ case VIR_DOMAIN_EVENT_ID_DISK_CHANGE:
+ VIR_FREE(event->data.diskChange.oldSrcPath);
+ VIR_FREE(event->data.diskChange.newSrcPath);
+ VIR_FREE(event->data.diskChange.devAlias);
+ break;
+ case VIR_DOMAIN_EVENT_ID_TRAY_CHANGE:
+ VIR_FREE(event->data.trayChange.devAlias);
+ break;
+ case VIR_DOMAIN_EVENT_ID_DEVICE_REMOVED:
+ VIR_FREE(event->data.deviceRemoved.devAlias);
+ break;
+ }
+
+ VIR_FREE(event->meta.name);
+}
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 :|