[libvirt PATCH 5/7] util: remove virGetDeviceID

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

 



It was only used to construct the hash key for the (now removed)
shared devices in the qemu driver.

Remove it and its mocking.

Signed-off-by: Ján Tomko <jtomko@xxxxxxxxxx>
---
 src/libvirt_private.syms |  1 -
 src/util/virutil.c       | 29 -----------------------------
 src/util/virutil.h       |  3 ---
 tests/qemuhotplugmock.c  | 17 -----------------
 4 files changed, 50 deletions(-)

diff --git a/src/libvirt_private.syms b/src/libvirt_private.syms
index 48e8ef6c72..ae132f9b11 100644
--- a/src/libvirt_private.syms
+++ b/src/libvirt_private.syms
@@ -3510,7 +3510,6 @@ virDoesUserExist;
 virDoubleToStr;
 virFormatIntDecimal;
 virFormatIntPretty;
-virGetDeviceID;
 virGetGroupID;
 virGetGroupList;
 virGetGroupName;
diff --git a/src/util/virutil.c b/src/util/virutil.c
index 0acdc052c3..4dc421a85f 100644
--- a/src/util/virutil.c
+++ b/src/util/virutil.c
@@ -1324,35 +1324,6 @@ virValidateWWN(const char *wwn)
     return true;
 }
 
-#if defined(major) && defined(minor)
-int
-virGetDeviceID(const char *path, int *maj, int *min)
-{
-    struct stat sb;
-
-    if (stat(path, &sb) < 0)
-        return -errno;
-
-    if (!S_ISBLK(sb.st_mode))
-        return -EINVAL;
-
-    if (maj)
-        *maj = major(sb.st_rdev);
-    if (min)
-        *min = minor(sb.st_rdev);
-
-    return 0;
-}
-#else
-int
-virGetDeviceID(const char *path G_GNUC_UNUSED,
-               int *maj,
-               int *min)
-{
-    *maj = *min = 0;
-    return -ENOSYS;
-}
-#endif
 
 int
 virSetDeviceUnprivSGIO(const char *path G_GNUC_UNUSED,
diff --git a/src/util/virutil.h b/src/util/virutil.h
index bd2c69bfaa..c8b8445bbc 100644
--- a/src/util/virutil.h
+++ b/src/util/virutil.h
@@ -116,9 +116,6 @@ bool virDoesGroupExist(const char *name);
 
 bool virValidateWWN(const char *wwn);
 
-int virGetDeviceID(const char *path,
-                   int *maj,
-                   int *min) G_GNUC_NO_INLINE;
 int virSetDeviceUnprivSGIO(const char *path,
                            const char *sysfs_dir,
                            int unpriv_sgio);
diff --git a/tests/qemuhotplugmock.c b/tests/qemuhotplugmock.c
index 3b5f858044..051f2b20dc 100644
--- a/tests/qemuhotplugmock.c
+++ b/tests/qemuhotplugmock.c
@@ -27,7 +27,6 @@
 #include "virmock.h"
 #include <fcntl.h>
 
-static int (*real_virGetDeviceID)(const char *path, int *maj, int *min);
 static bool (*real_virFileExists)(const char *path);
 
 static void
@@ -36,7 +35,6 @@ init_syms(void)
     if (real_virFileExists)
         return;
 
-    VIR_MOCK_REAL_INIT(virGetDeviceID);
     VIR_MOCK_REAL_INIT(virFileExists);
 }
 
@@ -68,21 +66,6 @@ virDevMapperGetTargets(const char *path,
 }
 
 
-int
-virGetDeviceID(const char *path, int *maj, int *min)
-{
-    init_syms();
-
-    if (STREQ(path, "/dev/mapper/virt")) {
-        *maj = 254;
-        *min = 0;
-        return 0;
-    }
-
-    return real_virGetDeviceID(path, maj, min);
-}
-
-
 bool
 virFileExists(const char *path)
 {
-- 
2.31.1




[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