On Mon, Mar 22, 2010 at 03:42:52PM +0100, Daniel Veillard wrote:
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
Parameter indexes start from '1', so this is checking 'conn' already.
I could add the callback arg too.
Daniel
--
|: Red Hat, Engineering, London -o-
http://people.redhat.com/berrange/ :|
|:
http://libvirt.org -o-
http://virt-manager.org -o-
http://deltacloud.org :|
|:
http://autobuild.org -o-
http://search.cpan.org/~danberr/ :|
|: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|