[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

rpms/e2fsprogs/devel e2fsprogs-1.38-blkid-devmapper.patch, NONE, 1.1 e2fsprogs.spec, 1.43, 1.44 e2fsprogs-1.38-dm.patch, 1.3, NONE



Author: kzak

Update of /cvs/dist/rpms/e2fsprogs/devel
In directory cvs.devel.redhat.com:/tmp/cvs-serv16715

Modified Files:
	e2fsprogs.spec 
Added Files:
	e2fsprogs-1.38-blkid-devmapper.patch 
Removed Files:
	e2fsprogs-1.38-dm.patch 
Log Message:
improve devmapper patch

e2fsprogs-1.38-blkid-devmapper.patch:
 MCONFIG.in            |    3 
 configure.in          |   30 +++++++++
 e2fsck/Makefile.in    |    2 
 lib/blkid/Makefile.in |    4 -
 lib/blkid/blkid.pc.in |    2 
 lib/blkid/blkidP.h    |    1 
 lib/blkid/devname.c   |  166 ++++++++++++++++++++++++++++++++++++++++++++++++++
 7 files changed, 204 insertions(+), 4 deletions(-)

--- NEW FILE e2fsprogs-1.38-blkid-devmapper.patch ---
--- e2fsprogs-1.38/configure.in.dm	2005-04-06 20:44:15.000000000 +0200
+++ e2fsprogs-1.38/configure.in	2006-01-11 14:50:39.000000000 +0100
@@ -480,6 +480,36 @@
 )
 AC_SUBST(E2INITRD_PROG)
 AC_SUBST(E2INITRD_MAN)
+dnl handle --enable-blkid-devmapper
+dnl
+AC_ARG_ENABLE([blkid-devmapper],
+[  --enable-blkid-devmapper  build with device-mapper support],
+[if test "$enableval" = "no"
+then
+	echo "Disabling device-mapper support"
+	DEVMAPPER_REQ=''
+	DEVMAPPER_LIBS=''
+	STATIC_DEVMAPPER_LIBS=''
+else
+	AC_DEFINE(HAVE_DEVMAPPER)
+	echo "Enabling device-mapper support"
+
+	PKG_PROG_PKG_CONFIG()
+
+	AC_CHECK_LIB(devmapper, dm_tree_create,
+        	[DEVMAPPER_LIBS=`$PKG_CONFIG --libs devmapper`; 
+		 STATIC_DEVMAPPER_LIBS=`$PKG_CONFIG --static --libs devmapper`;
+		 DEVMAPPER_REQ="devmapper"],
+	        [AC_MSG_ERROR([device-mapper library not found])],
+        	[$DEVMAPPER_LIBS])
+fi]
+,
+echo "Disabling device-mapper support by default"
+)
+AC_SUBST(DEVMAPPER_REQ)
+AC_SUBST(DEVMAPPER_LIBS)
+AC_SUBST(STATIC_DEVMAPPER_LIBS)
+dnl
 dnl
 dnl
 MAKEFILE_LIBRARY=$srcdir/lib/Makefile.library
--- e2fsprogs-1.38/MCONFIG.in.dm	2006-01-11 14:02:41.000000000 +0100
+++ e2fsprogs-1.38/MCONFIG.in	2006-01-11 14:03:18.000000000 +0100
@@ -74,6 +74,9 @@
 LIBINTL = @LIBINTL@
 DEPLIBUUID = $(LIB)/libuuid LIB_EXT@
 
+DEVMAPPER_LIBS = @DEVMAPPER_LIBS@
+STATIC_DEVMAPPER_LIBS = @STATIC_DEVMAPPER_LIBS@
+
 STATIC_LIBSS = $(LIB)/libss STATIC_LIB_EXT@
 STATIC_LIBCOM_ERR = $(LIB)/libcom_err STATIC_LIB_EXT@
 STATIC_LIBE2P = $(LIB)/libe2p STATIC_LIB_EXT@
--- e2fsprogs-1.38/lib/blkid/blkid.pc.in.dm	2006-01-11 13:25:32.000000000 +0100
+++ e2fsprogs-1.38/lib/blkid/blkid.pc.in	2006-01-11 14:48:57.000000000 +0100
@@ -6,6 +6,6 @@
 Name: blkid
 Description: Block device id library
 Version: @E2FSPROGS_VERSION@
-Requires: uuid
+Requires: uuid @DEVMAPPER_REQ@
 Cflags: -I${includedir} 
 Libs: -L${libdir} -lblkid
--- e2fsprogs-1.38/lib/blkid/Makefile.in.dm	2005-06-29 19:39:54.000000000 +0200
+++ e2fsprogs-1.38/lib/blkid/Makefile.in	2006-01-11 14:10:44.000000000 +0100
@@ -37,7 +37,7 @@
 ELF_IMAGE = libblkid
 ELF_MYDIR = blkid
 ELF_INSTALL_DIR = $(root_libdir)
-ELF_OTHER_LIBS = -L../.. -luuid
+ELF_OTHER_LIBS = -L../.. -luuid $(DEVMAPPER_LIBS)
 
 BSDLIB_VERSION = 2.0
 BSDLIB_IMAGE = libblkid
