[PATCH 09/19] storage: Alter volume num, name, and export API's to just take obj

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

 



Alter the virStoragePoolObjNumOfVolumes, virStoragePoolObjVolumeGetNames,
and virStoragePoolObjVolumeListExport APIs to take a virStoragePoolObjPtr
instead of the &obj->volumes and obj->def.

Signed-off-by: John Ferlan <jferlan@xxxxxxxxxx>
---
 src/conf/virstorageobj.c     | 15 +++++++++------
 src/conf/virstorageobj.h     |  9 +++------
 src/storage/storage_driver.c |  7 +++----
 src/test/test_driver.c       |  9 +++------
 4 files changed, 18 insertions(+), 22 deletions(-)

diff --git a/src/conf/virstorageobj.c b/src/conf/virstorageobj.c
index 74a9c67..23346f3 100644
--- a/src/conf/virstorageobj.c
+++ b/src/conf/virstorageobj.c
@@ -196,11 +196,12 @@ virStorageVolDefFindByName(virStoragePoolObjPtr obj,
 
 
 int
-virStoragePoolObjNumOfVolumes(virStorageVolDefListPtr volumes,
+virStoragePoolObjNumOfVolumes(virStoragePoolObjPtr obj,
                               virConnectPtr conn,
-                              virStoragePoolDefPtr pooldef,
                               virStoragePoolVolumeACLFilter aclfilter)
 {
+    virStoragePoolDefPtr pooldef = obj->def;
+    virStorageVolDefListPtr volumes = &obj->volumes;
     int nvolumes = 0;
     size_t i;
 
@@ -216,13 +217,14 @@ virStoragePoolObjNumOfVolumes(virStorageVolDefListPtr volumes,
 
 
 int
-virStoragePoolObjVolumeGetNames(virStorageVolDefListPtr volumes,
+virStoragePoolObjVolumeGetNames(virStoragePoolObjPtr obj,
                                 virConnectPtr conn,
-                                virStoragePoolDefPtr pooldef,
                                 virStoragePoolVolumeACLFilter aclfilter,
                                 char **const names,
                                 int maxnames)
 {
+    virStoragePoolDefPtr pooldef = obj->def;
+    virStorageVolDefListPtr volumes = &obj->volumes;
     int nnames = 0;
     size_t i;
 
@@ -247,11 +249,12 @@ virStoragePoolObjVolumeGetNames(virStorageVolDefListPtr volumes,
 
 int
 virStoragePoolObjVolumeListExport(virConnectPtr conn,
-                                  virStorageVolDefListPtr volumes,
-                                  virStoragePoolDefPtr pooldef,
+                                  virStoragePoolObjPtr obj,
                                   virStorageVolPtr **vols,
                                   virStoragePoolVolumeACLFilter aclfilter)
 {
+    virStoragePoolDefPtr pooldef = obj->def;
+    virStorageVolDefListPtr volumes = &obj->volumes;
     int ret = -1;
     size_t i;
     virStorageVolPtr *tmp_vols = NULL;
diff --git a/src/conf/virstorageobj.h b/src/conf/virstorageobj.h
index 494b888..5a61b2a 100644
--- a/src/conf/virstorageobj.h
+++ b/src/conf/virstorageobj.h
@@ -114,23 +114,20 @@ typedef bool
                                  virStorageVolDefPtr def);
 
 int
-virStoragePoolObjNumOfVolumes(virStorageVolDefListPtr volumes,
+virStoragePoolObjNumOfVolumes(virStoragePoolObjPtr obj,
                               virConnectPtr conn,
-                              virStoragePoolDefPtr pooldef,
                               virStoragePoolVolumeACLFilter aclfilter);
 
 int
-virStoragePoolObjVolumeGetNames(virStorageVolDefListPtr volumes,
+virStoragePoolObjVolumeGetNames(virStoragePoolObjPtr obj,
                                 virConnectPtr conn,
-                                virStoragePoolDefPtr pooldef,
                                 virStoragePoolVolumeACLFilter aclfilter,
                                 char **const names,
                                 int maxnames);
 
 int
 virStoragePoolObjVolumeListExport(virConnectPtr conn,
-                                  virStorageVolDefListPtr volumes,
-                                  virStoragePoolDefPtr pooldef,
+                                  virStoragePoolObjPtr obj,
                                   virStorageVolPtr **vols,
                                   virStoragePoolVolumeACLFilter aclfilter);
 
diff --git a/src/storage/storage_driver.c b/src/storage/storage_driver.c
index 6122396..6289314 100644
--- a/src/storage/storage_driver.c
+++ b/src/storage/storage_driver.c
@@ -1339,7 +1339,7 @@ storagePoolNumOfVolumes(virStoragePoolPtr pool)
         goto cleanup;
     }
 
-    ret = virStoragePoolObjNumOfVolumes(&obj->volumes, pool->conn, obj->def,
+    ret = virStoragePoolObjNumOfVolumes(obj, pool->conn,
                                         virStoragePoolNumOfVolumesCheckACL);
 
  cleanup:
@@ -1368,7 +1368,7 @@ storagePoolListVolumes(virStoragePoolPtr pool,
         goto cleanup;
     }
 
-    n = virStoragePoolObjVolumeGetNames(&obj->volumes, pool->conn, obj->def,
+    n = virStoragePoolObjVolumeGetNames(obj, pool->conn,
                                         virStoragePoolListVolumesCheckACL,
                                         names, maxnames);
  cleanup:
@@ -1399,8 +1399,7 @@ storagePoolListAllVolumes(virStoragePoolPtr pool,
         goto cleanup;
     }
 
-    ret = virStoragePoolObjVolumeListExport(pool->conn, &obj->volumes,
-                                            obj->def, vols,
+    ret = virStoragePoolObjVolumeListExport(pool->conn, obj, vols,
                                             virStoragePoolListAllVolumesCheckACL);
 
 
diff --git a/src/test/test_driver.c b/src/test/test_driver.c
index 8d03bdb..68f1412 100644
--- a/src/test/test_driver.c
+++ b/src/test/test_driver.c
@@ -4738,8 +4738,7 @@ testStoragePoolNumOfVolumes(virStoragePoolPtr pool)
     if (!(obj = testStoragePoolObjFindActiveByName(privconn, pool->name)))
         return -1;
 
-    ret = virStoragePoolObjNumOfVolumes(&obj->volumes, pool->conn,
-                                        obj->def, NULL);
+    ret = virStoragePoolObjNumOfVolumes(obj, pool->conn, NULL);
 
     virStoragePoolObjUnlock(obj);
     return ret;
@@ -4758,8 +4757,7 @@ testStoragePoolListVolumes(virStoragePoolPtr pool,
     if (!(obj = testStoragePoolObjFindActiveByName(privconn, pool->name)))
         return -1;
 
-    n = virStoragePoolObjVolumeGetNames(&obj->volumes, pool->conn,
-                                        obj->def, NULL, names, maxnames);
+    n = virStoragePoolObjVolumeGetNames(obj, pool->conn, NULL, names, maxnames);
 
     virStoragePoolObjUnlock(obj);
     return n;
@@ -4786,8 +4784,7 @@ testStoragePoolListAllVolumes(virStoragePoolPtr pool,
         goto cleanup;
     }
 
-    ret = virStoragePoolObjVolumeListExport(pool->conn, &obj->volumes,
-                                            obj->def, vols, NULL);
+    ret = virStoragePoolObjVolumeListExport(pool->conn, obj, vols, NULL);
 
  cleanup:
     virStoragePoolObjUnlock(obj);
-- 
2.9.3

--
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]
  Powered by Linux