[libvirt] [PATCH 04/13] Add new internal domain events APIs for handling other event types

Daniel Veillard veillard at redhat.com
Mon Mar 22 14:42:52 UTC 2010


On Fri, Mar 19, 2010 at 03:38:52PM +0000, Daniel P. Berrange wrote:
> The current internal domain events API tracks callbacks based on
> the function pointer, and only supports lifecycle events. This
> adds new internal APIs for registering callbacks for other event
> types. These new APIs are postfixed with the word 'ID' to indicate
> that they operated based on event ID, instead of hardcoded to
> lifecycle events
> 
> * src/conf/domain_event.c, src/conf/domain_event.h,
>   src/libvirt_private.syms: Add new APIs for handling callbacks
>   for non-lifecycle events
> ---
>  src/conf/domain_event.c  |  169 ++++++++++++++++++++++++++++++++++++++++++---
>  src/conf/domain_event.h  |   28 +++++++-
>  src/libvirt_private.syms |    6 ++
>  3 files changed, 190 insertions(+), 13 deletions(-)
> 
> diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
[...]
> +no_memory:
> +    virReportOOMError();
> +
> +    if (event) {
> +        if (event->dom)
> +            VIR_FREE(event->dom->name);
> +        VIR_FREE(event->dom);
> +    }
> +    VIR_FREE(event);

  Probably worth having an event freeing routine of its own

[...]
> diff --git a/src/conf/domain_event.h b/src/conf/domain_event.h
> index 8658631..5578cd9 100644
> --- a/src/conf/domain_event.h
> +++ b/src/conf/domain_event.h
> @@ -46,24 +46,50 @@ int virDomainEventCallbackListAdd(virConnectPtr conn,
>                                    void *opaque,
>                                    virFreeCallback freecb)
>      ATTRIBUTE_NONNULL(1);
> +int virDomainEventCallbackListAddID(virConnectPtr conn,
> +                                    virDomainEventCallbackListPtr cbList,
> +                                    virDomainPtr dom,
> +                                    int eventID,
> +                                    virConnectDomainEventGenericCallback cb,
> +                                    void *opaque,
> +                                    virFreeCallback freecb)
> +    ATTRIBUTE_NONNULL(1);

  Hum, parameters 0 (conn), 4 (cb) could also be passed in NONNULL list
  I think


  ACK,

Daniel

-- 
Daniel Veillard      | libxml Gnome XML XSLT toolkit  http://xmlsoft.org/
daniel at veillard.com  | Rpmfind RPM search engine http://rpmfind.net/
http://veillard.com/ | virtualization library  http://libvirt.org/




More information about the libvir-list mailing list