--- src/conf/domain_event.c | 53 +++++++++++++++++++++++++++++++++++-------------- 1 file changed, 38 insertions(+), 15 deletions(-) diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index 23d4965..ab38a3b 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -86,9 +86,11 @@ struct _virObjectEventCallback { static virClassPtr virObjectEventClass; static virClassPtr virDomainEventClass; static virClassPtr virDomainEventLifecycleClass; +static virClassPtr virDomainEventRTCChangeClass; static void virObjectEventDispose(void *obj); static void virDomainEventDispose(void *obj); static void virDomainEventLifecycleDispose(void *obj); +static void virDomainEventRTCChangeDispose(void *obj); struct _virObjectEvent { virObject parent; @@ -102,9 +104,6 @@ struct _virDomainEvent { union { struct { - long long offset; - } rtcChange; - struct { int action; } watchdog; struct { @@ -154,6 +153,13 @@ struct _virDomainEventLifecycle { typedef struct _virDomainEventLifecycle virDomainEventLifecycle; typedef virDomainEventLifecycle *virDomainEventLifecyclePtr; +struct _virDomainEventRTCChange { + virDomainEvent parent; + + long long offset; +}; +typedef struct _virDomainEventRTCChange virDomainEventRTCChange; +typedef virDomainEventRTCChange *virDomainEventRTCChangePtr; static int virObjectEventOnceInit(void) { @@ -173,6 +179,12 @@ static int virObjectEventOnceInit(void) sizeof(virDomainEventLifecycle), virDomainEventLifecycleDispose))) return -1; + if (!(virDomainEventRTCChangeClass = virClassNew( + virDomainEventClass, + "virDomainEventRTCChange", + sizeof(virDomainEventRTCChange), + virDomainEventRTCChangeDispose))) + return -1; return 0; } @@ -259,6 +271,12 @@ static void virDomainEventLifecycleDispose(void *obj) VIR_DEBUG("obj=%p", event); } +static void virDomainEventRTCChangeDispose(void *obj) +{ + virDomainEventRTCChangePtr event = obj; + VIR_DEBUG("obj=%p", event); +} + /** * virObjectEventCallbackListFree: * @list: event callback list head @@ -859,37 +877,37 @@ virDomainEventPtr virDomainEventRebootNewFromObj(virDomainObjPtr obj) virDomainEventPtr virDomainEventRTCChangeNewFromDom(virDomainPtr dom, long long offset) { - virDomainEventPtr ev; + virDomainEventRTCChangePtr ev; if (virObjectEventInitialize() < 0) return NULL; - if (!(ev = virDomainEventNew(virDomainEventClass, + if (!(ev = virDomainEventNew(virDomainEventRTCChangeClass, VIR_DOMAIN_EVENT_ID_RTC_CHANGE, dom->id, dom->name, dom->uuid))) return NULL; - ev->data.rtcChange.offset = offset; + ev->offset = offset; - return ev; + return (virDomainEventPtr)ev; } virDomainEventPtr virDomainEventRTCChangeNewFromObj(virDomainObjPtr obj, long long offset) { - virDomainEventPtr ev; + virDomainEventRTCChangePtr ev; if (virObjectEventInitialize() < 0) return NULL; - if (!(ev = virDomainEventNew(virDomainEventClass, + if (!(ev = virDomainEventNew(virDomainEventRTCChangeClass, VIR_DOMAIN_EVENT_ID_RTC_CHANGE, obj->def->id, obj->def->name, obj->def->uuid))) return NULL; - ev->data.rtcChange.offset = offset; + ev->offset = offset; - return ev; + return (virDomainEventPtr)ev; } virDomainEventPtr virDomainEventWatchdogNewFromDom(virDomainPtr dom, @@ -1497,10 +1515,15 @@ virDomainEventDispatchDefaultFunc(virConnectPtr conn, goto cleanup; case VIR_DOMAIN_EVENT_ID_RTC_CHANGE: - ((virConnectDomainEventRTCChangeCallback)cb)(conn, dom, - event->data.rtcChange.offset, - cbopaque); - goto cleanup; + { + virDomainEventRTCChangePtr rtcChangeEvent; + + rtcChangeEvent = (virDomainEventRTCChangePtr)event; + ((virConnectDomainEventRTCChangeCallback)cb)(conn, dom, + rtcChangeEvent->offset, + cbopaque); + goto cleanup; + } case VIR_DOMAIN_EVENT_ID_WATCHDOG: ((virConnectDomainEventWatchdogCallback)cb)(conn, dom, -- 1.8.4.4 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list