render / rpms / libvirt

Forked from rpms/libvirt 10 months ago
Clone
fbe740
From 16b26f917f445c837127c786c7b641e1e38f93fe Mon Sep 17 00:00:00 2001
fbe740
Message-Id: <16b26f917f445c837127c786c7b641e1e38f93fe@dist-git>
fbe740
From: Michal Privoznik <mprivozn@redhat.com>
fbe740
Date: Fri, 19 Jun 2020 17:44:08 +0200
fbe740
Subject: [PATCH] util: Move virIsDevMapperDevice() to virdevmapper.c
fbe740
MIME-Version: 1.0
fbe740
Content-Type: text/plain; charset=UTF-8
fbe740
Content-Transfer-Encoding: 8bit
fbe740
fbe740
When introducing virdevmapper.c (in v4.3.0-rc1~427) I didn't
fbe740
realize there is a function that calls in devmapper. The function
fbe740
is called virIsDevMapperDevice() and lives in virutil.c. Now that
fbe740
we have a special file for handling devmapper move it there.
fbe740
fbe740
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
fbe740
Reviewed-by: Jiri Denemark <jdenemar@redhat.com>
fbe740
(cherry picked from commit dfa0e118f745fe3f4fe95975c6100f0fc6d788be)
fbe740
fbe740
https://bugzilla.redhat.com/show_bug.cgi?id=1849095
fbe740
fbe740
Conflicts:
fbe740
- src/util/virutil.c - Context, becasue v6.0.0-206-gfc920f704c is
fbe740
  not backported.
fbe740
fbe740
Signed-off-by: Michal Privoznik <mprivozn@redhat.com>
fbe740
Message-Id: <84be146c2e7fc097da7189a7bf270577ffba18b2.1592581422.git.mprivozn@redhat.com>
fbe740
Reviewed-by: Ján Tomko <jtomko@redhat.com>
fbe740
---
fbe740
 src/libvirt_private.syms           |  2 +-
fbe740
 src/storage/parthelper.c           |  2 +-
fbe740
 src/storage/storage_backend_disk.c |  1 +
fbe740
 src/util/virdevmapper.c            | 24 ++++++++++++++++++++++++
fbe740
 src/util/virdevmapper.h            |  3 +++
fbe740
 src/util/virutil.c                 | 24 ------------------------
fbe740
 src/util/virutil.h                 |  2 --
fbe740
 7 files changed, 30 insertions(+), 28 deletions(-)
fbe740
fbe740
diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
fbe740
index ac5527ef01..a3fe49ae33 100644
fbe740
--- a/src/libvirt_private.syms
fbe740
+++ b/src/libvirt_private.syms
fbe740
@@ -1871,6 +1871,7 @@ virDBusSetSharedBus;
fbe740
 
fbe740
 # util/virdevmapper.h
fbe740
 virDevMapperGetTargets;
fbe740
+virIsDevMapperDevice;
fbe740
 
fbe740
 
fbe740
 # util/virdnsmasq.h
fbe740
@@ -3394,7 +3395,6 @@ virHexToBin;
fbe740
 virHostGetDRMRenderNode;
fbe740
 virHostHasIOMMU;
fbe740
 virIndexToDiskName;
fbe740
-virIsDevMapperDevice;
fbe740
 virMemoryLimitIsSet;
fbe740
 virMemoryLimitTruncate;
fbe740
 virMemoryMaxValue;
fbe740
diff --git a/src/storage/parthelper.c b/src/storage/parthelper.c
fbe740
index 761a7f93fc..812e90d3cb 100644
fbe740
--- a/src/storage/parthelper.c
fbe740
+++ b/src/storage/parthelper.c
fbe740
@@ -36,10 +36,10 @@
fbe740
 #include <sys/stat.h>
fbe740
 #include <unistd.h>
fbe740
 
fbe740
-#include "virutil.h"
fbe740
 #include "virfile.h"
fbe740
 #include "virstring.h"
fbe740
 #include "virgettext.h"
fbe740
+#include "virdevmapper.h"
fbe740
 
fbe740
 /* we don't need to include the full internal.h just for this */
fbe740
 #define STREQ(a, b) (strcmp(a, b) == 0)
fbe740
diff --git a/src/storage/storage_backend_disk.c b/src/storage/storage_backend_disk.c
fbe740
index 00e8b1aa13..90c57af59b 100644
fbe740
--- a/src/storage/storage_backend_disk.c
fbe740
+++ b/src/storage/storage_backend_disk.c
fbe740
@@ -31,6 +31,7 @@
fbe740
 #include "virfile.h"
