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

[libvirt] [PATCH v3 06/16] util: Introduce virObjectLookupKeys*Active API's



Add a 'bool active' field to the virObjectLookupKeys object and then
virObjectLookupKeysIsActive and virObjectLookupKeysSetActive API's
to manage it.

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/libvirt_private.syms |  2 ++
 src/util/virobject.c     | 39 +++++++++++++++++++++++++++++++++++++++
 src/util/virobject.h     |  9 +++++++++
 3 files changed, 50 insertions(+)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index bfc68eb..6a87e6b 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -2287,7 +2287,9 @@ virObjectLock;
 virObjectLockableNew;
 virObjectLookupKeysGetName;
 virObjectLookupKeysGetUUID;
+virObjectLookupKeysIsActive;
 virObjectLookupKeysNew;
+virObjectLookupKeysSetActive;
 virObjectNew;
 virObjectRef;
 virObjectUnlock;
diff --git a/src/util/virobject.c b/src/util/virobject.c
index 862d46b..6e2b222 100644
--- a/src/util/virobject.c
+++ b/src/util/virobject.c
@@ -585,6 +585,45 @@ virObjectListFreeCount(void *list,
 
 
 /**
+ * virObjectLookupKeysIsActive
+ * @anyobj: Pointer to a locked LookupKeys object
+ *
+ * Returns: True if object is active, false if not
+ */
+bool
+virObjectLookupKeysIsActive(void *anyobj)
+{
+    virObjectLookupKeysPtr obj = virObjectGetLookupKeysObj(anyobj);
+
+    if (!obj)
+        return false;
+
+    return obj->active;
+}
+
+
+/**
+ * virObjectLookupKeysSetActive
+ * @anyobj: Pointer to a locked LookupKeys object
+ * @active: New active setting
+ *
+ * Set the lookup keys active bool value; value not changed if object
+ * is not a lookup keys object
+ */
+void
+virObjectLookupKeysSetActive(void *anyobj,
+                             bool active)
+{
+    virObjectLookupKeysPtr obj = virObjectGetLookupKeysObj(anyobj);
+
+    if (!obj)
+        return;
+
+    obj->active = active;
+}
+
+
+/**
  * virObjectLookupKeysGetUUID
  * @anyobj: Pointer to a LookupKeys object
  *
diff --git a/src/util/virobject.h b/src/util/virobject.h
index e77634b..9e0ecc1 100644
--- a/src/util/virobject.h
+++ b/src/util/virobject.h
@@ -67,6 +67,8 @@ struct _virObjectLookupKeys {
 
     char *uuid;
     char *name;
+
+    bool active;           /* true if object is active */
 };
 
 
@@ -140,6 +142,13 @@ void
 virObjectListFreeCount(void *list,
                        size_t count);
 
+bool
+virObjectLookupKeysIsActive(void *anyobj);
+
+void
+virObjectLookupKeysSetActive(void *anyobj,
+                             bool active);
+
 const char *
 virObjectLookupKeysGetUUID(void *anyobj);
 
-- 
2.9.4


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