Subject: Re: kern/21503: empty SCSI tape drives cannot be queried or configured
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 06/16/2003 14:22:45
[ On Wednesday, May 14, 2003 at 14:53:56 (+0200), Manuel Bouyer wrote: ]
> Subject: Re: kern/21503: empty SCSI tape drives cannot be queried or configured
>
> Did you try mt -f /dev/enrst0 status ? This work for me, on a DLT7000

OK, so to finally get back to this PR.

Yes, /dev/enrst0 does work.

I think there are two related problems (well, three or four if you
include the documentation fixes).

The first is that if tape is empty the driver returns ENODEV on open of
a non-control device (i.e. a device node without both low bits set (11)
in the minor number).  I think the patch I offered in the initial PR
mostly solves this problem.  A good technical documentation editor might
be able to make the st(4) documentation a little better too -- e.g.
remind the reader more prominently that the control mode device must be
used if there's no media in the drive.

The second problem is that 'mt' was never fixed to use the control mode
device by default when that mode was first introduced.  That fix can be
done quite simply with the following patch:

Index: src/include/paths.h
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/include/paths.h,v
retrieving revision 1.22
diff -c -c -r1.22 paths.h
*** paths.h	3 May 2003 03:24:01 -0000	1.22
--- paths.h	16 Jun 2003 18:14:10 -0000
***************
*** 61,67 ****
  #define	_PATH_CLOCKCTL	"/dev/clockctl"
  #define	_PATH_CONSOLE	"/dev/console"
  #define	_PATH_CSHELL	"/bin/csh"
! #define	_PATH_DEFTAPE	"/dev/nrst0"
  #define	_PATH_DEVDB	"/var/run/dev.db"
  #define	_PATH_DEVNULL	"/dev/null"
  #define	_PATH_DRUM	"/dev/drum"
--- 61,67 ----
  #define	_PATH_CLOCKCTL	"/dev/clockctl"
  #define	_PATH_CONSOLE	"/dev/console"
  #define	_PATH_CSHELL	"/bin/csh"
! #define	_PATH_DEFTAPE	"/dev/enrst0"
  #define	_PATH_DEVDB	"/var/run/dev.db"
  #define	_PATH_DEVNULL	"/dev/null"
  #define	_PATH_DRUM	"/dev/drum"
Index: src/bin/mt/mt.1
===================================================================
RCS file: /cvs/master/m-NetBSD/main/src/bin/mt/mt.1,v
retrieving revision 1.32
diff -c -c -r1.32 mt.1
*** mt.1	25 Feb 2003 10:34:39 -0000	1.32
--- mt.1	16 Jun 2003 18:17:19 -0000
***************
*** 171,178 ****
  .Ev TAPE
  is not set, then
  .Nm
! uses the device
! .Pa /dev/nrst0 .
  .Sh EXIT STATUS
  .Nm
  returns a 0 exit status when the operation(s) were successful,
--- 171,178 ----
  .Ev TAPE
  is not set, then
  .Nm
! uses the control-mode device for the first SCSI tape:
! .Pa /dev/enrst0 .
  .Sh EXIT STATUS
  .Nm
  returns a 0 exit status when the operation(s) were successful,

(I have several more changes for mt.1 to update the density code table,
but I should probably send those as a sparate PR).

-- 
								Greg A. Woods

+1 416 218-0098;            <g.a.woods@ieee.org>;           <woods@robohack.ca>
Planix, Inc. <woods@planix.com>; VE3TCP; Secrets of the Weird <woods@weird.com>