[PATCH 3/8] storage: lvm: Avoid forward decl of virStorageBackendLogicalDeleteVol

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

 



Change code ordering to avoid the need for a forward declaration.
---
 src/storage/storage_backend_logical.c | 67 ++++++++++++++++-------------------
 1 file changed, 31 insertions(+), 36 deletions(-)

diff --git a/src/storage/storage_backend_logical.c b/src/storage/storage_backend_logical.c
index 10966cc..15b86dc 100644
--- a/src/storage/storage_backend_logical.c
+++ b/src/storage/storage_backend_logical.c
@@ -667,10 +667,38 @@ cleanup:


 static int
-virStorageBackendLogicalDeleteVol(virConnectPtr conn,
-                                  virStoragePoolObjPtr pool,
+virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
+                                  virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
                                   virStorageVolDefPtr vol,
-                                  unsigned int flags);
+                                  unsigned int flags)
+{
+    int ret = -1;
+
+    virCommandPtr lvchange_cmd = NULL;
+    virCommandPtr lvremove_cmd = NULL;
+
+    virCheckFlags(0, -1);
+
+    virFileWaitForDevices();
+
+    lvchange_cmd = virCommandNewArgList(LVCHANGE, "-aln", vol->target.path, NULL);
+    lvremove_cmd = virCommandNewArgList(LVREMOVE, "-f", vol->target.path, NULL);
+
+    if (virCommandRun(lvremove_cmd, NULL) < 0) {
+        if (virCommandRun(lvchange_cmd, NULL) < 0) {
+            goto cleanup;
+        } else {
+            if (virCommandRun(lvremove_cmd, NULL) < 0)
+                goto cleanup;
+        }
+    }
+
+    ret = 0;
+cleanup:
+    virCommandFree(lvchange_cmd);
+    virCommandFree(lvremove_cmd);
+    return ret;
+}


 static int
@@ -784,39 +812,6 @@ virStorageBackendLogicalBuildVolFrom(virConnectPtr conn,
     return build_func(conn, pool, vol, inputvol, flags);
 }

-static int
-virStorageBackendLogicalDeleteVol(virConnectPtr conn ATTRIBUTE_UNUSED,
-                                  virStoragePoolObjPtr pool ATTRIBUTE_UNUSED,
-                                  virStorageVolDefPtr vol,
-                                  unsigned int flags)
-{
-    int ret = -1;
-
-    virCommandPtr lvchange_cmd = NULL;
-    virCommandPtr lvremove_cmd = NULL;
-
-    virCheckFlags(0, -1);
-
-    virFileWaitForDevices();
-
-    lvchange_cmd = virCommandNewArgList(LVCHANGE, "-aln", vol->target.path, NULL);
-    lvremove_cmd = virCommandNewArgList(LVREMOVE, "-f", vol->target.path, NULL);
-
-    if (virCommandRun(lvremove_cmd, NULL) < 0) {
-        if (virCommandRun(lvchange_cmd, NULL) < 0) {
-            goto cleanup;
-        } else {
-            if (virCommandRun(lvremove_cmd, NULL) < 0)
-                goto cleanup;
-        }
-    }
-
-    ret = 0;
-cleanup:
-    virCommandFree(lvchange_cmd);
-    virCommandFree(lvremove_cmd);
-    return ret;
-}

 virStorageBackend virStorageBackendLogical = {
     .type = VIR_STORAGE_POOL_LOGICAL,
-- 
1.8.5.2

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