@@ -50,7 +50,7 @@
 @MAKEFILE_PROFILE@
 @MAKEFILE_CHECKER@
 
-LIBS_BLKID=	$(STATIC_LIBBLKID) $(STATIC_LIBUUID)
+LIBS_BLKID=	$(STATIC_LIBBLKID) $(STATIC_LIBUUID) $(DEVMAPPER_LIBS)
 DEPLIBS_BLKID=	$(DEPSTATIC_LIBBLKID) $(DEPSTATIC_LIBUUID)
 
 .c.o:
--- e2fsprogs-1.38/lib/blkid/devname.c.dm	2005-05-07 21:26:03.000000000 +0200
+++ e2fsprogs-1.38/lib/blkid/devname.c	2006-01-11 14:29:47.000000000 +0100
@@ -11,6 +11,8 @@
  * %End-Header%
  */
 
+#define _GNU_SOURCE 1
+
 #include <stdio.h>
 #include <string.h>
 #if HAVE_UNISTD_H
@@ -35,6 +37,10 @@
 
 #include "blkidP.h"
 
+#ifdef HAVE_DEVMAPPER
+#include <libdevmapper.h>
+#endif
+
 /*
  * Find a dev struct in the cache by device name, if available.
  *
@@ -75,6 +81,10 @@
 	return dev;
 }
 
+#ifdef HAVE_DEVMAPPER
+static int dm_device_is_leaf(const dev_t dev);
+#endif
+
 /*
  * Probe a single block device to add to the device cache.
  */