fbe740
 #include "configmake.h"
fbe740
 #include "virstring.h"
fbe740
+#include "virdevmapper.h"
fbe740
 
fbe740
 #define VIR_FROM_THIS VIR_FROM_STORAGE
fbe740
 
fbe740
diff --git a/src/util/virdevmapper.c b/src/util/virdevmapper.c
fbe740
index f000979ce0..23b2a16057 100644
fbe740
--- a/src/util/virdevmapper.c
fbe740
+++ b/src/util/virdevmapper.c
fbe740
@@ -214,3 +214,27 @@ virDevMapperGetTargets(const char *path G_GNUC_UNUSED,
fbe740
     return -1;
fbe740
 }
fbe740
 #endif /* ! WITH_DEVMAPPER */
fbe740
+
fbe740
+
fbe740
+#if WITH_DEVMAPPER
fbe740
+bool
fbe740
+virIsDevMapperDevice(const char *dev_name)
fbe740
+{
fbe740
+    struct stat buf;
fbe740
+
fbe740
+    if (!stat(dev_name, &buf) &&
fbe740
+        S_ISBLK(buf.st_mode) &&
fbe740
+        dm_is_dm_major(major(buf.st_rdev)))
fbe740
+            return true;
fbe740
+
fbe740
+    return false;
fbe740
+}
fbe740
+
fbe740
+#else /* ! WITH_DEVMAPPER */
fbe740
+
fbe740
+bool
fbe740
+virIsDevMapperDevice(const char *dev_name G_GNUC_UNUSED)
fbe740
+{
fbe740
+    return false;
fbe740
+}
fbe740
+#endif /* ! WITH_DEVMAPPER */
fbe740
diff --git a/src/util/virdevmapper.h b/src/util/virdevmapper.h
fbe740
index 87bbc63cfd..834900692e 100644
fbe740
--- a/src/util/virdevmapper.h
fbe740
+++ b/src/util/virdevmapper.h
fbe740
@@ -25,3 +25,6 @@
fbe740
 int
fbe740
 virDevMapperGetTargets(const char *path,
fbe740
                        char ***devPaths) G_GNUC_NO_INLINE;
fbe740
+
fbe740
+bool
fbe740
+virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
fbe740
diff --git a/src/util/virutil.c b/src/util/virutil.c
fbe740
index 4198473fce..261b2d2af6 100644
fbe740
--- a/src/util/virutil.c
fbe740
+++ b/src/util/virutil.c
fbe740
@@ -37,10 +37,6 @@
fbe740
 #include <sys/types.h>
fbe740
 #include <termios.h>
fbe740
 
fbe740
-#if WITH_DEVMAPPER
fbe740
-# include <libdevmapper.h>
fbe740
-#endif
fbe740
-
fbe740
 #include <netdb.h>
fbe740
 #ifdef HAVE_GETPWUID_R
fbe740
 # include <pwd.h>
fbe740
@@ -1327,26 +1323,6 @@ void virWaitForDevices(void)
fbe740
     ignore_value(virCommandRun(cmd, &exitstatus));
fbe740
 }
fbe740
 
fbe740
-#if WITH_DEVMAPPER
fbe740
-bool
fbe740
-virIsDevMapperDevice(const char *dev_name)
fbe740
-{
fbe740
-    struct stat buf;
fbe740
-
fbe740
-    if (!stat(dev_name, &buf) &&
fbe740
-        S_ISBLK(buf.st_mode) &&
fbe740
-        dm_is_dm_major(major(buf.st_rdev)))
fbe740
-            return true;
fbe740
-
fbe740
-    return false;
fbe740
-}
fbe740
-#else
fbe740
-bool virIsDevMapperDevice(const char *dev_name G_GNUC_UNUSED)
fbe740
-{
fbe740
-    return false;
fbe740
-}
fbe740
-#endif
fbe740
-
fbe740
 bool
fbe740
 virValidateWWN(const char *wwn)
fbe740
 {
fbe740
diff --git a/src/util/virutil.h b/src/util/virutil.h
fbe740
index 58c45a6447..0dcaff79ac 100644
fbe740
--- a/src/util/virutil.h
fbe740
+++ b/src/util/virutil.h
fbe740
@@ -116,8 +116,6 @@ bool virDoesUserExist(const char *name);
fbe740
 bool virDoesGroupExist(const char *name);
fbe740
 
fbe740
 
fbe740
-bool virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
fbe740
-
fbe740
 bool virValidateWWN(const char *wwn);
fbe740
 
fbe740
 int virGetDeviceID(const char *path,
fbe740
-- 
fbe740
2.27.0
fbe740