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

[libvirt] [PATCH 10/19] storage: Create accessor API's for virStoragePoolObj



In preparation for making a private object, create accessor API's for
consumer storage functions to use:

    virStoragePoolObjGetDef
    virStoragePoolObjGetNewDef
    virStoragePoolObjStealNewDef
    virStoragePoolObjGetConfigFile
    virStoragePoolObjSetConfigFile
    virStoragePoolObjIsActive
    virStoragePoolObjSetActive
    virStoragePoolObjGetAsyncjobs
    virStoragePoolObjIncrAsyncjobs
    virStoragePoolObjDecrAsyncjobs

Signed-off-by: John Ferlan <jferlan redhat com>
---
 src/conf/virstorageobj.c | 74 ++++++++++++++++++++++++++++++++++++++++++++++++
 src/conf/virstorageobj.h | 36 +++++++++++++++++++----
 src/libvirt_private.syms | 10 +++++++
 3 files changed, 115 insertions(+), 5 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 23346f3..7d6b311 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -37,6 +37,80 @@
 VIR_LOG_INIT("conf.virstorageobj");
 
 
+virStoragePoolDefPtr
+virStoragePoolObjGetDef(virStoragePoolObjPtr obj)
+{
+    return obj->def;
+}
+
+
+virStoragePoolDefPtr
+virStoragePoolObjGetNewDef(virStoragePoolObjPtr obj)
+{
+    return obj->newDef;
+}
+
+
+void
+virStoragePoolObjStealNewDef(virStoragePoolObjPtr obj)
+{
+    virStoragePoolDefFree(obj->def);
+    obj->def = obj->newDef;
+    obj->newDef = NULL;
+}
+
+
+char *
+virStoragePoolObjGetConfigFile(virStoragePoolObjPtr obj)
+{
+    return obj->configFile;
+}
+
+
+void
+virStoragePoolObjSetConfigFile(virStoragePoolObjPtr obj,
+                               char *configFile)
+{
+    obj->configFile = configFile;
+}
+
+
+bool
+virStoragePoolObjIsActive(virStoragePoolObjPtr obj)
+{
+    return obj->active;
+}
+
+
+void
+virStoragePoolObjSetActive(virStoragePoolObjPtr obj,
+                           bool active)
+{
+    obj->active = active;
+}
+
+
+unsigned int
+virStoragePoolObjGetAsyncjobs(virStoragePoolObjPtr obj)
+{
+    return obj->asyncjobs;
+}
+
+
+void
+virStoragePoolObjIncrAsyncjobs(virStoragePoolObjPtr obj)
+{
+    obj->asyncjobs++;
+}
+
+
+void
+virStoragePoolObjDecrAsyncjobs(virStoragePoolObjPtr obj)
+{
+    obj->asyncjobs--;
+}
+
+
 void
 virStoragePoolObjFree(virStoragePoolObjPtr obj)
 {
diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h
index 5a61b2a..d47b233 100644
--- a/src/conf/virstorageobj.h
+++ b/src/conf/virstorageobj.h
@@ -70,11 +70,37 @@ typedef bool
 (*virStoragePoolObjListFilter)(virConnectPtr conn,
                                virStoragePoolDefPtr def);
 
-static inline int
-virStoragePoolObjIsActive(virStoragePoolObjPtr obj)
-{
-    return obj->active;
-}
+virStoragePoolDefPtr
+virStoragePoolObjGetDef(virStoragePoolObjPtr obj);
+
+virStoragePoolDefPtr
+virStoragePoolObjGetNewDef(virStoragePoolObjPtr obj);
+
+void
+virStoragePoolObjStealNewDef(virStoragePoolObjPtr obj);
+
+char *
+virStoragePoolObjGetConfigFile(virStoragePoolObjPtr obj);
+
+void
+virStoragePoolObjSetConfigFile(virStoragePoolObjPtr obj,
+                               char *configFile);
+
+bool
+virStoragePoolObjIsActive(virStoragePoolObjPtr obj);
+
+void
+virStoragePoolObjSetActive(virStoragePoolObjPtr obj,
+                           bool active);
+
+unsigned int
+virStoragePoolObjGetAsyncjobs(virStoragePoolObjPtr obj);
+
+void
+virStoragePoolObjIncrAsyncjobs(virStoragePoolObjPtr obj);
+
+void
+virStoragePoolObjDecrAsyncjobs(virStoragePoolObjPtr obj);
 
 int
 virStoragePoolObjLoadAllConfigs(virStoragePoolObjListPtr pools,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 4cca0ca..edd3174 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1009,10 +1009,17 @@ virSecretObjSetValueSize;
 # conf/virstorageobj.h
 virStoragePoolObjAssignDef;
 virStoragePoolObjClearVols;
+virStoragePoolObjDecrAsyncjobs;
 virStoragePoolObjDeleteDef;
 virStoragePoolObjFindByName;
 virStoragePoolObjFindByUUID;
+virStoragePoolObjGetAsyncjobs;
+virStoragePoolObjGetConfigFile;
+virStoragePoolObjGetDef;
 virStoragePoolObjGetNames;
+virStoragePoolObjGetNewDef;
+virStoragePoolObjIncrAsyncjobs;
+virStoragePoolObjIsActive;
 virStoragePoolObjIsDuplicate;
 virStoragePoolObjListExport;
 virStoragePoolObjListFree;
@@ -1023,7 +1030,10 @@ virStoragePoolObjNumOfStoragePools;
 virStoragePoolObjNumOfVolumes;
 virStoragePoolObjRemove;
 virStoragePoolObjSaveDef;
+virStoragePoolObjSetActive;
+virStoragePoolObjSetConfigFile;
 virStoragePoolObjSourceFindDuplicate;
+virStoragePoolObjStealNewDef;
 virStoragePoolObjUnlock;
 virStoragePoolObjVolumeGetNames;
 virStoragePoolObjVolumeListExport;
-- 
2.9.3


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