From 11875969cd58118fd2cf3191c1fa288034547270 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kai=20M=C3=A4kisara?= Date: Tue, 13 Apr 2004 21:26:24 +0200 Subject: [PATCH] Backdated import of mt-st version 0.8 This is an import of the mt-st upstream release 0.8 as it appeared in the Debian archives. --- Makefile | 6 ++- README | 19 +++++--- README.stinit | 8 +++- mt-st-0.7.lsm | 16 ------- mt-st-0.8.lsm | 16 +++++++ mt.1 | 36 +++++++++------ mt.c | 30 ++++++++----- stinit.8 | 26 +++++++---- stinit.c | 121 +++++++++++++++++++++++++++++++------------------- 9 files changed, 177 insertions(+), 101 deletions(-) delete mode 100644 mt-st-0.7.lsm create mode 100644 mt-st-0.8.lsm diff --git a/Makefile b/Makefile index 1501762..e540e8d 100644 --- a/Makefile +++ b/Makefile @@ -1,7 +1,7 @@ CFLAGS= -Wall -O2 SBINDIR= /sbin BINDIR= /bin -MANDIR= /usr/man +MANDIR= /usr/share/man all: mt stinit @@ -14,8 +14,12 @@ stinit: stinit.c install: mt stinit install -s mt $(BINDIR) install -c -m 444 mt.1 $(MANDIR)/man1 + (if [ -f $(MANDIR)/man1/mt.1.gz ] ; then \ + rm -f $(MANDIR)/man1/mt.1.gz; gzip $(MANDIR)/man1/mt.1; fi) install -s stinit $(SBINDIR) install -c -m 444 stinit.8 $(MANDIR)/man8 + (if [ -f $(MANDIR)/man8/stinit.8.gz ] ; then \ + rm -f $(MANDIR)/man8/stinit.8.gz; gzip $(MANDIR)/man8/stinit.8; fi) dist: clean (mydir=`basename \`pwd\``;\ diff --git a/README b/README index c33092e..6ef6554 100644 --- a/README +++ b/README @@ -1,10 +1,11 @@ This directory contains two programs; mt and stinit. Mt is basically a "standard" mt with additional commands to send the ioctls specific -to the Linux SCSI tape driver. The source supports all ioctls up to -kernel version 2.4.0 but it can also be compiled in kernels >= 2.0.x -(and hopefully with 1.2.x). Although this mt program is tailored for -SCSI tapes, it can also be used with other Linux tape drivers using the -same ioctls (some of the commands may not work with all drivers). +to the Linux SCSI tape driver. The source supports all SCSI tape +ioctls up to kernel version 2.6.0 but it can also be compiled in +kernels >= 2.0.x (and hopefully with 1.2.x). Although this mt program +is tailored for SCSI tapes, it can also be used with other Linux tape +drivers using the same ioctls (some of the commands may not work with +all drivers). Stinit is a program to initialize the tape drive characteristics. The current version should be considered alpha. See README.stinit for more @@ -28,6 +29,12 @@ Installation: - make - make install +Changes in version 0.8: +- put man page into /usr/share/man/man1 +- documentation cleanup +- add some density translations +- counts can use the k, M, or G postfix + Changes in version 0.7: - add command eject for compatibility with GNU mt (synonym for offline and rewoffl) @@ -80,4 +87,4 @@ Changes in version 0.3: by the command compression using a new ioctl) - bus fixes -November 8, 2001 Kai Makisara (email Kai.Makisara@metla.fi) +April 13, 2004 Kai Makisara (email Kai.Makisara@kolumbus.fi) diff --git a/README.stinit b/README.stinit index 957a369..c187557 100644 --- a/README.stinit +++ b/README.stinit @@ -31,6 +31,12 @@ stinit.def.examples - a file containing example definitions for Makefile - a sample makefile for the program README.stinit - this file +Changes in version 0.8: +- in devfs, /dev/tapes/tape does not match th drive after rmmoding + and insmodding the st driver; fix provided by Philippe Troin +- put the man page into /usr/share/man/man8 +- counts can use the k, M, or G postfix + Changes in version 0.7: - the directory scanning for tape devices is restricted to files with certain names in some directories to avoid triggering automatic @@ -47,5 +53,5 @@ Changes in version 0.6: Initial version 0.5. -November 8, 2001 Kai Mäkisara +April 13, 2004 Kai Mäkisara diff --git a/mt-st-0.7.lsm b/mt-st-0.7.lsm deleted file mode 100644 index c52f8f9..0000000 --- a/mt-st-0.7.lsm +++ /dev/null @@ -1,16 +0,0 @@ -Begin4 -Title: mt-st -Version: 0.7 -Entered-date: 2001-11-21 -Description: Includes a mt-like program supporting additional -commands using ioctls specific to the Linux SCSI tape driver (up -to kernel 2.4.15), and the program stinit to define the SCSI tape -devices in system startup scripts. -Keywords: tape SCSI -Author: Kai.Makisara@metla.fi (Kai Makisara) -Maintained-by: Kai.Makisara@metla.fi (Kai Makisara) -Primary-site: ftp.ibiblio.org /pub/Linux/system/backup - 35 kB mt-st-0.7.tar.gz - 0.7 kB mt-st-0.7.lsm -Copying-policy: GPL -End diff --git a/mt-st-0.8.lsm b/mt-st-0.8.lsm new file mode 100644 index 0000000..4138bbf --- /dev/null +++ b/mt-st-0.8.lsm @@ -0,0 +1,16 @@ +Begin4 +Title: mt-st +Version: 0.8 +Entered-date: 2004-04-13 +Description: Magnetic tape control tools for Linux SCSI tapes. +Includes a mt-like program supporting additional commands using ioctls +specific to the Linux SCSI tape driver (up to kernel 2.6.5), and the program +stinit to define the SCSI tape devices in system startup scripts. +Keywords: tape SCSI +Author: Kai.Makisara@kolumbus.fi (Kai Makisara) +Maintained-by: Kai.Makisara@kolumbus.fi (Kai Makisara) +Primary-site: ftp://ftp.ibiblio.org/pub/linux/system/backup + 35 kB mt-st-0.8.tar.gz + 0.7 kB mt-st-0.8.lsm +Copying-policy: GPL +End diff --git a/mt.1 b/mt.1 index 7fdb13b..dfd10cc 100644 --- a/mt.1 +++ b/mt.1 @@ -1,4 +1,4 @@ -.TH MT 1 "November 2001" \" -*- nroff -*- +.TH MT 1 "April 2004" \" -*- nroff -*- .SH NAME mt \- control magnetic tape drive operation .SH SYNOPSIS @@ -17,7 +17,7 @@ option. The version of mt is printed with the .I \-v or .I \-\-version -option. The path of the tape device to operate on can be given with +option. The path of the tape device on which to operate can be given with the .I \-f or @@ -30,7 +30,14 @@ is set, it is used. Otherwise, a default device defined in the file is used. .PP Some operations optionally take an argument or repeat count, which can be given -after the operation name and defaults to 1. +after the operation name and defaults to 1. The postfix +.I k +, +.I M +, or +.I G +can be used to give counts in units of 1024, 1024 * 1024, or 1024 * +1024 * 1024, respectively. .PP The available operations are listed below. Unique abbreviations are accepted. Not all operations are available on all systems, or work on @@ -80,7 +87,7 @@ setmarks. setmarks. .IP "eod, seod" Space to end of valid data. Used on streamer tape -drives to append data to the logical and of tape. +drives to append data to the logical end of tape. .IP rewind Rewind the tape. .IP "offline, rewoffl, eject" @@ -159,7 +166,7 @@ standard output. .I number. The proper value for unbuffered operation is zero and "normal" buffered operation one. The meanings of other values can be found in the drive -documentation or, in case of a SCSI-2 drive, from the SCSI-2 standard. +documentation or, in the case of a SCSI-2 drive, from the SCSI-2 standard. .IP compression (SCSI tapes) The compression within the drive can be switched on or off using the MTCOMPRESSION ioctl. Note that this method is not @@ -168,7 +175,7 @@ Exabyte 8 mm drives use density codes to select compression. .IP stoptions (SCSI tapes) Set the driver options bits for the device to the defined values. Allowed only for the superuser. The bits can be set -either by oring the option bits from the file /usr/include/linux/mtio.h to +either by ORing the option bits from the file /usr/include/linux/mtio.h to .I count, or by using the following keywords (as many keywords can be used on the same line as necessary, unambiguous abbreviations allowed): @@ -192,7 +199,7 @@ automatically lock/unlock drive door .IP def-writes the block size and density are for writes .IP can-bsr -drive can space backwards well +drive can space backwards as well .IP no-blklimits drive doesn't support read block limits .IP can-partitions @@ -204,12 +211,15 @@ dependent addresses enable the System V semantics .RE .IP stsetoptions -(SCSI tapes) Set selected driver options bits. The methods to specify -the bits to set are given above in description of stoptions. +(SCSI tapes) Set selected driver options bits. +The methods to specify the bits to set are given above in the +description of +.BR stoptions. Allowed only for the superuser. .IP stclearoptions -(SCSI tapes) Clear selected driver option bits. The methods to specify -the bits to clear are given above in description of stoptions. +(SCSI tapes) Clear selected driver option bits. +The methods to specify the bits to clear are given above in description of +.BR stoptions. Allowed only for the superuser. .IP stwrthreshold (SCSI tapes) The write threshold for the tape device is set to @@ -256,9 +266,9 @@ exits with a status of 0 if the operation succeeded, 1 if the operation or device name given was invalid, or 2 if the operation failed. .SH AUTHOR -The program is written by Kai Makisara . +The program is written by Kai Makisara . .SH COPYRIGHT -The program and the manual page are copyrighted by Kai Makisara, 1998-2001. +The program and the manual page are copyrighted by Kai Makisara, 1998-2004. They can be distributed according to the GNU Copyleft. .SH SEE ALSO st(4) diff --git a/mt.c b/mt.c index 1af6c67..34346a8 100644 --- a/mt.c +++ b/mt.c @@ -4,17 +4,13 @@ supports several commands designed for use with the Linux SCSI tape drive. - Maintained by Kai Mäkisara (email Kai.Makisara@metla.fi) - Copyright by Kai Mäkisara, 1998 - 2001. The program may be distributed + Maintained by Kai Mäkisara (email Kai.Makisara@kolumbus.fi) + Copyright by Kai Mäkisara, 1998 - 2004. The program may be distributed according to the GNU Public License - Last Modified: Wed Nov 21 23:14:29 2001 by makisara@kai.makisara.local + Last Modified: Tue Apr 13 21:26:24 2004 by makisara */ -#ifndef lint -static char rcsid[] = "$Id: /home/makisara/src/sys/mt-st-0.7/mt.c at Wed Nov 21 23:14:29 2001 by makisara@kai.makisara.local$"; -#endif - #include #include #include @@ -31,7 +27,7 @@ static char rcsid[] = "$Id: /home/makisara/src/sys/mt-st-0.7/mt.c at Wed Nov 21 #define DEFTAPE "/dev/tape" /* default tape device */ #endif /* DEFTAPE */ -#define VERSION "0.7" +#define VERSION "0.8" typedef int (* cmdfunc)(/* int, struct cmdef_tr *, int, char ** */); @@ -214,6 +210,7 @@ static struct densities { {0x29, "QIC-3080MC"}, {0x30, "AIT-1 or MLR3"}, {0x31, "AIT-2"}, + {0x32, "AIT-3"}, {0x33, "SLR6"}, {0x34, "SLR100"}, {0x40, "DLT1 40 GB, or Ultrium"}, @@ -231,7 +228,10 @@ static struct densities { {0x88, "DLT 40GB uncompressed"}, {0x89, "DLT 40GB compressed"}, {0x8c, "EXB-8505 compressed"}, - {0x90, "EXB-8205 compressed"} + {0x90, "SDLT110 uncompr/EXB-8205 compr"}, + {0x91, "SDLT110 compressed"}, + {0x92, "SDLT160 uncompressed"}, + {0x93, "SDLT160 comprssed"} }; #define NBR_DENSITIES (sizeof(density_tbl) / sizeof(struct densities)) @@ -257,6 +257,7 @@ static struct booleans { #ifdef MT_ST_SYSV {"sysv", MT_ST_SYSV, "enable the SystemV semantics"}, #endif + {"cleaning", MT_ST_SET_CLN, "set the cleaning bit location and mask"}, {NULL, 0}}; static char *tape_name; /* The tape name for messages */ @@ -407,9 +408,18 @@ usage(int explain) do_standard(int mtfd, cmdef_tr *cmd, int argc, char **argv) { struct mtop mt_com; + char *endp; mt_com.mt_op = cmd->cmd_code; - mt_com.mt_count = (argc > 0 ? strtol(*argv, NULL, 0) : 1); + mt_com.mt_count = (argc > 0 ? strtol(*argv, &endp, 0) : 1); + if (argc > 0 && endp != *argv) { + if (*endp == 'k') + mt_com.mt_count *= 1024; + else if (*endp == 'M') + mt_com.mt_count *= 1024 * 1024; + else if (*endp == 'G') + mt_com.mt_count *= 1024 * 1024 * 1024; + } mt_com.mt_count |= cmd->cmd_count_bits; if (mt_com.mt_count < 0) { fprintf(stderr, "mt: negative repeat count\n"); diff --git a/stinit.8 b/stinit.8 index 4a428af..8a9d75e 100644 --- a/stinit.8 +++ b/stinit.8 @@ -1,4 +1,4 @@ -.TH STINIT 8 "November 2001" \" -*- nroff -*- +.TH STINIT 8 "April 2004" \" -*- nroff -*- .SH NAME stinit \- initialize SCSI magnetic tape drives .SH SYNOPSIS @@ -13,7 +13,7 @@ to the SCSI subsystem at run-time. The initialization is performed by sending ioctl commands to the drive. The commands are defined in a text file that is indexed using the inquiry data the drive returns (manufacturer, device, revision). Values for all of the general and -mode-specific SCSI tape parameters up to Linux version 2.4.15 can be +mode-specific SCSI tape parameters up to Linux version 2.6.0 can be initialized. .PP .SH OPTIONS @@ -87,7 +87,13 @@ parameter definition block. The drive descriptions and the parameter definitions consist of pairs .I name = value. The value is either a numeric parameter, a string not containing -blanks, or a quoted string. If the +blanks, or a quoted string. In case of a numeric parameter, the +postfix +.I k +or +.I M +can be used to give the value in units of 1024 or 1024 * 1024, +respectively. If the .I =value -part is omitted, the value .I @@ -108,7 +114,7 @@ can-bsr can-partitions auto-lock mode1 blocksize=0 compression=1 mode2 blocksize=1024 compression=1 mode3 blocksize=0 compression=0 -mode4 blocksize = 1024 compression=0 } +mode4 blocksize = 1k compression=0 } .fi .RE .PP @@ -235,11 +241,15 @@ are forced when writing starts at the beginning of a tape if is non-zero. The default is to change there parameters each time the device is opened at the beginning of a tape (or the mode is changed in the middle of a tape). -.IP timeout +.IP sysv=value +The System V tape semantics are used if +.I value +is non-zero. Otherwise the BSD semantics are used. +.IP timeout=value The normal timeout for the device is set to .I value seconds. -.IP long-time[out] +.IP long-time[out]=value The long timeout for the device is set to .I value seconds. @@ -254,9 +264,9 @@ With the exception of the -p option, the program can be used only by the superuser. This is because the program uses ioctls allowed only for the superuser. .SH AUTHOR -The program is written by Kai Makisara . +The program is written by Kai Makisara . .SH COPYRIGHT -The program and the manual page are copyrighted by Kai Makisara, 1998-2001. +The program and the manual page are copyrighted by Kai Makisara, 1998-2004. They can be distributed according to the GNU Copyleft. .SH SEE ALSO st(4) mt(1) diff --git a/stinit.c b/stinit.c index 163a337..8907ad5 100644 --- a/stinit.c +++ b/stinit.c @@ -1,17 +1,13 @@ /* This program initializes Linux SCSI tape drives using the inquiry data from the devices and a text database. - Copyright 1996-2001 by Kai Mäkisara (email Kai.Makisara@metla.fi) + Copyright 1996-2004 by Kai Mäkisara (email Kai.Makisara@kolumbus.fi) Distribution of this program is allowed according to the GNU Public Licence. - Last modified: Thu Nov 8 21:13:48 2001 by makisara@kai.makisara.local + Last modified: Tue Apr 13 21:26:42 2004 by makisara */ -#ifndef lint -static char rcsid[] = "$Id: /usr2/users/makisara/src/sys/mt-st-0.7/stinit.c at Thu Nov 8 21:13:48 2001 by makisara@kai.makisara.local$"; -#endif - #include #include #include @@ -33,7 +29,7 @@ static char rcsid[] = "$Id: /usr2/users/makisara/src/sys/mt-st-0.7/stinit.c at T #endif #define SKIP_WHITE(p) for ( ; *p == ' ' || *p == '\t'; p++) -#define VERSION "0.7" +#define VERSION "0.8" typedef struct _modepar_tr { int defined; @@ -77,10 +73,10 @@ static int verbose = 0; /* The device directories being searched */ typedef struct { - const char *dir; + char dir[PATH_MAX]; int selective_scan; } devdir; -static devdir devdirs[] = { {"/dev/scsi", 0}, {"/dev", 1}, {NULL, 0}}; +static devdir devdirs[] = { {"/dev/scsi", 0}, {"/dev", 1}, {"", 0}}; #define DEVFS_PATH "/dev/tapes" #define DEVFS_TAPEFMT DEVFS_PATH "/tape%d" @@ -192,6 +188,24 @@ find_string(char *s, char *target, char *buf, int buflen) return NULL; } + + static int +num_arg(char *t) +{ + int nbr; + char *tt; + + nbr = strtol(t, &tt, 0); + if (t != tt) { + if (*tt == 'k') + nbr *= 1024; + else if (*tt == 'M') + nbr *= 1024 * 1024; + } + return nbr; +} + + static int next_block(FILE *dbf, char *buf, int buflen, int limiter) { @@ -346,47 +360,47 @@ find_pars(FILE *dbf, char *company, char *product, char *rev, devdef_tr *defs, } if ((t = find_string(defstr, "drive-", line, LINEMAX)) != NULL) - defs->drive_buffering = strtol(t, NULL, 0); + defs->drive_buffering = num_arg(t); if ((t = find_string(defstr, "timeout", line, LINEMAX)) != NULL) - defs->timeout = strtol(t, NULL, 0); + defs->timeout = num_arg(t); if ((t = find_string(defstr, "long-time", line, LINEMAX)) != NULL) - defs->long_timeout = strtol(t, NULL, 0); + defs->long_timeout = num_arg(t); if ((t = find_string(defstr, "clean", line, LINEMAX)) != NULL) - defs->cleaning = strtol(t, NULL, 0); + defs->cleaning = num_arg(t); if ((t = find_string(defstr, "no-w", line, LINEMAX)) != NULL) - defs->nowait = strtol(t, NULL, 0); + defs->nowait = num_arg(t); defs->modedefs[mode].defined = TRUE; if ((t = find_string(defstr, "block", line, LINEMAX)) != NULL) - defs->modedefs[mode].blocksize = strtol(t, NULL, 0); + defs->modedefs[mode].blocksize = num_arg(t); if ((t = find_string(defstr, "dens", line, LINEMAX)) != NULL) - defs->modedefs[mode].density = strtol(t, NULL, 0); + defs->modedefs[mode].density = num_arg(t); if ((t = find_string(defstr, "buff", line, LINEMAX)) != NULL) - defs->modedefs[mode].buffer_writes = strtol(t, NULL, 0); + defs->modedefs[mode].buffer_writes = num_arg(t); if ((t = find_string(defstr, "async", line, LINEMAX)) != NULL) - defs->modedefs[mode].async_writes = strtol(t, NULL, 0); + defs->modedefs[mode].async_writes = num_arg(t); if ((t = find_string(defstr, "read", line, LINEMAX)) != NULL) - defs->modedefs[mode].read_ahead = strtol(t, NULL, 0); + defs->modedefs[mode].read_ahead = num_arg(t); if ((t = find_string(defstr, "two", line, LINEMAX)) != NULL) - defs->modedefs[mode].two_fm = strtol(t, NULL, 0); + defs->modedefs[mode].two_fm = num_arg(t); if ((t = find_string(defstr, "comp", line, LINEMAX)) != NULL) - defs->modedefs[mode].compression = strtol(t, NULL, 0); + defs->modedefs[mode].compression = num_arg(t); if ((t = find_string(defstr, "auto", line, LINEMAX)) != NULL) - defs->modedefs[mode].auto_lock = strtol(t, NULL, 0); + defs->modedefs[mode].auto_lock = num_arg(t); if ((t = find_string(defstr, "fast", line, LINEMAX)) != NULL) - defs->modedefs[mode].fast_eod = strtol(t, NULL, 0); + defs->modedefs[mode].fast_eod = num_arg(t); if ((t = find_string(defstr, "can-b", line, LINEMAX)) != NULL) - defs->modedefs[mode].can_bsr = strtol(t, NULL, 0); + defs->modedefs[mode].can_bsr = num_arg(t); if ((t = find_string(defstr, "noblk", line, LINEMAX)) != NULL) - defs->modedefs[mode].no_blklimits = strtol(t, NULL, 0); + defs->modedefs[mode].no_blklimits = num_arg(t); if ((t = find_string(defstr, "can-p", line, LINEMAX)) != NULL) - defs->modedefs[mode].can_partitions = strtol(t, NULL, 0); + defs->modedefs[mode].can_partitions = num_arg(t); if ((t = find_string(defstr, "scsi2", line, LINEMAX)) != NULL) - defs->modedefs[mode].scsi2logical = strtol(t, NULL, 0); + defs->modedefs[mode].scsi2logical = num_arg(t); if ((t = find_string(defstr, "sysv", line, LINEMAX)) != NULL) - defs->modedefs[mode].sysv = strtol(t, NULL, 0); + defs->modedefs[mode].sysv = num_arg(t); if ((t = find_string(defstr, "defs-for-w", line, LINEMAX)) != NULL) - defs->modedefs[mode].defs_for_writes = strtol(t, NULL, 0); + defs->modedefs[mode].defs_for_writes = num_arg(t); for (t=defstr; *t == ' ' || *t == '\t'; t++) ; @@ -468,9 +482,10 @@ do_inquiry(char *tname, char *company, char *product, char *rev, int print_non_f result = ioctl(fn, SCSI_IOCTL_SEND_COMMAND, buffer); if (result) { close(fn); - fprintf(stderr, - "The SCSI INQUIRY for device '%s' failed (power off?).\n", + sprintf(buffer, + "The SCSI INQUIRY for device '%s' failed (power off?)", tname); + perror(buffer); return FALSE; } @@ -563,10 +578,12 @@ find_devfiles(int tapeno, char **names) int non_rew[NBR_MODES]; struct dirent *dent; DIR *dirp; - char tmpname[PATH_MAX], devname[PATH_MAX]; + char tmpname[PATH_MAX]; const char *dn; - const devdir *dvd; - devdir tmpdevdirs[2]; + static const devdir *dvd; + const devdir *dvp; + int tmpdevdirsindex = 0; + static devdir tmpdevdirs[MAX_TAPES + 1]; struct stat statbuf; for (found=0; found < NBR_MODES; found++) { @@ -574,20 +591,30 @@ find_devfiles(int tapeno, char **names) non_rew[found] = FALSE; } - dvd = devdirs; - strcpy(tmpname, DEVFS_PATH); - if (!stat(tmpname, &statbuf)) { - if (S_ISDIR(statbuf.st_mode)) { /* Assume devfs, one directory for each tape */ - sprintf(devname, DEVFS_TAPEFMT, tapeno); - tmpdevdirs[0].dir = devname; - tmpdevdirs[0].selective_scan = FALSE; - tmpdevdirs[1].dir = NULL; + if (dvd == NULL && !stat(DEVFS_PATH, &statbuf)) { + if (S_ISDIR(statbuf.st_mode) && (dirp=opendir(DEVFS_PATH)) != NULL) { + /* Assume devfs, one directory for each tape */ + for ( ; (dent = readdir(dirp)) != NULL; ) { + if (!strcmp (dent->d_name, ".") + || !strcmp (dent->d_name, "..")) + continue; + snprintf(tmpdevdirs[tmpdevdirsindex].dir, + sizeof(tmpdevdirs[tmpdevdirsindex].dir), + "%s/%s", DEVFS_PATH, dent->d_name); + tmpdevdirs[tmpdevdirsindex].selective_scan = FALSE; + if (++tmpdevdirsindex == MAX_TAPES) + break; + } + tmpdevdirs[tmpdevdirsindex].dir[0] = 0; + closedir(dirp); dvd = &tmpdevdirs[0]; } } + if (dvd == NULL) + dvd = devdirs; - for (found=0; found < NBR_MODES && dvd->dir != NULL; dvd++) { - dn = dvd->dir; + for (found=0, dvp=dvd; found < NBR_MODES && dvp->dir[0] != 0; dvp++) { + dn = dvp->dir; if ((dirp = opendir(dn)) == NULL) continue; @@ -595,7 +622,7 @@ find_devfiles(int tapeno, char **names) if (!strcmp (dent->d_name, ".") || !strcmp (dent->d_name, "..")) continue; /* Ignore non-tape devices to avoid loading all the modules */ - if (dvd->selective_scan && !accept_tape_name(dent->d_name)) + if (dvp->selective_scan && !accept_tape_name(dent->d_name)) continue; strcpy(tmpname, dn); strcat(tmpname, "/"); @@ -777,7 +804,9 @@ define_tape(int tapeno, FILE *dbf, devdef_tr *defptr, int print_non_found) if (!find_devfiles(tapeno, fnames) || *fnames[0] == '\0') { - fprintf(stderr, "Can't find any device files for tape %d.\n", tapeno); + if (print_non_found) + fprintf(stderr, "Can't find any device files for tape %d.\n", + tapeno); free(fnames[0]); return FALSE; }