]> git.ipfire.org Git - thirdparty/libvirt.git/commitdiff
util: remove virGetDeviceID
authorJán Tomko <jtomko@redhat.com>
Thu, 13 Jan 2022 17:20:37 +0000 (18:20 +0100)
committerJán Tomko <jtomko@redhat.com>
Wed, 19 Jan 2022 12:57:59 +0000 (13:57 +0100)
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@redhat.com>
Reviewed-by: Andrea Bolognani <abologna@redhat.com>
src/libvirt_private.syms
src/util/virutil.c
src/util/virutil.h
tests/qemuhotplugmock.c

index 9be2069073f75a304eb4b0455f519b532e759816..ba3462d8499ea38bba56d97d9ea2db76f531c64c 100644 (file)
@@ -3508,7 +3508,6 @@ virDoesUserExist;
 virDoubleToStr;
 virFormatIntDecimal;
 virFormatIntPretty;
-virGetDeviceID;
 virGetGroupID;
 virGetGroupList;
 virGetGroupName;
index 0acdc052c3dcb29ee01c049f4a4a028945a8dbbd..4dc421a85f94fd23b541b224107db2d0071a9bbd 100644 (file)
@@ -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,
index bd2c69bfaac1b4e89179815e289929cd85a91291..c8b8445bbc17fe2b5205291ca5370a7377cc9fb9 100644 (file)
@@ -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);
index 3b5f858044627554b0ce8703e572f38f5c07be3e..051f2b20dc5873242015b55bee0f783488d20b5f 100644 (file)
@@ -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)
 {