diff -urN multipath-0.0.16.2/ChangeLog multipath-0.0.16.3/ChangeLog --- multipath-0.0.16.2/ChangeLog 2004-02-05 15:13:37.000000000 +0100 +++ multipath-0.0.16.3/ChangeLog 2004-02-09 11:26:16.000000000 +0100 @@ -1,4 +1,8 @@ 2004-02-04 multipath-016 + * add devmap_name proggy for udev to name devmaps as per their + internal DM name and not only by their sysfs enum name (dm-*) + The corresponding udev.rules line is : + KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", NAME="%k", SYMLINK="%c" * remove make_dm_node fn & call. Rely on udev for this. * don't rely on the linux symlink in the udev/klibc dir since udev build doesn't use it anymore. This corrects build breakage diff -urN multipath-0.0.16.2/Makefile multipath-0.0.16.3/Makefile --- multipath-0.0.16.2/Makefile 2004-02-05 15:04:53.000000000 +0100 +++ multipath-0.0.16.3/Makefile 2004-02-09 11:21:50.000000000 +0100 @@ -36,29 +36,35 @@ $(MAKE) KERNEL_DIR=$(KERNEL_DIR) -C $$dir ; \ done $(MAKE) $(EXEC) + $(MAKE) devmap_name all: recurse @echo "" @echo "Make complete" - $(EXEC): $(OBJS) $(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC) strip $(EXEC) +devmap_name: devmap_name.o + $(LD) -o devmap_name $(CRT0) devmap_name.o $(DMOBJS) $(LIB) $(LIBGCC) + strip devmap_name + clean: - rm -f core *.o $(EXEC) + rm -f core *.o $(EXEC) devmap_name $(MAKE) -C libdevmapper clean install: install -d $(bindir) install -m 755 $(EXEC) $(bindir)/ + install -m 755 devmap_name $(bindir)/ install -d /etc/hotplug.d/scsi/ install -m 755 multipath.hotplug /etc/hotplug.d/scsi/ uninstall: rm /etc/hotplug.d/scsi/multipath.hotplug rm $(bindir)/$(EXEC) + rm $(bindir)/devmap_name # Code dependencies main.o: main.c main.h sg_include.h diff -urN multipath-0.0.16.2/README multipath-0.0.16.3/README --- multipath-0.0.16.2/README 2004-01-22 01:55:45.000000000 +0100 +++ multipath-0.0.16.3/README 2004-02-09 11:32:31.000000000 +0100 @@ -8,6 +8,8 @@ See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ o Linux kernel 2.6.0 with udm5 patchset http://people.sistina.com/~thornber/dm/ +o udev + See ftp.kernel.org/pub/linux/utils/kernel/hotplug/ How it works : ============== @@ -53,6 +55,12 @@ When mp is filled, the device maps are fed to the kernel through libdevmapper. +The naming of the corresponding block device is handeld +by udev with the help of the devmap_name proggy. It is +called by the following rule in /etc/udev/udev.rules : +KERNEL="dm-[0-9]*", PROGRAM="/sbin/devmap_name %M %m", \ +NAME="%k", SYMLINK="%c" + Notes : ======= diff -urN multipath-0.0.16.2/devmap_name.c multipath-0.0.16.3/devmap_name.c --- multipath-0.0.16.2/devmap_name.c 1970-01-01 01:00:00.000000000 +0100 +++ multipath-0.0.16.3/devmap_name.c 2004-02-09 11:20:14.000000000 +0100 @@ -0,0 +1,60 @@ +#include "libdevmapper/libdevmapper.h" + +#include +#include +#include +#include + +static void usage(char * progname) { + fprintf(stderr, "usage : %s major minor\n", progname); + exit(1); +} + +int main(int argc, char **argv) +{ + int r = 0; + struct dm_names *names; + unsigned next = 0; + int major, minor; + + /* sanity check */ + if (argc != 3) + usage(argv[0]); + + major = atoi(argv[1]); + minor = atoi(argv[2]); + + struct dm_task *dmt; + + if (!(dmt = dm_task_create(DM_DEVICE_LIST))) + return 0; + + if (!dm_task_run(dmt)) + goto out; + + if (!(names = dm_task_get_names(dmt))) + goto out; + + if (!names->dev) { + printf("No devices found\n"); + goto out; + } + + do { + names = (void *) names + next; + if ((int) MAJOR(names->dev) == major && + (int) MINOR(names->dev) == minor) { + printf("%s\n", names->name); + goto out; + } + next = names->next; + } while (next); + + /* No correspondance found */ + r = 1; + + out: + dm_task_destroy(dmt); + return r; +} +