On 12/02/2013 09:39 AM, Cédric Bosdonnat wrote:
Each unique event ID will thus be composed by 1 byte for the
namespace
and 1 byte for a namespace-specific ID. The namespace for domain event
needs to be 0 for compatibility reasons.
---
src/conf/domain_event.c | 10 ++++++++--
src/conf/domain_event.h | 8 ++++++++
2 files changed, 16 insertions(+), 2 deletions(-)
More things to look for in a followup patch that adjusts indentation,
and a question.
diff --git a/src/conf/domain_event.c b/src/conf/domain_event.c
index 3c14cec..8462754 100644
--- a/src/conf/domain_event.c
+++ b/src/conf/domain_event.c
@@ -1910,11 +1910,17 @@ virObjectEventStateDispatchFunc(virConnectPtr conn,
void *opaque)
{
virObjectEventStatePtr state = opaque;
+ virEventNamespaceID namespace = (event->eventID & 0xFF00) >> 8;
/* Drop the lock whle dispatching, for sake of re-entrancy */
virObjectEventStateUnlock(state);
- virDomainEventDispatchDefaultFunc(conn, event,
- VIR_DOMAIN_EVENT_CALLBACK(cb), cbopaque, NULL);
+ switch (namespace)
+ {
Indentation: { belongs on the same line as switch.
+ case VIR_EVENT_NAMESPACE_DOMAIN:
Indentation - most code aligns the 'case' to be flush with 'switch'
rather than 4 spaces in.
+ virDomainEventDispatchDefaultFunc(conn, event,
+ VIR_DOMAIN_EVENT_CALLBACK(cb), cbopaque, NULL);
Indentation: this is typically written:
virDomainEventDispatchDefaultFunc(conn, event,
VIR_DOMAIN_EVENT_CALLBACK(cb),
cbopaque, NULL);
+ break;
+ }
This switch statement falls through with no action on unknown
namespaces. Are event ids always internal, such that hitting the
default case implies programmer error? If so, should we add a default:
label that does a VIR_ERROR to warn us in the logs of our mistake?
--
Eric Blake eblake redhat com +1-919-301-3266
Libvirt virtualization library
http://libvirt.org