Re: [PATCH 09/34] Create virDomainEventLifecycle to start removing the huge union

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Fri, 2013-11-29 at 17:09 +0000, Daniel P. Berrange wrote:
> On Fri, Nov 29, 2013 at 04:18:45PM +0100, Cédric Bosdonnat wrote:
> >
> >  static virClassPtr virObjectEventClass;
> >  static virClassPtr virDomainEventClass;
> > +static virClassPtr virDomainEventLifecycleClass;
> >  static void virObjectEventDispose(void *obj);
> >  static void virDomainEventDispose(void *obj);
> > +static void virDomainEventLifecycleDispose(void *obj);
> >  
> >  struct _virObjectEvent {
> >      virObject parent;
> 
> > @@ -764,37 +786,37 @@ static void *virDomainEventNewInternal(virClassPtr klass,
> >      return event;
> >  }
> >  
> > -virDomainEventPtr virDomainEventNew(int id, const char *name,
> > +void *virDomainEventNew(int id, const char *name,
> >                                      const unsigned char *uuid,
> >                                      int type, int detail)
> >  {
> > -    virDomainEventPtr event;
> > +    virDomainEventLifecyclePtr event;
> >  
> >      if (virObjectEventInitialize() < 0)
> >          return NULL;
> >  
> > -    if (!(event = virDomainEventNewInternal(virDomainEventClass,
> > -                                      VIR_DOMAIN_EVENT_ID_LIFECYCLE,
> > -                                      id, name, uuid)))
> > +    if (!(event = virDomainEventNewInternal(virDomainEventLifecycleClass,
> > +                                            VIR_DOMAIN_EVENT_ID_LIFECYCLE,
> > +                                            id, name, uuid)))
> >          return NULL;
> >  
> > -    event->data.lifecycle.type = type;
> > -    event->data.lifecycle.detail = detail;
> > +    event->type = type;
> > +    event->detail = detail;
> >  
> >      return event;
> >  }
> >  
> > -virDomainEventPtr virDomainEventNewFromDom(virDomainPtr dom, int type, int detail)
> > +void *virDomainEventNewFromDom(virDomainPtr dom, int type, int detail)
> >  {
> >      return virDomainEventNew(dom->id, dom->name, dom->uuid, type, detail);
> >  }
> >  
> > -virDomainEventPtr virDomainEventNewFromObj(virDomainObjPtr obj, int type, int detail)
> > +void *virDomainEventNewFromObj(virDomainObjPtr obj, int type, int detail)
> >  {
> >      return virDomainEventNewFromDef(obj->def, type, detail);
> >  }
> >  
> > -virDomainEventPtr virDomainEventNewFromDef(virDomainDefPtr def, int type, int detail)
> > +void *virDomainEventNewFromDef(virDomainDefPtr def, int type, int detail)
> 
> I think I'd prefer these to return 'virObjectEventPtr' rather than void *, 
> since that's the shared base class of all these event types

OK, I just won't change that in this commit (and the other similar ones)
as it would break builds. I'll change that later when changing from
virDomainEventPtr to virObjectPtr.

--
Cedric

--
libvir-list mailing list
libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list





[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]