[libvirt] [PATCH 3/8] domain_event: Add virDomainEventState structure
Eric Blake
eblake at redhat.com
Mon Jan 10 18:13:34 UTC 2011
On 01/10/2011 10:38 AM, Cole Robinson wrote:
> This structure will be used to unify lots of duplicated event handling code
> across the state drivers.
>
> Signed-off-by: Cole Robinson <crobinso at redhat.com>
> ---
> src/conf/domain_event.c | 91 ++++++++++++++++++++++++++++++++++++----------
> src/conf/domain_event.h | 47 +++++++++++++++++-------
> 2 files changed, 104 insertions(+), 34 deletions(-)
Missing a tweak to the list of free-like functions in cfg.mk for
virDomainEventStateFree.
> +void
> +virDomainEventStateFree(virDomainEventStatePtr state)
> +{
> + virDomainEventCallbackListFree(state->callbacks);
Missing an early exit for state==NULL, which is essential since
virDomainEventStateNew's error: block can hit that scenario.
> +
> +struct _virDomainEventState {
> + /* The list of domain event callbacks */
> + virDomainEventCallbackListPtr callbacks;
> + /* The queue of domain events */
> + virDomainEventQueuePtr queue;
> + /* Timer for flushing events queue */
> + int timer;
> + /* Flag if we're in process of dispatching */
> + int isDispatching;
s/int/bool/
> @@ -163,6 +177,11 @@ virDomainEventQueuePop(virDomainEventQueuePtr evtQueue);
>
> void virDomainEventFree(virDomainEventPtr event);
> void virDomainEventQueueFree(virDomainEventQueuePtr queue);
> +void virDomainEventStateFree(virDomainEventStatePtr state);
> +virDomainEventStatePtr
> +virDomainEventStateNew(virEventTimeoutCallback timeout_cb,
> + void *timeout_opaque,
> + virFreeCallback timeout_free);
ATTRIBUTE_NONNULL(1) (the other two can reasonably be NULL, though).
[Hmm, we probably are missing some other useful ATTRIBUTE_NONNULL
markups throughout the event-related headers]
--
Eric Blake eblake at redhat.com +1-801-349-2682
Libvirt virtualization library http://libvirt.org
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 619 bytes
Desc: OpenPGP digital signature
URL: <http://listman.redhat.com/archives/libvir-list/attachments/20110110/ea4bb78e/attachment-0001.sig>
More information about the libvir-list
mailing list