[PATCH 1/2] util: Move virIsDevMapperDevice() to virdevmapper.c

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

 



When introducing virdevmapper.c (in v4.3.0-rc1~427) I didn't
realize there is a function that calls in devmapper. The function
is called virIsDevMapperDevice() and lives in virutil.c. Now that
we have a special file for handling devmapper move it there.

Signed-off-by: Michal Privoznik <mprivozn@xxxxxxxxxx>
---
 src/libvirt_private.syms           |  2 +-
 src/storage/parthelper.c           |  2 +-
 src/storage/storage_backend_disk.c |  1 +
 src/util/virdevmapper.c            | 24 ++++++++++++++++++++++++
 src/util/virdevmapper.h            |  3 +++
 src/util/virutil.c                 | 24 ------------------------
 src/util/virutil.h                 |  2 --
 7 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index a6af44fe1c..247d7f4741 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -1943,6 +1943,7 @@ virDBusSetSharedBus;
 
 # util/virdevmapper.h
 virDevMapperGetTargets;
+virIsDevMapperDevice;
 
 
 # util/virdnsmasq.h
@@ -3432,7 +3433,6 @@ virGetUserShell;
 virHostGetDRMRenderNode;
 virHostHasIOMMU;
 virIndexToDiskName;
-virIsDevMapperDevice;
 virMemoryLimitIsSet;
 virMemoryLimitTruncate;
 virMemoryMaxValue;
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
index 761a7f93fc..812e90d3cb 100644
--- a/src/storage/parthelper.c
+++ b/src/storage/parthelper.c
@@ -36,10 +36,10 @@
 #include <sys/stat.h>
 #include <unistd.h>
 
-#include "virutil.h"
 #include "virfile.h"
 #include "virstring.h"
 #include "virgettext.h"
+#include "virdevmapper.h"
 
 /* we don't need to include the full internal.h just for this */
 #define STREQ(a, b) (strcmp(a, b) == 0)
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
index 35b07abbfe..eae23ec24a 100644
--- a/src/storage/storage_backend_disk.c
+++ b/src/storage/storage_backend_disk.c
@@ -32,6 +32,7 @@
 #include "virutil.h"
 #include "configmake.h"
 #include "virstring.h"
+#include "virdevmapper.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
index 79dbc3d02a..600e1f6322 100644
--- a/src/util/virdevmapper.c
+++ b/src/util/virdevmapper.c
@@ -212,3 +212,27 @@ virDevMapperGetTargets(const char *path G_GNUC_UNUSED,
     return -1;
 }
 #endif /* ! WITH_DEVMAPPER */
+
+
+#if WITH_DEVMAPPER
+bool
+virIsDevMapperDevice(const char *dev_name)
+{
+    struct stat buf;
+
+    if (!stat(dev_name, &buf) &&
+        S_ISBLK(buf.st_mode) &&
+        dm_is_dm_major(major(buf.st_rdev)))
+            return true;
+
+    return false;
+}
+
+#else /* ! WITH_DEVMAPPER */
+
+bool
+virIsDevMapperDevice(const char *dev_name G_GNUC_UNUSED)
+{
+    return false;
+}
+#endif /* ! WITH_DEVMAPPER */
diff --git a/src/util/virdevmapper.h b/src/util/virdevmapper.h
index 87bbc63cfd..834900692e 100644
--- a/src/util/virdevmapper.h
+++ b/src/util/virdevmapper.h
@@ -25,3 +25,6 @@
 int
 virDevMapperGetTargets(const char *path,
                        char ***devPaths) G_GNUC_NO_INLINE;
+
+bool
+virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
diff --git a/src/util/virutil.c b/src/util/virutil.c
index fb46501142..929afb82d0 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -37,10 +37,6 @@
 
 #include <sys/types.h>
 
-#if WITH_DEVMAPPER
-# include <libdevmapper.h>
-#endif
-
 #ifdef HAVE_GETPWUID_R
 # include <pwd.h>
 # include <grp.h>
@@ -1340,26 +1336,6 @@ void virWaitForDevices(void)
     ignore_value(virCommandRun(cmd, &exitstatus));
 }
 
-#if WITH_DEVMAPPER
-bool
-virIsDevMapperDevice(const char *dev_name)
-{
-    struct stat buf;
-
-    if (!stat(dev_name, &buf) &&
-        S_ISBLK(buf.st_mode) &&
-        dm_is_dm_major(major(buf.st_rdev)))
-            return true;
-
-    return false;
-}
-#else
-bool virIsDevMapperDevice(const char *dev_name G_GNUC_UNUSED)
-{
-    return false;
-}
-#endif
-
 bool
 virValidateWWN(const char *wwn)
 {
diff --git a/src/util/virutil.h b/src/util/virutil.h
index 49b4bf440f..ef01fd9e36 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -114,8 +114,6 @@ bool virDoesUserExist(const char *name);
 bool virDoesGroupExist(const char *name);
 
 
-bool virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
-
 bool virValidateWWN(const char *wwn);
 
 int virGetDeviceID(const char *path,
-- 
2.26.2




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

  Powered by Linux