util: remove virGetDeviceID

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>
This commit is contained in:
Ján Tomko 2022-01-13 18:20:37 +01:00
parent 89803eb5f8
commit 44aaa02992
4 changed files with 0 additions and 50 deletions

View File

@ -3508,7 +3508,6 @@ virDoesUserExist;
virDoubleToStr;
virFormatIntDecimal;
virFormatIntPretty;
virGetDeviceID;
virGetGroupID;
virGetGroupList;
virGetGroupName;

View 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,

View 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);

View 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)
{