--- src/conf/domain_event.c | 53 +++++++++++++++++++++++++++++++++++-------------- src/conf/domain_event.h | 4 ++-- 2 files changed, 40 insertions(+), 17 deletions(-) diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c index 07c8100..31699b1 100644 --- a/src/conf/domain_event.c +++ b/src/conf/domain_event.c @@ -81,9 +81,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; @@ -97,9 +99,6 @@ struct _virDomainEvent { union { struct { - long long offset; - } rtcChange; - struct { int action; } watchdog; struct { @@ -149,6 +148,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) { @@ -168,6 +174,12 @@ static int virObjectEventOnceInit(void) sizeof(virDomainEventLifecycle), virDomainEventLifecycleDispose))) return -1; + if (!(virDomainEventRTCChangeClass = virClassNew( + virDomainEventClass, + "virDomainEventRTCChange", + sizeof(virDomainEventRTCChange), + virDomainEventRTCChangeDispose))) + return -1; return 0; } @@ -257,6 +269,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 @@ -854,38 +872,38 @@ virDomainEventPtr virDomainEventRebootNewFromObj(virDomainObjPtr obj) obj->def->id, obj->def->name, obj->def->uuid); } -virDomainEventPtr virDomainEventRTCChangeNewFromDom(virDomainPtr dom, +void *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; } -virDomainEventPtr virDomainEventRTCChangeNewFromObj(virDomainObjPtr obj, +void *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; } @@ -1495,10 +1513,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, diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h index 2349b54..7c16a48 100644 --- a/src/conf/domain_event.h +++ b/src/conf/domain_event.h @@ -69,8 +69,8 @@ virDomainEventPtr virDomainEventRebootNew(int id, const char *name, const unsign virDomainEventPtr virDomainEventRebootNewFromDom(virDomainPtr dom); virDomainEventPtr virDomainEventRebootNewFromObj(virDomainObjPtr obj); -virDomainEventPtr virDomainEventRTCChangeNewFromDom(virDomainPtr dom, long long offset); -virDomainEventPtr virDomainEventRTCChangeNewFromObj(virDomainObjPtr obj, long long offset); +void *virDomainEventRTCChangeNewFromDom(virDomainPtr dom, long long offset); +void *virDomainEventRTCChangeNewFromObj(virDomainObjPtr obj, long long offset); virDomainEventPtr virDomainEventWatchdogNewFromDom(virDomainPtr dom, int action); virDomainEventPtr virDomainEventWatchdogNewFromObj(virDomainObjPtr obj, int action); -- 1.8.4.2 -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list