提交 dfa0e118 编写于 作者: M Michal Privoznik

util: Move virIsDevMapperDevice() to virdevmapper.c

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: NMichal Privoznik <mprivozn@redhat.com>
Reviewed-by: NJiri Denemark <jdenemar@redhat.com>
上级 e57323ec
......@@ -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;
......
......@@ -36,10 +36,10 @@
#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)
......
......@@ -32,6 +32,7 @@
#include "virutil.h"
#include "configmake.h"
#include "virstring.h"
#include "virdevmapper.h"
#define VIR_FROM_THIS VIR_FROM_STORAGE
......
......@@ -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 */
......@@ -25,3 +25,6 @@
int
virDevMapperGetTargets(const char *path,
char ***devPaths) G_GNUC_NO_INLINE;
bool
virIsDevMapperDevice(const char *dev_name) ATTRIBUTE_NONNULL(1);
......@@ -37,10 +37,6 @@
#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)
{
......
......@@ -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,
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册