[PATCH 04/20] vbox: Rewrite vboxConnectListStoragePools

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

 



Change the if condition nnames == 1 to nnames > 0.
So if we put more than one slot to get active storage pools,
the new function will return exactly one, while the old would
return 0.
---
 src/vbox/vbox_common.c        |   11 +++++++++++
 src/vbox/vbox_tmpl.c          |   10 ----------
 src/vbox/vbox_uniformed_api.h |    1 +
 3 files changed, 12 insertions(+), 10 deletions(-)

diff --git a/src/vbox/vbox_common.c b/src/vbox/vbox_common.c
index d9a5db6..e245fd0 100644
--- a/src/vbox/vbox_common.c
+++ b/src/vbox/vbox_common.c
@@ -8330,6 +8330,17 @@ int vboxConnectNumOfStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED)
     return 1;
 }
 
+int vboxConnectListStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                char **const names, int nnames)
+{
+    int numActive = 0;
+
+    if (nnames > 0 &&
+        VIR_STRDUP(names[numActive], "default-pool") > 0)
+        numActive++;
+    return numActive;
+}
+
 /**
  * Function Tables
  */
diff --git a/src/vbox/vbox_tmpl.c b/src/vbox/vbox_tmpl.c
index c18ce4d..37108cf 100644
--- a/src/vbox/vbox_tmpl.c
+++ b/src/vbox/vbox_tmpl.c
@@ -2021,16 +2021,6 @@ _registerDomainEvent(virDriverPtr driver)
  * The Storage Functions here on
  */
 
-static int vboxConnectListStoragePools(virConnectPtr conn ATTRIBUTE_UNUSED,
-                                       char **const names, int nnames) {
-    int numActive = 0;
-
-    if (nnames == 1 &&
-        VIR_STRDUP(names[numActive], "default-pool") > 0)
-        numActive++;
-    return numActive;
-}
-
 static virStoragePoolPtr
 vboxStoragePoolLookupByName(virConnectPtr conn, const char *name)
 {
diff --git a/src/vbox/vbox_uniformed_api.h b/src/vbox/vbox_uniformed_api.h
index 1426222..aa7d4af 100644
--- a/src/vbox/vbox_uniformed_api.h
+++ b/src/vbox/vbox_uniformed_api.h
@@ -590,6 +590,7 @@ virDrvOpenStatus vboxStorageOpen(virConnectPtr conn, virConnectAuthPtr auth,
                                  unsigned int flags);
 int vboxStorageClose(virConnectPtr conn);
 int vboxConnectNumOfStoragePools(virConnectPtr conn);
+int vboxConnectListStoragePools(virConnectPtr conn, char **const names, int nnames);
 
 /* Version specified functions for installing uniformed API */
 void vbox22InstallUniformedAPI(vboxUniformedAPI *pVBoxAPI);
-- 
1.7.9.5

--
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]