summaryrefslogtreecommitdiffstats
path: root/tools/dmsetup.c
diff options
context:
space:
mode:
authorPeter Rajnoha <prajnoha@redhat.com>2010-03-23 14:43:18 +0000
committerPeter Rajnoha <prajnoha@redhat.com>2010-03-23 14:43:18 +0000
commit91345610f82ae5c637f58a16388fbab3c425d753 (patch)
treea5b775d1d6f71ae86770b92916d983d1a7d86369 /tools/dmsetup.c
parentac3691f70e9ab0638820384aa03ed9913b79772b (diff)
downloadlvm2-91345610f82ae5c637f58a16388fbab3c425d753.tar.gz
lvm2-91345610f82ae5c637f58a16388fbab3c425d753.tar.xz
lvm2-91345610f82ae5c637f58a16388fbab3c425d753.zip
Strictly require libudev if udev_sync is used.
This prevents some confusion when libudev was not found so udev_sync was disabled automatically. Configure was successful though giving only a tiny warning. Also, if "dmsetup udevcreatecookie" is used, never return 0x000000 as a result if udev is not running and keep the output blank.
Diffstat (limited to 'tools/dmsetup.c')
-rw-r--r--tools/dmsetup.c9
1 files changed, 2 insertions, 7 deletions
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index 69fa1287..46f269b4 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -45,11 +45,9 @@
# include <sys/types.h>
# include <sys/ipc.h>
# include <sys/sem.h>
-#ifdef HAVE_UDEV_QUEUE_GET_UDEV_IS_ACTIVE
# define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
# include <libudev.h>
#endif
-#endif
/* FIXME Unused so far */
#undef HAVE_SYS_STATVFS_H
@@ -931,12 +929,10 @@ static int _udevcookies(int argc __attribute((unused)), char **argv __attribute(
#else /* UDEV_SYNC_SUPPORT */
static int _set_up_udev_support(const char *dev_dir)
{
-#ifdef HAVE_UDEV_QUEUE_GET_UDEV_IS_ACTIVE
struct udev *udev;
const char *udev_dev_dir;
size_t udev_dev_dir_len;
int dirs_diff;
-#endif
const char *env;
if (_switches[NOUDEVSYNC_ARG])
@@ -955,7 +951,6 @@ static int _set_up_udev_support(const char *dev_dir)
" defined by --udevcookie option.",
_udev_cookie);
-#ifdef HAVE_UDEV_QUEUE_GET_UDEV_IS_ACTIVE
if (!(udev = udev_new()) ||
!(udev_dev_dir = udev_get_dev_path(udev)) ||
!*udev_dev_dir) {
@@ -995,7 +990,6 @@ static int _set_up_udev_support(const char *dev_dir)
}
udev_unref(udev);
-#endif
return 1;
}
@@ -1007,7 +1001,8 @@ static int _udevcreatecookie(int argc, char **argv,
if (!dm_udev_create_cookie(&cookie))
return 0;
- printf("0x%08" PRIX32 "\n", cookie);
+ if (cookie)
+ printf("0x%08" PRIX32 "\n", cookie);
return 1;
}