udevdir = ../..
klibcdir = $(udevdir)/klibc
sysfsdir = $(udevdir)/libsysfs
+mandir = /usr/share/man/man8
CC = gcc
+GZIP = /bin/gzip -c
+
GCCINCDIR := ${shell $(CC) -print-search-dirs | sed -ne "s/install: \(.*\)/\1include/gp"}
KERNEL_DIR = /lib/modules/${shell uname -r}/build
CFLAGS = -pipe -g -O2 -Wall -Wunused -Wstrict-prototypes -nostdinc \
$(EXEC): $(OBJS)
$(LD) -o $(EXEC) $(CRT0) $(OBJS) $(SYSFSOBJS) $(DMOBJS) $(LIB) $(LIBGCC)
strip $(EXEC)
+ $(GZIP) $(EXEC).8 > $(EXEC).8.gz
devmap_name: devmap_name.o
$(LD) -o devmap_name $(CRT0) devmap_name.o $(DMOBJS) $(LIB) $(LIBGCC)
strip devmap_name
+ $(GZIP) devmap_name.8 > devmap_name.8.gz
clean:
- rm -f core *.o $(EXEC) devmap_name
+ rm -f core *.o $(EXEC) devmap_name *.gz
$(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/
+ install -d $(DESTDIR)$(bindir)
+ install -m 755 $(EXEC) $(DESTDIR)$(bindir)/
+ install -m 755 devmap_name $(DESTDIR)$(bindir)/
+ install -d $(DESTDIR)/etc/hotplug.d/scsi/
+ install -m 755 multipath.hotplug $(DESTDIR)/etc/hotplug.d/scsi/
+ install -d $(DESTDIR)$(mandir)
+ install -m 644 devmap_name.8.gz $(DESTDIR)$(mandir)
+ install -m 644 multipath.8.gz $(DESTDIR)$(mandir)
uninstall:
- rm /etc/hotplug.d/scsi/multipath.hotplug
- rm $(bindir)/$(EXEC)
- rm $(bindir)/devmap_name
+ rm $(DESTDIR)/etc/hotplug.d/scsi/multipath.hotplug
+ rm $(DESTDIR)$(bindir)/$(EXEC)
+ rm $(DESTDIR)$(bindir)/devmap_name
+ rm $(DESTDIR)$(mandir)/devmap_name.8.gz
+ rm $(DESTDIR)$(mandir)/multipath.8.gz
# Code dependencies
main.o: main.c main.h sg_include.h devinfo.h
#include <linux/kdev_t.h>
#include <string.h>
#include <sys/ioctl.h>
-#include <libsysfs.h>
+#include <sysfs/libsysfs.h>
#include "libdevmapper/libdevmapper.h"
#include "main.h"
#include "devinfo.h"
char path[FILE_NAME_SIZE];
struct path curpath;
- /* if called from hotplug, only consider the paths that relate to */
+ /* if called from hotplug, only consider the paths that relate */
/* to the device pointed by conf.hotplugdev */
memset(empty_buff, 0, WWID_SIZE);
memset(refwwid, 0, WWID_SIZE);
path_count, path_buff);
}
sprintf(str, " %i%s", pg_count, pg_buff);
+ free(bitmap);
}
static int
if (np < 1)
return 0;
- params_p += sprintf(params_p, "%i", conf->dm_path_test_int);
-
if ((all_paths[PINDEX(index,0)].iopolicy == MULTIBUS &&
conf->iopolicy == -1) || conf->iopolicy == MULTIBUS) {
params_p += sprintf(params_p, " 1 %i %s %i %i",
usage(char * progname)
{
fprintf(stderr, VERSION_STRING);
- fprintf(stderr, "Usage: %s [-v|-q] [-d] [-i int] [-m max_devs] ",
+ fprintf(stderr, "Usage: %s [-v|-q] [-d] [-m max_devs]",
progname);
- fprintf(stderr, "[-p failover|multibus|group_by_serial]\n");
+ fprintf(stderr, "[-p failover|multibus|group_by_serial] [device]\n");
fprintf(stderr, "\t-v\t\tverbose, print all paths and multipaths\n");
fprintf(stderr, "\t-q\t\tquiet, no output at all\n");
fprintf(stderr, "\t-d\t\tdry run, do not create or update devmaps\n");
- fprintf(stderr, "\t-i\t\tmultipath target param : polling interval\n");
fprintf(stderr, "\t-m max_devs\tscan {max_devs} devices at most\n");
fprintf(stderr, "\t-p policy\tforce maps to specified policy :\n");
- fprintf(stderr, "\t\t\tfailover\t1 path per priority group\n");
- fprintf(stderr, "\t\t\tmultibus\tall paths in 1 priority group\n");
- fprintf(stderr, "\t\t\tgroup_by_serial\t1 priority group per serial\n");
+ fprintf(stderr, "\t failover\t\t- 1 path per priority group\n");
+ fprintf(stderr, "\t multibus\t\t- all paths in 1 priority group\n");
+ fprintf(stderr, "\t group_by_serial\t- 1 priority group per serial\n");
+ fprintf(stderr, "\tdevice\t\tlimit scope to the device's multipath\n");
+ fprintf(stderr, "\t\t\t(hotplug-style $DEVPATH reference)\n");
exit(1);
}
conf.verbose = 0; /* 1 == Print all_paths and mp */
conf.quiet = 0; /* 1 == Do not even print devmaps */
conf.iopolicy = -1; /* Apply the defaults in get_unique_id() */
- conf.dm_path_test_int = 10;
for (i = 1; i < argc; ++i) {
if (0 == strcmp("-v", argv[i])) {
conf.quiet = 1;
} else if (0 == strcmp("-d", argv[i]))
conf.dry_run = 1;
- else if (0 == strcmp("-i", argv[i]))
- conf.dm_path_test_int = atoi(argv[++i]);
- else if (0 == strcmp("-p", argv[i++])) {
+ else if (0 == strcmp("-p", argv[i])) {
+ i++;
if (!strcmp(argv[i], "failover"))
conf.iopolicy = FAILOVER;
if (!strcmp(argv[i], "multibus"))
conf.iopolicy = MULTIBUS;
if (!strcmp(argv[i], "group_by_serial"))
conf.iopolicy = GROUP_BY_SERIAL;
- } else if (0 == strcmp("scsi", argv[i]))
- strcpy(conf.hotplugdev, argv[++i]);
- else if (*argv[i] == '-') {
+ } else if (*argv[i] == '-') {
fprintf(stderr, "Unknown switch: %s\n", argv[i]);
usage(argv[0]);
- } else if (*argv[i] != '-') {
- fprintf(stderr, "Unknown argument\n");
- usage(argv[0]);
- }
-
+ } else
+ strncpy(conf.hotplugdev, argv[i], FILE_NAME_SIZE);
}
/* dynamic allocations */