[PATCH 27/34] Added virNetworkEventLifecycle object

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

 



This object is still unused, but not for long.
---
 src/conf/object_event.c  | 43 ++++++++++++++++++++++++++++++++++++++++++-
 src/conf/object_event.h  |  4 ++++
 src/libvirt_private.syms |  1 +
 3 files changed, 47 insertions(+), 1 deletion(-)

diff --git a/src/conf/object_event.c b/src/conf/object_event.c
index e6cebec..c6538c0 100644
--- a/src/conf/object_event.c
+++ b/src/conf/object_event.c
@@ -35,9 +35,18 @@
 
 #define VIR_FROM_THIS VIR_FROM_NONE
 
-static virClassPtr virObjectEventClass;
+struct _virNetworkEventLifecycle {
+    virObjectEvent parent;
+
+    int type;
+};
+typedef struct _virNetworkEventLifecycle virNetworkEventLifecycle;
+typedef virNetworkEventLifecycle *virNetworkEventLifecyclePtr;
 
+static virClassPtr virObjectEventClass;
+static virClassPtr virNetworkEventLifecycleClass;
 static void virObjectEventDispose(void *obj);
+static void virNetworkEventLifecycleDispose(void *obj);
 
 static int virObjectEventOnceInit(void)
 {
@@ -46,6 +55,12 @@ static int virObjectEventOnceInit(void)
                                              sizeof(virObjectEvent),
                                              virObjectEventDispose)))
         return -1;
+    if (!(virNetworkEventLifecycleClass = virClassNew(
+                                             virObjectEventClass,
+                                             "virNetworkEventLifecycle",
+                                             sizeof(virNetworkEventLifecycle),
+                                             virNetworkEventLifecycleDispose)))
+        return -1;
     return 0;
 }
 
@@ -79,6 +94,12 @@ static void virObjectEventDispose(void *obj)
     VIR_FREE(event->meta.name);
 }
 
+void virNetworkEventLifecycleDispose(void *obj)
+{
+    virNetworkEventLifecyclePtr event = obj;
+    VIR_DEBUG("obj=%p", event);
+}
+
 /**
  * virObjectEventCallbackListFree:
  * @list: event callback list head
@@ -784,3 +805,23 @@ virObjectEventStateEventID(virConnectPtr conn,
     virObjectEventStateUnlock(state);
     return ret;
 }
+
+void *virNetworkEventLifecycleNew(int id, const char *name,
+                                  const unsigned char *uuid,
+                                  int type)
+{
+    virNetworkEventLifecyclePtr event;
+    int eventId = (VIR_EVENT_NAMESPACE_NETWORK << 8) + VIR_NETWORK_EVENT_ID_LIFECYCLE;
+
+    if (virObjectEventInitialize() < 0)
+        return NULL;
+
+    if (!(event = virObjectEventNew(virNetworkEventLifecycleClass,
+                                    eventId,
+                                    id, name, uuid)))
+        return NULL;
+
+    event->type = type;
+
+    return event;
+}
diff --git a/src/conf/object_event.h b/src/conf/object_event.h
index 8081cea..3fdd8c5 100644
--- a/src/conf/object_event.h
+++ b/src/conf/object_event.h
@@ -93,4 +93,8 @@ virObjectEventStateEventID(virConnectPtr conn,
                            int callbackID)
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
+void *virNetworkEventLifecycleNew(int id,
+                                 const char *name,
+                                 const unsigned char *uuid,
+                                 int type);
 #endif
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index b511c8a..6977324 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -621,6 +621,7 @@ virNWFilterVarValueGetSimple;
 
 
 # conf/object_event.h
+virNetworkEventLifecycleNew;
 virObjectEventStateDeregisterID;
 virObjectEventStateEventID;
 virObjectEventStateFree;
-- 
1.8.4.2

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