[PATCH] core/libdevmapper: update to use udev

Michal Soltys soltys at ziu.info
Mon Mar 14 15:55:52 UTC 2011


This delegates node creation to udev. Among other things, the
important advantage of this approach is population of all the related
stuff in /dev/disk/by-* ; relying on udev can also be controlled
through dmsetup's command line

Comments related to this version:

- another minor patch for static build scenario had to be applied;
  hopefully it will be fixed in upstream one day

- example users' file is installed in /etc/udev/rules.d (not active)

- configure is now consistent with lvm2 (they can be trivially merged
  into single package now)

- minor adjustment to .pc

Signed-off-by: Michal Soltys <soltys at ziu.info>
---
 libdevmapper/.footprint                |    9 +++++++++
 libdevmapper/.md5sum                   |    1 +
 libdevmapper/Pkgfile                   |   30 +++++++++++++++++++-----------
 libdevmapper/lvm2-static_udev_rt.patch |   24 ++++++++++++++++++++++++
 4 files changed, 53 insertions(+), 11 deletions(-)
 create mode 100644 libdevmapper/lvm2-static_udev_rt.patch

diff --git a/libdevmapper/.footprint b/libdevmapper/.footprint
index 2de326a..6c9b8aa 100644
--- a/libdevmapper/.footprint
+++ b/libdevmapper/.footprint
@@ -1,5 +1,14 @@
+drwxr-xr-x	root/root	etc/
+drwxr-xr-x	root/root	etc/udev/
+drwxr-xr-x	root/root	etc/udev/rules.d/
+-rw-r--r--	root/root	etc/udev/rules.d/12-dm-permissions.rules.example
 drwxr-xr-x	root/root	lib/
 -r-xr-xr-x	root/root	lib/libdevmapper.so.1.02
+drwxr-xr-x	root/root	lib/udev/
+drwxr-xr-x	root/root	lib/udev/rules.d/
+-r--r--r--	root/root	lib/udev/rules.d/10-dm.rules
+-r--r--r--	root/root	lib/udev/rules.d/13-dm-disk.rules
+-r--r--r--	root/root	lib/udev/rules.d/95-dm-notify.rules
 drwxr-xr-x	root/root	sbin/
 -r-xr-xr-x	root/root	sbin/dmsetup
 -r-xr-xr-x	root/root	sbin/dmsetup.static
diff --git a/libdevmapper/.md5sum b/libdevmapper/.md5sum
index 33e7d83..2e4c6bc 100644
--- a/libdevmapper/.md5sum
+++ b/libdevmapper/.md5sum
@@ -1,2 +1,3 @@
 8b4e0897ee48f02c0dff11940e44e23b  LVM2.2.02.84.tgz
 fe77537669f1aa73c1c4bcfe13036961  lvm2-static_build.patch
+642f6be3c88a78aa2f57c8c46a678995  lvm2-static_udev_rt.patch
diff --git a/libdevmapper/Pkgfile b/libdevmapper/Pkgfile
index 769f2fa..237b002 100644
--- a/libdevmapper/Pkgfile
+++ b/libdevmapper/Pkgfile
@@ -4,26 +4,34 @@
 
 name=libdevmapper
 version=1.02.63
-release=1
+release=2
 source=(ftp://sources.redhat.com/pub/lvm2/releases/LVM2.2.02.84.tgz
-        lvm2-static_build.patch)
+	lvm2-static_udev_rt.patch
+	lvm2-static_build.patch)
 
 build() {
     cd LVM2.2.02.84
 
     patch -p1 -i $SRC/lvm2-static_build.patch
+    patch -p1 -i $SRC/lvm2-static_udev_rt.patch
 
     ./configure --prefix=/usr \
-                --sbindir=/sbin \
-                --libdir=/lib \
-                --datarootdir=/usr \
-                --with-staticdir=/sbin \
-                --with-usrlibdir=/usr/lib \
-                --disable-readline \
-                --enable-pkgconfig \
-                --enable-static_link \
-                --with-{user,group}=root
+		--exec-prefix= \
+		--datarootdir=/usr \
+		--with-udev-prefix= \
+		--disable-readline \
+		--enable-pkgconfig \
+		--enable-static_link \
+		--enable-udev_sync \
+		--enable-udev_rules \
+		--with-{user,group}=root
 
     make device-mapper
     make DESTDIR=$PKG install_device-mapper
+    install -m0644 -D udev/12-dm-permissions.rules $PKG/etc/udev/rules.d/12-dm-permissions.rules.example
+
+    #pkgconfig insists on /lib one or the other way...
+    sed -i '/^libdir=/s|${exec_prefix}|/usr|' $PKG/usr/lib/pkgconfig/devmapper.pc
 }
+
+# vim: sts=4 sw=4 ts=8 noet ft=sh:
diff --git a/libdevmapper/lvm2-static_udev_rt.patch b/libdevmapper/lvm2-static_udev_rt.patch
new file mode 100644
index 0000000..b64f8f0
--- /dev/null
+++ b/libdevmapper/lvm2-static_udev_rt.patch
@@ -0,0 +1,24 @@
+diff -ur LVM2.2.02.84.orig/configure LVM2.2.02.84/configure
+--- LVM2.2.02.84.orig/configure	2011-02-17 13:52:46.028748001 +0100
++++ LVM2.2.02.84/configure	2011-02-19 23:40:55.753991226 +0100
+@@ -8799,7 +8799,7 @@
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_udev_udev_queue_get_udev_is_active" >&5
+ $as_echo "$ac_cv_lib_udev_udev_queue_get_udev_is_active" >&6; }
+ if test "x$ac_cv_lib_udev_udev_queue_get_udev_is_active" = x""yes; then :
+-  UDEV_PC="libudev"; UDEV_LIBS="-ludev"
++  UDEV_PC="libudev"; UDEV_LIBS="-ludev -lrt"
+ else
+   as_fn_error $? "bailing out... libudev library is required" "$LINENO" 5
+ fi
+diff -ur LVM2.2.02.84.orig/configure.in LVM2.2.02.84/configure.in
+--- LVM2.2.02.84.orig/configure.in	2011-02-17 13:52:46.026748001 +0100
++++ LVM2.2.02.84/configure.in	2011-02-19 23:41:42.625996529 +0100
+@@ -804,7 +804,7 @@
+ 
+ if test x$UDEV_SYNC = xyes; then
+ 	AC_CHECK_LIB(udev, udev_queue_get_udev_is_active,
+-		     [UDEV_PC="libudev"; UDEV_LIBS="-ludev"],
++		     [UDEV_PC="libudev"; UDEV_LIBS="-ludev -lrt"],
+ 		     [AC_MSG_ERROR([bailing out... libudev library is required])])
+ 	AC_DEFINE([UDEV_SYNC_SUPPORT], 1, [Define to 1 to enable synchronisation with udev processing.])
+ fi
-- 
1.7.3.5




More information about the CRUX mailing list