On Thu, 2013-12-12 at 18:04 +0000, Daniel P. Berrange wrote: > From: "Daniel P. Berrange" <berrange@xxxxxxxxxx> > > Inject a virNetworkEvent class between virObjectEvent > and virNetworkEventLifecycle to mirror virDomainEvent. > > Signed-off-by: Daniel P. Berrange <berrange@xxxxxxxxxx> > --- > src/conf/network_event.c | 29 +++++++++++++++++++++++++++-- > 1 file changed, 27 insertions(+), 2 deletions(-) > > diff --git a/src/conf/network_event.c b/src/conf/network_event.c > index b885ced..b1312b7 100644 > --- a/src/conf/network_event.c > +++ b/src/conf/network_event.c > @@ -28,23 +28,40 @@ > #include "datatypes.h" > #include "virlog.h" > > -struct _virNetworkEventLifecycle { > +struct _virNetworkEvent { > virObjectEvent parent; > > + /* Unused attribute to get virNetworkEvent class being created */ > + bool dummy; > +}; > +typedef struct _virNetworkEvent virNetworkEvent; > +typedef virNetworkEvent *virNetworkEventPtr; > + > +struct _virNetworkEventLifecycle { > + virNetworkEvent parent; > + > int type; > int detail; > }; > typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle; > typedef virNetworkEventLifecycle *virNetworkEventLifecyclePtr; > > +static virClassPtr virNetworkEventClass; > static virClassPtr virNetworkEventLifecycleClass; > +static void virNetworkEventDispose(void *obj); > static void virNetworkEventLifecycleDispose(void *obj); > > static int > virNetworkEventsOnceInit(void) > { > - if (!(virNetworkEventLifecycleClass = > + if (!(virNetworkEventClass = > virClassNew(virClassForObjectEvent(), > + "virNetworkEvent", > + sizeof(virNetworkEvent), > + virNetworkEventDispose))) > + return -1; > + if (!(virNetworkEventLifecycleClass = > + virClassNew(virNetworkEventClass, > "virNetworkEventLifecycle", > sizeof(virNetworkEventLifecycle), > virNetworkEventLifecycleDispose))) > @@ -55,6 +72,14 @@ virNetworkEventsOnceInit(void) > VIR_ONCE_GLOBAL_INIT(virNetworkEvents) > > void > +virNetworkEventDispose(void *obj) > +{ > + virNetworkEventPtr event = obj; > + VIR_DEBUG("obj=%p", event); > +} > + > + > +void > virNetworkEventLifecycleDispose(void *obj) > { > virNetworkEventLifecyclePtr event = obj; ACK -- Cedric -- libvir-list mailing list libvir-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/libvir-list