[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 :)
This commit is contained in:
parent
4763256c65
commit
61f76f5c9c
|
@ -6,16 +6,22 @@ EXEC = multipath
|
||||||
|
|
||||||
prefix = /usr/local
|
prefix = /usr/local
|
||||||
exec_prefix = ${prefix}
|
exec_prefix = ${prefix}
|
||||||
bindir = ${exec_prefix}/bin
|
bindir = ${exec_prefix}/bin
|
||||||
|
udevdir = ../..
|
||||||
|
klibcdir = $(udevdir)/klibc
|
||||||
|
sysfsdir = $(udevdir)/libsysfs
|
||||||
|
|
||||||
CC = gcc
|
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.
|
GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
|
||||||
LDFLAGS = -lsysfs -ldevmapper -ldlist
|
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
|
OBJS = main.o
|
||||||
CRT0 = ../../klibc/klibc/crt0.o
|
CRT0 = ../../klibc/klibc/crt0.o
|
||||||
LIB = ../../klibc/klibc/libc.a
|
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
|
DMOBJS = libdevmapper/libdm-common.o libdevmapper/ioctl/libdevmapper.o
|
||||||
SYSFSOBJS = ../../libsysfs/dlist.o ../../libsysfs/sysfs_bus.o \
|
SYSFSOBJS = ../../libsysfs/dlist.o ../../libsysfs/sysfs_bus.o \
|
||||||
../../libsysfs/sysfs_class.o ../../libsysfs/sysfs_device.o \
|
../../libsysfs/sysfs_class.o ../../libsysfs/sysfs_device.o \
|
||||||
|
|
|
@ -3,7 +3,14 @@
|
||||||
# Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@free.fr>
|
# Copyright (C) 2003 Christophe Varoqui, <christophe.varoqui@free.fr>
|
||||||
|
|
||||||
CC = gcc
|
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
|
OBJS = ioctl/libdevmapper.o libdm-common.o
|
||||||
|
|
||||||
|
|
|
@ -253,6 +253,9 @@ get_all_paths_sysfs(struct env * conf, struct path * all_paths)
|
||||||
sprintf(all_paths[k].sg_dev, "/dev/%s", buff);
|
sprintf(all_paths[k].sg_dev, "/dev/%s", buff);
|
||||||
strcpy(all_paths[k].dev, all_paths[k].sg_dev);
|
strcpy(all_paths[k].dev, all_paths[k].sg_dev);
|
||||||
if ((sg_fd = open(all_paths[k].sg_dev, O_RDONLY)) < 0) {
|
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;
|
continue;
|
||||||
}
|
}
|
||||||
get_lun_strings(sg_fd, &all_paths[k]);
|
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);
|
sprintf(buff, "%d", k);
|
||||||
strncat(file_name, buff, FILE_NAME_SIZE);
|
strncat(file_name, buff, FILE_NAME_SIZE);
|
||||||
strcpy(all_paths[k].sg_dev, file_name);
|
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;
|
continue;
|
||||||
|
}
|
||||||
get_lun_strings(sg_fd, &all_paths[k]);
|
get_lun_strings(sg_fd, &all_paths[k]);
|
||||||
get_unique_id(sg_fd, &all_paths[k]);
|
get_unique_id(sg_fd, &all_paths[k]);
|
||||||
all_paths[k].state = do_tur(sg_fd);
|
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
|
} else
|
||||||
strcat(fname, "xxxx");
|
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;
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id);
|
res = ioctl(fd, SCSI_IOCTL_GET_IDLUN, &my_scsi_id);
|
||||||
if (res < 0) {
|
if (res < 0) {
|
||||||
|
|
|
@ -47,6 +47,11 @@
|
||||||
#define MX_ALLOC_LEN 255
|
#define MX_ALLOC_LEN 255
|
||||||
#define BLKGETSIZE _IO(0x12,96)
|
#define BLKGETSIZE _IO(0x12,96)
|
||||||
#define DM_TARGET "striped"
|
#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)]
|
#define PINDEX(x,y) mp[(x)].pindex[(y)]
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue