Re: [PATCH 4/6] Introduce abstract virNetworkEvent class

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

 



On 11.12.2013 16:28, 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;
> 

This patch alone wouldn't make much sense. But in the light of the very
next patch it's more than desired.

ACK

Michal

--
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]