summaryrefslogtreecommitdiff
path: root/extras/multipath
diff options
context:
space:
mode:
authorchristophe.varoqui@free.fr <christophe.varoqui@free.fr>2003-12-10 00:50:25 -0800
committerGreg KH <gregkh@suse.de>2005-04-26 21:13:07 -0700
commit61f76f5c9c12ec612458f515516b71a23b9410dd (patch)
treec8bb46124026283bfc91b68f5f20b1e7479fe285 /extras/multipath
parent4763256c65859b94ac7a309cbb8f772d5426a08d (diff)
[PATCH] more extras/multipath updates
* update the Makefiles to autodetect libgcc.a & gcc includes "ulibc-style". Factorisation of udevdirs & others niceties * drop a hint about absent /dev/sd? on failed open() for poor Debian users who don't imagine their favorite distro with only 16 preconfigured SCSI device nodes :)
Diffstat (limited to 'extras/multipath')
-rw-r--r--extras/multipath/Makefile14
-rw-r--r--extras/multipath/libdevmapper/Makefile9
-rw-r--r--extras/multipath/main.c15
-rw-r--r--extras/multipath/main.h5
4 files changed, 36 insertions, 7 deletions
diff --git a/extras/multipath/Makefile b/extras/multipath/Makefile
index bccf1264f0..89e6f35185 100644
--- a/extras/multipath/Makefile
+++ b/extras/multipath/Makefile
@@ -6,16 +6,22 @@ EXEC = multipath
prefix = /usr/local
exec_prefix = ${prefix}
-bindir = ${exec_prefix}/bin
+bindir = ${exec_prefix}/bin
+udevdir = ../..
+klibcdir = $(udevdir)/klibc
+sysfsdir = $(udevdir)/libsysfs
CC = gcc
-CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc -I../../klibc/klibc/include -I../../klibc/klibc/include/bits32 -I/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include -I../../klibc/linux/include -I../../libsysfs -I.
-LDFLAGS = -lsysfs -ldevmapper -ldlist
+GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
+CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \
+ -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \
+ -I$(GCCINCDIR) -I$(klibcdir)/linux/include -I$(sysfsdir) -I.
OBJS = main.o
CRT0 = ../../klibc/klibc/crt0.o
LIB = ../../klibc/klibc/libc.a
-LIBGCC = /usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/libgcc.a
+LIBGCC := $(shell $(CC) -print-libgcc-file-name )
+
DMOBJS = libdevmapper/libdm-common.o libdevmapper/ioctl/libdevmapper.o
SYSFSOBJS = ../../libsysfs/dlist.o ../../libsysfs/sysfs_bus.o \
../../libsysfs/sysfs_class.o ../../libsysfs/sysfs_device.o \
diff --git a/extras/multipath/libdevmapper/Makefile b/extras/multipath/libdevmapper/Makefile
index 72b39cedf5..b160075416 100644
--- a/extras/multipath/libdevmapper/Makefile
+++ b/extras/multipath/libdevmapper/Makefile
@@ -3,7 +3,14 @@
# Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@free.fr>
CC = gcc
-CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc -I../../../klibc/klibc/include -I../../../klibc/klibc/include/bits32 -I/usr/lib/gcc-lib/i586-mandrake-linux-gnu/3.3.1/include -I../../../klibc/linux/include -I. -Iioctl
+udevdir = ../../..
+klibcdir = $(udevdir)/klibc
+
+CC = gcc
+GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
+CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \
+ -I$(klibcdir)/klibc/include -I$(klibcdir)/klibc/include/bits32 \
+ -I$(GCCINCDIR) -I$(klibcdir)/linux/include -I. -Iioctl
OBJS = ioctl/libdevmapper.o libdm-common.o
diff --git a/extras/multipath/main.c b/extras/multipath/main.c
index bc65899ce1..e62d763252 100644
--- a/extras/multipath/main.c
+++ b/extras/multipath/main.c
@@ -253,6 +253,9 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths)
sprintf(all_paths[k].sg_dev, "/dev/%s", buff);
strcpy(all_paths[k].dev, all_paths[k].sg_dev);
if ((sg_fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) {
+ if (conf->verbose)
+ fprintf(stderr, "can't open %s. mknod ?",
+ all_paths[k].sg_dev);
continue;
}
get_lun_strings(sg_fd, &all_paths[k]);
@@ -285,8 +288,12 @@ get_all_paths_nosysfs(struct env * conf, struct path * all_paths,
sprintf(buff, "%d", k);
strncat(file_name, buff, FILE_NAME_SIZE);
strcpy(all_paths[k].sg_dev, file_name);
- if ((sg_fd = open(file_name, O_RDONLY)) < 0)
+ if ((sg_fd = open(file_name, O_RDONLY)) < 0) {
+ if (conf->verbose)
+ fprintf(stderr, "can't open %s. mknod ?",
+ file_name);
continue;
+ }
get_lun_strings(sg_fd, &all_paths[k]);
get_unique_id(sg_fd, &all_paths[k]);
all_paths[k].state = do_tur(sg_fd);
@@ -340,8 +347,12 @@ get_all_scsi_ids(struct env * conf, struct scsi_dev * all_scsi_ids)
} else
strcat(fname, "xxxx");
- if ((fd = open(fname, O_RDONLY)) < 0)
+ if ((fd = open(fname, O_RDONLY)) < 0) {
+ if (conf->verbose)
+ fprintf(stderr, "can't open %s. mknod ?",
+ fname);
continue;
+ }
res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id);
if (res < 0) {
diff --git a/extras/multipath/main.h b/extras/multipath/main.h
index 692e5e4595..a1de1d8d2d 100644
--- a/extras/multipath/main.h
+++ b/extras/multipath/main.h
@@ -47,6 +47,11 @@
#define MX_ALLOC_LEN 255
#define BLKGETSIZE _IO(0x12,96)
#define DM_TARGET "striped"
+/*
+#define DM_TARGET "multipath"
+#define DM_POLL_INTERVAL 10
+#define DM_PATH_SELECTOR "latency"
+*/
#define PINDEX(x,y) mp[(x)].pindex[(y)]