提交 f8824160 编写于 作者: C Cédric Bosdonnat 提交者: Daniel P. Berrange

Split the virObjectEvent and virDomainEvent* to separate them after

上级 d397bf2f
......@@ -84,6 +84,8 @@ struct _virObjectEventCallback {
static virClassPtr virObjectEventClass;
static virClassPtr virClassForObjectEvent(void);
static virClassPtr virDomainEventClass;
static virClassPtr virDomainEventLifecycleClass;
static virClassPtr virDomainEventRTCChangeClass;
......@@ -228,8 +230,22 @@ static int virObjectEventOnceInit(void)
sizeof(virObjectEvent),
virObjectEventDispose)))
return -1;
return 0;
}
VIR_ONCE_GLOBAL_INIT(virObjectEvent)
virClassPtr virClassForObjectEvent(void)
{
if (virObjectEventInitialize() < 0)
return NULL;
return virObjectEventClass;
}
static int virDomainEventsOnceInit(void)
{
if (!(virDomainEventClass =
virClassNew(virObjectEventClass,
virClassNew(virClassForObjectEvent(),
"virDomainEvent",
sizeof(virDomainEvent),
virDomainEventDispose)))
......@@ -297,13 +313,13 @@ static int virObjectEventOnceInit(void)
return 0;
}
VIR_ONCE_GLOBAL_INIT(virObjectEvent)
VIR_ONCE_GLOBAL_INIT(virDomainEvents)
static int virObjectEventGetEventID(void *anyobj)
{
virObjectEventPtr obj = anyobj;
if (!virObjectIsClass(obj, virObjectEventClass)) {
if (!virObjectIsClass(obj, virClassForObjectEvent())) {
VIR_WARN("Object %p (%s) is not a virObjectEvent instance",
obj, obj ? virClassName(obj->parent.klass) : "(unknown)");
return -1;
......@@ -960,7 +976,7 @@ virObjectEventPtr virDomainEventLifecycleNew(int id, const char *name,
{
virDomainEventLifecyclePtr event;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(event = virDomainEventNew(virDomainEventLifecycleClass,
......@@ -994,7 +1010,7 @@ virObjectEventPtr virDomainEventLifecycleNewFromDef(virDomainDefPtr def, int typ
virObjectEventPtr virDomainEventRebootNew(int id, const char *name,
const unsigned char *uuid)
{
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
return virDomainEventNew(virDomainEventClass,
......@@ -1004,7 +1020,7 @@ virObjectEventPtr virDomainEventRebootNew(int id, const char *name,
virObjectEventPtr virDomainEventRebootNewFromDom(virDomainPtr dom)
{
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
return virDomainEventNew(virDomainEventClass,
......@@ -1014,7 +1030,7 @@ virObjectEventPtr virDomainEventRebootNewFromDom(virDomainPtr dom)
virObjectEventPtr virDomainEventRebootNewFromObj(virDomainObjPtr obj)
{
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
return virDomainEventNew(virDomainEventClass,
......@@ -1027,7 +1043,7 @@ virObjectEventPtr virDomainEventRTCChangeNewFromDom(virDomainPtr dom,
{
virDomainEventRTCChangePtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventRTCChangeClass,
......@@ -1044,7 +1060,7 @@ virObjectEventPtr virDomainEventRTCChangeNewFromObj(virDomainObjPtr obj,
{
virDomainEventRTCChangePtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventRTCChangeClass,
......@@ -1062,7 +1078,7 @@ virObjectEventPtr virDomainEventWatchdogNewFromDom(virDomainPtr dom, int action)
{
virDomainEventWatchdogPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventWatchdogClass,
......@@ -1078,7 +1094,7 @@ virObjectEventPtr virDomainEventWatchdogNewFromObj(virDomainObjPtr obj, int acti
{
virDomainEventWatchdogPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventWatchdogClass,
......@@ -1101,7 +1117,7 @@ static virObjectEventPtr virDomainEventIOErrorNewFromDomImpl(int event,
{
virDomainEventIOErrorPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventIOErrorClass, event,
......@@ -1128,7 +1144,7 @@ static virObjectEventPtr virDomainEventIOErrorNewFromObjImpl(int event,
{
virDomainEventIOErrorPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventIOErrorClass, event,
......@@ -1199,7 +1215,7 @@ virObjectEventPtr virDomainEventGraphicsNewFromDom(virDomainPtr dom,
{
virDomainEventGraphicsPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventGraphicsClass,
......@@ -1228,7 +1244,7 @@ virObjectEventPtr virDomainEventGraphicsNewFromObj(virDomainObjPtr obj,
{
virDomainEventGraphicsPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventGraphicsClass,
......@@ -1259,7 +1275,7 @@ virObjectEventPtr virDomainEventBlockJobNew(int id,
{
virDomainEventBlockJobPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventBlockJobClass,
......@@ -1299,7 +1315,7 @@ virObjectEventPtr virDomainEventControlErrorNewFromDom(virDomainPtr dom)
{
virObjectEventPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventClass,
......@@ -1314,7 +1330,7 @@ virObjectEventPtr virDomainEventControlErrorNewFromObj(virDomainObjPtr obj)
{
virObjectEventPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventClass,
......@@ -1334,7 +1350,7 @@ virObjectEventPtr virDomainEventDiskChangeNew(int id, const char *name,
{
virDomainEventDiskChangePtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventDiskChangeClass,
......@@ -1390,7 +1406,7 @@ virDomainEventTrayChangeNew(int id, const char *name,
{
virDomainEventTrayChangePtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventTrayChangeClass,
......@@ -1435,7 +1451,7 @@ virDomainEventPMWakeupNew(int id, const char *name,
{
virObjectEventPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventClass,
......@@ -1466,7 +1482,7 @@ virDomainEventPMSuspendNew(int id, const char *name,
{
virObjectEventPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventClass,
......@@ -1497,7 +1513,7 @@ virDomainEventPMSuspendDiskNew(int id, const char *name,
{
virObjectEventPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventClass,
......@@ -1526,7 +1542,7 @@ virObjectEventPtr virDomainEventBalloonChangeNewFromDom(virDomainPtr dom,
{
virDomainEventBalloonChangePtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventBalloonChangeClass,
......@@ -1543,7 +1559,7 @@ virObjectEventPtr virDomainEventBalloonChangeNewFromObj(virDomainObjPtr obj,
{
virDomainEventBalloonChangePtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventBalloonChangeClass,
......@@ -1563,7 +1579,7 @@ static virObjectEventPtr virDomainEventDeviceRemovedNew(int id,
{
virDomainEventDeviceRemovedPtr ev;
if (virObjectEventInitialize() < 0)
if (virDomainEventsInitialize() < 0)
return NULL;
if (!(ev = virDomainEventNew(virDomainEventDeviceRemovedClass,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册