[libvirt] [PATCH v1 05/11] virstorageobj: Rename virStoragePoolObjAssignDef

Michal Privoznik posted 11 patches 5 years, 6 months ago
[libvirt] [PATCH v1 05/11] virstorageobj: Rename virStoragePoolObjAssignDef
Posted by Michal Privoznik 5 years, 6 months ago
This function is doing much more than plain assigning pool
definition to a pool object. Rename it.

Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
---
 src/conf/virstorageobj.c     | 12 ++++++------
 src/conf/virstorageobj.h     |  6 +++---
 src/libvirt_private.syms     |  2 +-
 src/storage/storage_driver.c |  4 ++--
 src/test/test_driver.c       |  6 +++---
 5 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 286f55fb0c..7f25931d05 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -1506,7 +1506,7 @@ virStoragePoolObjSourceFindDuplicate(virStoragePoolObjListPtr pools,
 
 
 /**
- * virStoragePoolObjAssignDef:
+ * virStoragePoolObjListAdd:
  * @pools: Storage Pool object list pointer
  * @def: Storage pool definition to add or update
  * @check_active: If true, ensure that pool is not active
@@ -1517,9 +1517,9 @@ virStoragePoolObjSourceFindDuplicate(virStoragePoolObjListPtr pools,
  * Returns locked and reffed object pointer or NULL on error
  */
 virStoragePoolObjPtr
-virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
-                           virStoragePoolDefPtr def,
-                           bool check_active)
+virStoragePoolObjListAdd(virStoragePoolObjListPtr pools,
+                         virStoragePoolDefPtr def,
+                         bool check_active)
 {
     virStoragePoolObjPtr obj = NULL;
     char uuidstr[VIR_UUID_STRING_BUFLEN];
@@ -1590,7 +1590,7 @@ virStoragePoolObjLoad(virStoragePoolObjListPtr pools,
         return NULL;
     }
 
-    if (!(obj = virStoragePoolObjAssignDef(pools, def, false)))
+    if (!(obj = virStoragePoolObjListAdd(pools, def, false)))
         return NULL;
     def = NULL;
 
@@ -1651,7 +1651,7 @@ virStoragePoolObjLoadState(virStoragePoolObjListPtr pools,
     }
 
     /* create the object */
-    if (!(obj = virStoragePoolObjAssignDef(pools, def, true)))
+    if (!(obj = virStoragePoolObjListAdd(pools, def, true)))
         goto cleanup;
     def = NULL;
 
diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h
index c41d4c16ad..090dd6a7e6 100644
--- a/src/conf/virstorageobj.h
+++ b/src/conf/virstorageobj.h
@@ -193,9 +193,9 @@ virStoragePoolObjVolumeListExport(virConnectPtr conn,
                                   virStoragePoolVolumeACLFilter filter);
 
 virStoragePoolObjPtr
-virStoragePoolObjAssignDef(virStoragePoolObjListPtr pools,
-                           virStoragePoolDefPtr def,
-                           bool check_active);
+virStoragePoolObjListAdd(virStoragePoolObjListPtr pools,
+                         virStoragePoolDefPtr def,
+                         bool check_active);
 
 int
 virStoragePoolObjSaveDef(virStorageDriverStatePtr driver,
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 909975750c..8fb366d218 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1178,7 +1178,6 @@ virSecretObjSetValueSize;
 
 # conf/virstorageobj.h
 virStoragePoolObjAddVol;
-virStoragePoolObjAssignDef;
 virStoragePoolObjClearVols;
 virStoragePoolObjDecrAsyncjobs;
 virStoragePoolObjDefUseNewDef;
@@ -1197,6 +1196,7 @@ virStoragePoolObjGetVolumesCount;
 virStoragePoolObjIncrAsyncjobs;
 virStoragePoolObjIsActive;
 virStoragePoolObjIsAutostart;
+virStoragePoolObjListAdd;
 virStoragePoolObjListExport;
 virStoragePoolObjListForEach;
 virStoragePoolObjListNew;
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 5d3ab1b25f..b4a56e54bb 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -743,7 +743,7 @@ storagePoolCreateXML(virConnectPtr conn,
     if ((backend = virStorageBackendForType(newDef->type)) == NULL)
         goto cleanup;
 
-    if (!(obj = virStoragePoolObjAssignDef(driver->pools, newDef, true)))
+    if (!(obj = virStoragePoolObjListAdd(driver->pools, newDef, true)))
         goto cleanup;
     newDef = NULL;
     def = virStoragePoolObjGetDef(obj);
@@ -818,7 +818,7 @@ storagePoolDefineXML(virConnectPtr conn,
     if (virStorageBackendForType(newDef->type) == NULL)
         goto cleanup;
 
-    if (!(obj = virStoragePoolObjAssignDef(driver->pools, newDef, false)))
+    if (!(obj = virStoragePoolObjListAdd(driver->pools, newDef, false)))
         goto cleanup;
     newDef = virStoragePoolObjGetNewDef(obj);
     def = virStoragePoolObjGetDef(obj);
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index a0f19f5c5c..832943c1fb 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -1095,7 +1095,7 @@ testParseStorage(testDriverPtr privconn,
         if (!def)
             return -1;
 
-        if (!(obj = virStoragePoolObjAssignDef(privconn->pools, def, false))) {
+        if (!(obj = virStoragePoolObjListAdd(privconn->pools, def, false))) {
             virStoragePoolDefFree(def);
             return -1;
         }
@@ -4581,7 +4581,7 @@ testStoragePoolCreateXML(virConnectPtr conn,
     if (!(newDef = virStoragePoolDefParseString(xml)))
         goto cleanup;
 
-    if (!(obj = virStoragePoolObjAssignDef(privconn->pools, newDef, true)))
+    if (!(obj = virStoragePoolObjListAdd(privconn->pools, newDef, true)))
         goto cleanup;
     newDef = NULL;
     def = virStoragePoolObjGetDef(obj);
@@ -4647,7 +4647,7 @@ testStoragePoolDefineXML(virConnectPtr conn,
     newDef->allocation = defaultPoolAlloc;
     newDef->available = defaultPoolCap - defaultPoolAlloc;
 
-    if (!(obj = virStoragePoolObjAssignDef(privconn->pools, newDef, false)))
+    if (!(obj = virStoragePoolObjListAdd(privconn->pools, newDef, false)))
         goto cleanup;
     newDef = NULL;
     def = virStoragePoolObjGetDef(obj);
-- 
2.21.0

--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list
Re: [libvirt] [PATCH v1 05/11] virstorageobj: Rename virStoragePoolObjAssignDef
Posted by Ján Tomko 5 years, 3 months ago
On Fri, May 24, 2019 at 04:35:41PM +0200, Michal Privoznik wrote:
>This function is doing much more than plain assigning pool
>definition to a pool object. Rename it.
>
>Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
>---
> src/conf/virstorageobj.c     | 12 ++++++------
> src/conf/virstorageobj.h     |  6 +++---
> src/libvirt_private.syms     |  2 +-
> src/storage/storage_driver.c |  4 ++--
> src/test/test_driver.c       |  6 +++---
> 5 files changed, 15 insertions(+), 15 deletions(-)
>

Reviewed-by: Ján Tomko <jtomko@redhat.com>

Jano
--
libvir-list mailing list
libvir-list@redhat.com
https://www.redhat.com/mailman/listinfo/libvir-list