]> xenbits.xensource.com Git - libvirt.git/commitdiff
util: Move virIsDevMapperDevice() to virdevmapper.c
authorMichal Privoznik <mprivozn@redhat.com>
Thu, 11 Jun 2020 09:57:14 +0000 (11:57 +0200)
committerMichal Privoznik <mprivozn@redhat.com>
Mon, 15 Jun 2020 12:50:46 +0000 (14:50 +0200)
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@redhat.com>
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
src/libvirt_private.syms
src/storage/parthelper.c
src/storage/storage_backend_disk.c
src/util/virdevmapper.c
src/util/virdevmapper.h
src/util/virutil.c
src/util/virutil.h

index a6af44fe1ccf658c5188fb5402ec9bc9e7808e21..247d7f47417b511d857edca0a6c932c1132a04d2 100644 (file)
@@ -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;
index 761a7f93fc4e29540535856288b18f3bf462353b..812e90d3cb0de037a2bf4a328f6d54e392354292 100644 (file)
 #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)
index 35b07abbfe80984bd440dfae5f7ccef2513ea5fc..eae23ec24a90d2aa54294eda0d319c19ed99632d 100644 (file)
@@ -32,6 +32,7 @@
 #include "virutil.h"
 #include "configmake.h"
 #include "virstring.h"
+#include "virdevmapper.h"
 
 #define VIR_FROM_THIS VIR_FROM_STORAGE
 
index 79dbc3d02a340906008c9b947c04965885f3cb44..600e1f632298d1a1fec568e8b3852fc10fee768a 100644 (file)
@@ -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 */
index 87bbc63cfd1afd260d4b4e4f2342c5d15ebdd4f2..834900692eda42dc34e0d28ddadb4fe81b4c6103 100644 (file)
@@ -25,3 +25,6 @@
 int
 virDevMapperGetTargets(const char *path,
                        char ***devPaths) G_GNUC_NO_INLINE;
+
+bool
+virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
index fb4650114237389ce974d8ceb30a31b3a56ae76a..929afb82d0760e48844bda9097242f48e8b06623 100644 (file)
 
 #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)
 {
index 49b4bf440ff143b6ae97e8beb576ebc809d462f8..ef01fd9e3699696e14db7ca0b6814b29406e47d1 100644 (file)
@@ -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,