99cbc7
From 7dcfd278c8139fe25f3cb5a2efd5c440ad8d2321 Mon Sep 17 00:00:00 2001
99cbc7
Message-Id: <7dcfd278c8139fe25f3cb5a2efd5c440ad8d2321@dist-git>
99cbc7
From: John Ferlan <jferlan@redhat.com>
99cbc7
Date: Wed, 3 Apr 2019 09:12:15 -0400
99cbc7
Subject: [PATCH] storage: Move virStorageBackendFileSystemGetPoolSource
99cbc7
MIME-Version: 1.0
99cbc7
Content-Type: text/plain; charset=UTF-8
99cbc7
Content-Transfer-Encoding: 8bit
99cbc7
99cbc7
https://bugzilla.redhat.com/show_bug.cgi?id=1584663
99cbc7
99cbc7
Move into storage_util for reuse by test harness
99cbc7
99cbc7
Signed-off-by: John Ferlan <jferlan@redhat.com>
99cbc7
ACKed-by: Michal Privoznik <mprivozn@redhat.com>
99cbc7
(cherry picked from commit 1f6ca26d72c17d51fd713c72eeac5c1900153bc0)
99cbc7
Message-Id: <20190403131219.16385-4-jferlan@redhat.com>
99cbc7
Reviewed-by: Ján Tomko <jtomko@redhat.com>
99cbc7
---
99cbc7
 src/storage/storage_backend_fs.c | 33 --------------------------------
99cbc7
 src/storage/storage_util.c       | 33 ++++++++++++++++++++++++++++++++
99cbc7
 src/storage/storage_util.h       |  3 +++
99cbc7
 3 files changed, 36 insertions(+), 33 deletions(-)
99cbc7
99cbc7
diff --git a/src/storage/storage_backend_fs.c b/src/storage/storage_backend_fs.c
99cbc7
index 4acdb43e0d..7bb61aa4ae 100644
99cbc7
--- a/src/storage/storage_backend_fs.c
99cbc7
+++ b/src/storage/storage_backend_fs.c
99cbc7
@@ -248,39 +248,6 @@ virStorageBackendFileSystemIsValid(virStoragePoolObjPtr pool)
99cbc7
 }
99cbc7
 
99cbc7
 
99cbc7
-/**
99cbc7
- * virStorageBackendFileSystemGetPoolSource
99cbc7
- * @pool: storage pool object pointer
99cbc7
- *
99cbc7
- * Allocate/return a string representing the FS storage pool source.
99cbc7
- * It is up to the caller to VIR_FREE the allocated string
99cbc7
- */
99cbc7
-static char *
99cbc7
-virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
99cbc7
-{
99cbc7
-    virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
99cbc7
-    char *src = NULL;
99cbc7
-
99cbc7
-    if (def->type == VIR_STORAGE_POOL_NETFS) {
99cbc7
-        if (def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) {
99cbc7
-            if (virAsprintf(&src, "//%s/%s",
99cbc7
-                            def->source.hosts[0].name,
99cbc7
-                            def->source.dir) < 0)
99cbc7
-                return NULL;
99cbc7
-        } else {
99cbc7
-            if (virAsprintf(&src, "%s:%s",
99cbc7
-                            def->source.hosts[0].name,
99cbc7
-                            def->source.dir) < 0)
99cbc7
-                return NULL;
99cbc7
-        }
99cbc7
-    } else {
99cbc7
-        if (VIR_STRDUP(src, def->source.devices[0].path) < 0)
99cbc7
-            return NULL;
99cbc7
-    }
99cbc7
-    return src;
99cbc7
-}
99cbc7
-
99cbc7
-
99cbc7
 /**
99cbc7
  * @pool storage pool to check for status
99cbc7
  *
99cbc7
diff --git a/src/storage/storage_util.c b/src/storage/storage_util.c
99cbc7
index 327b500b6b..ccbc2c925c 100644
99cbc7
--- a/src/storage/storage_util.c
99cbc7
+++ b/src/storage/storage_util.c
99cbc7
@@ -4212,6 +4212,39 @@ virStorageBackendZeroPartitionTable(const char *path,
99cbc7
 }
99cbc7
 
99cbc7
 
99cbc7
+/**
99cbc7
+ * virStorageBackendFileSystemGetPoolSource
99cbc7
+ * @pool: storage pool object pointer
99cbc7
+ *
99cbc7
+ * Allocate/return a string representing the FS storage pool source.
99cbc7
+ * It is up to the caller to VIR_FREE the allocated string
99cbc7
+ */
99cbc7
+char *
99cbc7
+virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool)
99cbc7
+{
99cbc7
+    virStoragePoolDefPtr def = virStoragePoolObjGetDef(pool);
99cbc7
+    char *src = NULL;
99cbc7
+
99cbc7
+    if (def->type == VIR_STORAGE_POOL_NETFS) {
99cbc7
+        if (def->source.format == VIR_STORAGE_POOL_NETFS_CIFS) {
99cbc7
+            if (virAsprintf(&src, "//%s/%s",
99cbc7
+                            def->source.hosts[0].name,
99cbc7
+                            def->source.dir) < 0)
99cbc7
+                return NULL;
99cbc7
+        } else {
99cbc7
+            if (virAsprintf(&src, "%s:%s",
99cbc7
+                            def->source.hosts[0].name,
99cbc7
+                            def->source.dir) < 0)
99cbc7
+                return NULL;
99cbc7
+        }
99cbc7
+    } else {
99cbc7
+        if (VIR_STRDUP(src, def->source.devices[0].path) < 0)
99cbc7
+            return NULL;
99cbc7
+    }
99cbc7
+    return src;
99cbc7
+}
99cbc7
+
99cbc7
+
99cbc7
 virCommandPtr
99cbc7
 virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
99cbc7
                                     const char *src)
99cbc7
diff --git a/src/storage/storage_util.h b/src/storage/storage_util.h
99cbc7
index 5b0baf56c4..28b3e0b9c9 100644
99cbc7
--- a/src/storage/storage_util.h
99cbc7
+++ b/src/storage/storage_util.h
99cbc7
@@ -177,6 +177,9 @@ int
99cbc7
 virStorageBackendZeroPartitionTable(const char *path,
99cbc7
                                     unsigned long long size);
99cbc7
 
99cbc7
+char *
99cbc7
+virStorageBackendFileSystemGetPoolSource(virStoragePoolObjPtr pool);
99cbc7
+
99cbc7
 virCommandPtr
99cbc7
 virStorageBackendFileSystemMountCmd(virStoragePoolDefPtr def,
99cbc7
                                     const char *src);
99cbc7
-- 
99cbc7
2.21.0
99cbc7