[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:
christophe.varoqui@free.fr 2003-12-10 00:50:25 -08:00 committed by Greg KH
parent 4763256c65
commit 61f76f5c9c
4 changed files with 36 additions and 7 deletions

View File

@ -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 \

View File

@ -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

View File

@ -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) {

View File

@ -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)]