OPENDEV_PART means "try tacking a 'c' onto the end of the
provided device name when opening the device". The tape devices
opened by mt and chio don't have 'c' partitions so it's
kinda useless to try opening them before just trying the
'bare' provided device.

The curious can examine lib/libutil/opendev.c to prove me
wrong. :-).

Shouldn't change any functionality.

.... Ken

Index: bin/chio/chio.c
===================================================================
RCS file: /cvs/src/bin/chio/chio.c,v
retrieving revision 1.22
diff -u -p -r1.22 chio.c
--- bin/chio/chio.c     27 Nov 2007 16:22:12 -0000      1.22
+++ bin/chio/chio.c     22 Apr 2011 15:50:29 -0000
@@ -670,7 +670,7 @@ check_source_drive(int unit)
         * Try to make it accessible by doing an mt offline.
         */
        tapedev = parse_tapedev(_PATH_CH_CONF, changer_name, unit);
-       mtfd = opendev(tapedev, O_RDONLY, OPENDEV_PART, NULL);
+       mtfd = opendev(tapedev, O_RDONLY, 0, NULL);
        if (mtfd == -1)
                err(1, "%s drive %d (%s): open", changer_name, unit, tapedev);
        if (ioctl(mtfd, MTIOCTOP, &mtoffl) == -1)
Index: bin/mt/mt.c
===================================================================
RCS file: /cvs/src/bin/mt/mt.c,v
retrieving revision 1.33
diff -u -p -r1.33 mt.c
--- bin/mt/mt.c 9 Nov 2009 06:42:59 -0000       1.33
+++ bin/mt/mt.c 22 Apr 2011 15:50:51 -0000
@@ -211,7 +211,7 @@ main(int argc, char *argv[])
        }
 
        flags = comp->c_ronly ? O_RDONLY : O_WRONLY | O_CREAT;
-       if ((mtfd = _rmtopendev(tape, flags, OPENDEV_PART, &realtape)) < 0) {
+       if ((mtfd = _rmtopendev(tape, flags, 0, &realtape)) < 0) {
                if (errno != 0)
                        warn("%s", host ? tape : realtape);
                exit(2);

Reply via email to