summaryrefslogtreecommitdiff
path: root/extras/multipath/main.c
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/main.c
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/main.c')
-rw-r--r--extras/multipath/main.c15
1 files changed, 13 insertions, 2 deletions
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) {