Use BuildRequires: systemd-devel instead of libudev-devel.

Also remove unsupported udev_get_dev_path libudev call.
This commit is contained in:
Peter Rajnoha 2012-06-05 15:01:31 +02:00
parent 465b41248d
commit c515b1a9eb
2 changed files with 217 additions and 2 deletions

View File

@ -0,0 +1,202 @@
WHATS_NEW_DM | 4 ++++
lib/commands/toolcontext.c | 28 ++++++++++++++++------------
lib/misc/lvm-wrappers.c | 14 --------------
lib/misc/lvm-wrappers.h | 1 -
libdm/libdevmapper.h | 3 +++
tools/dmsetup.c | 30 ++++++++++++------------------
6 files changed, 35 insertions(+), 45 deletions(-)
diff --git a/WHATS_NEW_DM b/WHATS_NEW_DM
index f159905..a2a0f93 100644
--- a/WHATS_NEW_DM
+++ b/WHATS_NEW_DM
@@ -1,3 +1,7 @@
+Version 1.02.75 -
+================================
+ Remove unsupported udev_get_dev_path libudev call used for checking udev dir.
+
Version 1.02.74 - 6th March 2012
================================
Check for multiply-mangled names in auto mangling mode.
diff --git a/lib/commands/toolcontext.c b/lib/commands/toolcontext.c
index da7285d..4a71690 100644
--- a/lib/commands/toolcontext.c
+++ b/lib/commands/toolcontext.c
@@ -650,9 +650,9 @@ static int _init_dev_cache(struct cmd_context *cmd)
{
const struct dm_config_node *cn;
const struct dm_config_value *cv;
- size_t uninitialized_var(udev_dir_len), len;
+ size_t len, udev_dir_len = strlen(DM_UDEV_DEV_DIR);
+ int len_diff;
int device_list_from_udev;
- const char *uninitialized_var(udev_dir);
init_dev_disable_after_error_count(
find_config_tree_int(cmd, "devices/disable_after_error_count",
@@ -661,13 +661,9 @@ static int _init_dev_cache(struct cmd_context *cmd)
if (!dev_cache_init(cmd))
return_0;
- if ((device_list_from_udev = udev_is_running() ?
+ device_list_from_udev = udev_is_running() ?
find_config_tree_bool(cmd, "devices/obtain_device_list_from_udev",
- DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0)) {
- if (!(udev_dir = udev_get_dev_dir()))
- stack;
- udev_dir_len = (udev_dir) ? strlen(udev_dir) : 0;
- }
+ DEFAULT_OBTAIN_DEVICE_LIST_FROM_UDEV) : 0;
init_obtain_device_list_from_udev(device_list_from_udev);
if (!(cn = find_config_tree_node(cmd, "devices/scan"))) {
@@ -688,11 +684,19 @@ static int _init_dev_cache(struct cmd_context *cmd)
return 0;
}
- if (device_list_from_udev && udev_dir) {
+ if (device_list_from_udev) {
len = strlen(cv->v.str);
- len = udev_dir_len > len ? len : udev_dir_len;
- if (strncmp(udev_dir, cv->v.str, len) ||
- udev_dir[len] != cv->v.str[len]) {
+
+ /*
+ * DM_UDEV_DEV_DIR always has '/' at its end.
+ * If the item in the conf does not have it, be sure
+ * to make the right comparison without the '/' char!
+ */
+ len_diff = len && cv->v.str[len - 1] != '/' ?
+ udev_dir_len - 1 != len :
+ udev_dir_len != len;
+
+ if (len_diff || strncmp(DM_UDEV_DEV_DIR, cv->v.str, len)) {
device_list_from_udev = 0;
init_obtain_device_list_from_udev(0);
}
diff --git a/lib/misc/lvm-wrappers.c b/lib/misc/lvm-wrappers.c
index 84f61a6..6cffae3 100644
--- a/lib/misc/lvm-wrappers.c
+++ b/lib/misc/lvm-wrappers.c
@@ -65,16 +65,6 @@ bad:
return 0;
}
-const char *udev_get_dev_dir(void)
-{
- if (!_udev) {
- log_debug(_no_context_msg);
- return NULL;
- }
-
- return udev_get_dev_path(_udev);
-}
-
struct udev* udev_get_library_context(void)
{
return _udev;
@@ -96,10 +86,6 @@ int udev_is_running(void)
return 0;
}
-const char *udev_get_dev_dir(void)
-{
- return NULL;
-}
#endif
int lvm_getpagesize(void)
diff --git a/lib/misc/lvm-wrappers.h b/lib/misc/lvm-wrappers.h
index f5b381c..e43f831 100644
--- a/lib/misc/lvm-wrappers.h
+++ b/lib/misc/lvm-wrappers.h
@@ -24,7 +24,6 @@ struct udev *udev_get_library_context(void);
int udev_init_library_context(void);
void udev_fin_library_context(void);
int udev_is_running(void);
-const char *udev_get_dev_dir(void);
int lvm_getpagesize(void);
diff --git a/libdm/libdevmapper.h b/libdm/libdevmapper.h
index 7df4db8..1f780a3 100644
--- a/libdm/libdevmapper.h
+++ b/libdm/libdevmapper.h
@@ -1500,6 +1500,9 @@ struct dm_config_node *dm_config_clone_node(struct dm_config_tree *cft, const st
struct dm_pool *dm_config_memory(struct dm_config_tree *cft);
+/* Udev device directory. */
+#define DM_UDEV_DEV_DIR "/dev/"
+
/* Cookie prefixes.
*
* The cookie value consists of a prefix (16 bits) and a base (16 bits).
diff --git a/tools/dmsetup.c b/tools/dmsetup.c
index d293706..4275fc6 100644
--- a/tools/dmsetup.c
+++ b/tools/dmsetup.c
@@ -1008,11 +1008,9 @@ static int _udevcookies(CMD_ARGS)
#else /* UDEV_SYNC_SUPPORT */
static int _set_up_udev_support(const char *dev_dir)
{
- struct udev *udev;
- const char *udev_dev_dir;
- size_t udev_dev_dir_len;
int dirs_diff;
const char *env;
+ size_t len = strlen(dev_dir), udev_dir_len = strlen(DM_UDEV_DEV_DIR);
if (_switches[NOUDEVSYNC_ARG])
dm_udev_set_sync_support(0);
@@ -1030,14 +1028,6 @@ static int _set_up_udev_support(const char *dev_dir)
" defined by --udevcookie option.",
_udev_cookie);
- if (!(udev = udev_new()) ||
- !(udev_dev_dir = udev_get_dev_path(udev)) ||
- !*udev_dev_dir) {
- log_error("Could not get udev dev path.");
- return 0;
- }
- udev_dev_dir_len = strlen(udev_dev_dir);
-
/*
* Normally, there's always a fallback action by libdevmapper if udev
* has not done its job correctly, e.g. the nodes were not created.
@@ -1049,12 +1039,17 @@ static int _set_up_udev_support(const char *dev_dir)
* is the same as "dev path" used by libdevmapper.
*/
- /* There's always a slash at the end of dev_dir. But check udev_dev_dir! */
- if (udev_dev_dir[udev_dev_dir_len - 1] != '/')
- dirs_diff = strncmp(dev_dir, udev_dev_dir, udev_dev_dir_len);
- else
- dirs_diff = strcmp(dev_dir, udev_dev_dir);
+ /*
+ * DM_UDEV_DEV_DIR always has '/' at its end.
+ * If the dev_dir does not have it, be sure
+ * to make the right comparison without the '/' char!
+ */
+ if (dev_dir[len - 1] != '/')
+ udev_dir_len--;
+
+ dirs_diff = udev_dir_len != len ||
+ strncmp(DM_UDEV_DEV_DIR, dev_dir, len);
_udev_only = !dirs_diff && (_udev_cookie || !_switches[VERIFYUDEV_ARG]);
if (dirs_diff) {
@@ -1064,11 +1059,10 @@ static int _set_up_udev_support(const char *dev_dir)
"about udev not working correctly while processing "
"particular nodes will be suppressed. These nodes "
"and symlinks will be managed in each directory "
- "separately.", dev_dir, udev_dev_dir);
+ "separately.", dev_dir, DM_UDEV_DEV_DIR);
dm_udev_set_checking(0);
}
- udev_unref(udev);
return 1;
}

View File

@ -6,6 +6,7 @@
%define enable_cmirror 1
%define enable_udev 1
%define enable_systemd 1
%define udev_systemd_merge 0
%define enable_lvmetad 0
%if "%{fedora}" == "12"
@ -49,10 +50,12 @@
%define udev_version 176-1
%define corosync_version 1.99.9-1
%else
%define udev_version 176-1
# rawhide
%define udev_version 183-1
%define enable_thin 1
%define enable_openais 0
%define corosync_version 1.99.9-1
%define udev_systemd_merge 1
%endif
%endif
%endif
@ -88,7 +91,7 @@
Summary: Userland logical volume management tools
Name: lvm2
Version: 2.02.95
Release: 6%{?dist}
Release: 7%{?dist}
License: GPLv2
Group: System Environment/Base
URL: http://sources.redhat.com/lvm2
@ -96,6 +99,7 @@ Source0: ftp://sources.redhat.com/pub/lvm2/LVM2.%{version}.tgz
Patch0: lvm2-set-default-preferred_names.patch
Patch1: lvm2-2_02_96-detect-lvm-binary-path-in-lvmetad-udev-rules.patch
Patch2: lvm2-2_02_96-use-pvscan-cache-instead-of-vgscan-in-init-scripts.patch
Patch3: lvm2-2_02_96-remove-unsupported-udev_get_dev_path-libudev-call.patch
BuildRequires: libselinux-devel >= 1.30.19-4, libsepol-devel
BuildRequires: ncurses-devel
@ -112,8 +116,12 @@ BuildRequires: dlm-devel >= %{dlm_version}
BuildRequires: module-init-tools
BuildRequires: pkgconfig
%if %{enable_udev}
%if %{udev_systemd_merge}
BuildRequires: systemd-devel
%else
BuildRequires: libudev-devel
%endif
%endif
%if %{enable_systemd}
BuildRequires: systemd-units
%endif
@ -141,6 +149,7 @@ or more physical volumes and creating one or more logical volumes
%patch0 -p1 -b preferred_names
%patch1 -p1 -b .lvm_path
%patch2 -p1 -b .pvscan_cache
%patch3 -p1 -b .libudev_dev_path
%build
%define _exec_prefix ""
@ -689,6 +698,10 @@ the device-mapper event library.
/usr%{_libdir}/pkgconfig/devmapper-event.pc
%changelog
* Tue Jun 05 2012 Peter Rajnoha <prajnoha@redhat.com> - 2.02.95-7
- Use BuildRequires: systemd-devel instead of BuildRequires: libudev-devel.
- Remove unsupported udev_get_dev_path libudev call used for checking udev dir.
* Thu Mar 29 2012 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.02.95-6
- BuildRequires and Requires on newer version of corosync and dlm.
- Restart clvmd on upgrades.