[libvirt] [PATCH 1/4] storage: Rename UpdateVolInfoFlags to UpdateVolInfo

Cole Robinson crobinso at redhat.com
Mon Mar 31 00:42:28 UTC 2014


And drop the original UpdateVolInfo. Makes it a bit easier to follow
the function usage.

And change the int parameter to an explicit bool.
---
 src/storage/storage_backend.c         | 13 +++----------
 src/storage/storage_backend.h         |  6 ++----
 src/storage/storage_backend_disk.c    |  3 ++-
 src/storage/storage_backend_fs.c      |  4 ++--
 src/storage/storage_backend_logical.c |  3 ++-
 5 files changed, 11 insertions(+), 18 deletions(-)

diff --git a/src/storage/storage_backend.c b/src/storage/storage_backend.c
index 5b3b536..7795b33 100644
--- a/src/storage/storage_backend.c
+++ b/src/storage/storage_backend.c
@@ -1338,9 +1338,9 @@ virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
 }
 
 int
-virStorageBackendUpdateVolInfoFlags(virStorageVolDefPtr vol,
-                                    int withCapacity,
-                                    unsigned int openflags)
+virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
+                               bool withCapacity,
+                               unsigned int openflags)
 {
     int ret;
 
@@ -1359,13 +1359,6 @@ virStorageBackendUpdateVolInfoFlags(virStorageVolDefPtr vol,
     return 0;
 }
 
-int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
-                                   int withCapacity)
-{
-    return virStorageBackendUpdateVolInfoFlags(vol, withCapacity,
-                                               VIR_STORAGE_VOL_OPEN_DEFAULT);
-}
-
 /*
  * virStorageBackendUpdateVolTargetInfoFD:
  * @target: target definition ptr of volume to update
diff --git a/src/storage/storage_backend.h b/src/storage/storage_backend.h
index 2034a22..56f8d03 100644
--- a/src/storage/storage_backend.h
+++ b/src/storage/storage_backend.h
@@ -138,10 +138,8 @@ int virStorageBackendVolOpenCheckMode(const char *path, struct stat *sb,
     ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(2);
 
 int virStorageBackendUpdateVolInfo(virStorageVolDefPtr vol,
-                                   int withCapacity);
-int virStorageBackendUpdateVolInfoFlags(virStorageVolDefPtr vol,
-                                        int withCapacity,
-                                        unsigned int openflags);
+                                   bool withCapacity,
+                                   unsigned int openflags);
 int virStorageBackendUpdateVolTargetInfo(virStorageVolTargetPtr target,
                                          unsigned long long *allocation,
                                          unsigned long long *capacity,
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 8276c96..a8652c1 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -113,7 +113,8 @@ virStorageBackendDiskMakeDataVol(virStoragePoolObjPtr pool,
     }
 
     /* Refresh allocation/capacity/perms */
-    if (virStorageBackendUpdateVolInfo(vol, 1) < 0)
+    if (virStorageBackendUpdateVolInfo(vol, true,
+                                       VIR_STORAGE_VOL_OPEN_DEFAULT) < 0)
         return -1;
 
     /* set partition type */
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
index 0f8da06..aa3ad2b 100644
--- a/src/storage/storage_backend_fs.c
+++ b/src/storage/storage_backend_fs.c
@@ -1180,8 +1180,8 @@ virStorageBackendFileSystemVolRefresh(virConnectPtr conn,
     int ret;
 
     /* Refresh allocation / permissions info in case its changed */
-    ret = virStorageBackendUpdateVolInfoFlags(vol, 0,
-                                              VIR_STORAGE_VOL_FS_OPEN_FLAGS);
+    ret = virStorageBackendUpdateVolInfo(vol, false,
+                                         VIR_STORAGE_VOL_FS_OPEN_FLAGS);
     if (ret < 0)
         return ret;
 
diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index f90d373..f2254a4 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -149,7 +149,8 @@ virStorageBackendLogicalMakeVol(char **const groups,
     if (!vol->key && VIR_STRDUP(vol->key, groups[2]) < 0)
         goto cleanup;
 
-    if (virStorageBackendUpdateVolInfo(vol, 1) < 0)
+    if (virStorageBackendUpdateVolInfo(vol, true,
+                                       VIR_STORAGE_VOL_OPEN_DEFAULT) < 0)
         goto cleanup;
 
     nextents = 1;
-- 
1.8.5.3




More information about the libvir-list mailing list