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