@@ -90,6 +100,10 @@
 	list_for_each(p, &cache->bic_devs) {
 		blkid_dev tmp = list_entry(p, struct blkid_struct_dev,
 					   bid_devs);
+#ifdef HAVE_DEVMAPPER
+		if (!dm_device_is_leaf(devno))
+			continue;
+#endif
 		if (tmp->bid_devno == devno) {
 			if (only_if_new)
 				return;
@@ -137,6 +151,155 @@
 	return;
 }
 
+#ifdef HAVE_DEVMAPPER
+/* 
+ * device-mapper support 
+ */
+static int dm_device_has_dep(const dev_t dev, const char *name)
+{
+	struct dm_task *task;
+	struct dm_deps *deps;
+	struct dm_info info;
+	int i;
+
+	task = dm_task_create(DM_DEVICE_DEPS);
+	if (!task)
+		return 0;
+
+	dm_task_set_name(task, name);
+	dm_task_run(task);
+	dm_task_get_info(task, &info);
+
+	if (!info.exists) {
+		dm_task_destroy(task);
+		return 0;
+	}
+
+	deps = dm_task_get_deps(task);
+	if (!deps || deps->count == 0) {
+		dm_task_destroy(task);
+		return 0;
+	}
+
+	for (i = 0; i < deps->count; i++) {
+		dev_t dep_dev = deps->device[i];
+
+		if (dev == dep_dev) {
+			dm_task_destroy(task);
+			return 1;
+		}
+	}
+
+	dm_task_destroy(task);
+	return 0;
+}
+
+static int dm_device_is_leaf(const dev_t dev)
+{
+	struct dm_task *task;
+	struct dm_names *names;
+	unsigned int next = 0;
+	int n, ret = 1;
+
+	task = dm_task_create(DM_DEVICE_LIST);
+	if (!task)
+		return 1;
+
+	dm_task_run(task);
+	names = dm_task_get_names(task);
+	if (!names || !names->dev) {
+		dm_task_destroy(task);
+		return 1;
+	}
+
+	n = 0;
+	do {
+		names = (void *)names + next;
+
+		if (dm_device_has_dep(dev, names->name))
+			ret = 0;
+
+		next = names->next;
+	} while (next);
+
+	dm_task_destroy(task);
+
+	return ret;
+}
+
+static dev_t dm_get_devno(const char *name)
+{
+	struct dm_task *task;
+	struct dm_info info;
+	dev_t ret = 0;
+
+	task = dm_task_create(DM_DEVICE_INFO);
+	if (!task)
+		return ret;
+
+	dm_task_set_name(task, name);
+	dm_task_run(task);
+	dm_task_get_info(task, &info);
+
+	if (!info.exists) {
+		dm_task_destroy(task);
+		return ret;
+	}
+
+	ret = makedev(info.major, info.minor);
+
+	dm_task_destroy(task);
+	
+	return ret;
+}
+
+static void dm_probe_all(blkid_cache cache, int only_if_new)
+{
+	struct dm_task *task;
+	struct dm_names *names;
+	unsigned int next = 0;
+	int n;
+
+	task = dm_task_create(DM_DEVICE_LIST);
+	if (!task)
+		return;
+
+	dm_task_run(task);
+	names = dm_task_get_names(task);
+	if (!names || !names->dev) {
+		dm_task_destroy(task);
+		return;
+	}
+
+	n = 0;
+	do {
+		int rc;
+		char *device = NULL;
+		dev_t dev = 0;
+
+		names = (void *)names + next;
+
+		rc = asprintf(&device, "/dev/mapper/%s", names->name);
+		if (rc < 0)
+			goto try_next;
+
+		dev = dm_get_devno(names->name);
+		if (dev == 0)
+			goto try_next;
+
+		if (!dm_device_is_leaf(dev)) 
+			goto try_next;
+
+		probe_one(cache, device, dev, BLKID_PRI_DM, only_if_new);
+
+try_next:
+		next = names->next;
+	} while (next);
+
+	dm_task_destroy(task);
+}
+#endif /* HAVE_DEVMAPPER */
+
 #define PROC_PARTITIONS "/proc/partitions"
 #define VG_DIR		"/proc/lvm/VGs"
 
@@ -290,6 +453,9 @@
 		return 0;
 
 	blkid_read_cache(cache);
+#ifdef HAVE_DEVMAPPER
+	dm_probe_all(cache, only_if_new);
+#endif
 	evms_probe_all(cache, only_if_new);
 #ifdef VG_DIR
 	lvm_probe_all(cache, only_if_new);
--- e2fsprogs-1.38/lib/blkid/blkidP.h.dm	2005-05-07 20:16:09.000000000 +0200
+++ e2fsprogs-1.38/lib/blkid/blkidP.h	2006-01-11 13:24:54.000000000 +0100
@@ -118,6 +118,7 @@
 /*
  * Priority settings for different types of devices
  */
+#define BLKID_PRI_DM	40
 #define BLKID_PRI_EVMS	30
 #define BLKID_PRI_LVM	20
 #define BLKID_PRI_MD	10
--- e2fsprogs-1.38/e2fsck/Makefile.in.dm	2005-06-29 19:42:20.000000000 +0200
+++ e2fsprogs-1.38/e2fsck/Makefile.in	2006-01-11 14:04:35.000000000 +0100
@@ -20,7 +20,7 @@
 DEPLIBS= $(LIBEXT2FS) $(LIBCOM_ERR) $(LIBBLKID) $(DEPLIBUUID)
 
 STATIC_LIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(STATIC_LIBBLKID) \
-	$(STATIC_LIBUUID) $(LIBINTL)
+	$(STATIC_LIBUUID) $(LIBINTL) $(STATIC_DEVMAPPER_LIBS)
 STATIC_DEPLIBS= $(STATIC_LIBEXT2FS) $(STATIC_LIBCOM_ERR) $(STATIC_LIBBLKID) \
 	$(DEPSTATIC_LIBUUID)
 


Index: e2fsprogs.spec
===================================================================
RCS file: /cvs/dist/rpms/e2fsprogs/devel/e2fsprogs.spec,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -r1.43 -r1.44
--- e2fsprogs.spec	9 Jan 2006 22:43:20 -0000	1.43
+++ e2fsprogs.spec	11 Jan 2006 15:41:36 -0000	1.44
@@ -4,7 +4,7 @@
 Summary: Utilities for managing the second extended (ext2) filesystem.
 Name: e2fsprogs
 Version: 1.38
-Release: 5
+Release: 6
 License: GPL
 Group: System Environment/Base
 Source:  ftp://download.sourceforge.net/pub/sourceforge/e2fsprogs/e2fsprogs-%{version}.tar.gz
@@ -26,11 +26,12 @@
 Patch31: e2fsprogs-1.38-man_no_ext2resize.patch
 Patch32: e2fsprogs-1.38-no_pottcdate.patch
 Patch33: e2fsprogs-1.38-lost+found.patch
-Patch34: e2fsprogs-1.38-dm.patch
+Patch34: e2fsprogs-1.38-blkid-devmapper.patch
 Url: http://e2fsprogs.sourceforge.net/
 BuildRoot: %{_tmppath}/%{name}-root
 Requires: e2fsprogs-libs = %{version}-%{release}, device-mapper
-BuildRequires: gettext, texinfo, autoconf, automake, device-mapper, libselinux-devel, libsepol-devel
+BuildRequires: gettext, texinfo, autoconf, automake, libselinux-devel, libsepol-devel
+BuildRequires: device-mapper >= 1.02.02-3
 
 %define ext2resize_basever 1.1.17
 %define ext2resize_name ext2resize-%{ext2resize_basever}
@@ -119,7 +120,9 @@
 %patch34 -p1 -b .dm
 
 %build
-%configure --enable-elf-shlibs --enable-nls --disable-e2initrd-helper
+aclocal
+autoconf
+%configure --enable-elf-shlibs --enable-nls --disable-e2initrd-helper  --enable-blkid-devmapper
 # --enable-dynamic-e2fsck
 make -C po update-po
 make
@@ -293,6 +296,10 @@
 %{_mandir}/man3/uuid_unparse.3*
 
 %changelog
+* Wed Jan 11 2006 Karel Zak <kzak redhat com> 1.38-6
+- cleanup device-mapper patch
+- use pkg-config for device-mapper
+
 * Mon Jan  9 2006 Peter Jones <pjones redhat com> 1.38-5
 - fix some more minor logic errors in dm probing
 


--- e2fsprogs-1.38-dm.patch DELETED ---


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]