Hi Martin, Martin Pieuchot wrote on Sun, May 20, 2012 at 04:46:40PM +0200:
> Diff below makes eject(1) use cd0 as default device like cdio(1) does. > > I'm aware this is an arbitrary choice but I see no drawback in having > a default device to eject and this behavior is coherent with cdio(1)'s. I understand your intention, but this does not seem completely consistent. The mt(1) manual says: eject is simply an alias for mt, with the offline command specified. Consequently, "mt -f device offline" = "eject device" Additionally, the mt(1) manual says: If a tape name is not specified, and the environment variable TAPE does not exist, mt uses the device /dev/rst0. The TAPE variable is ignored by eject. Consequently, right now, "mt offline" = "eject /dev/rst0" (Yes, i did test it: ischwarze@isnote $ sudo mt offline mt: /dev/rst0: Device not configured) Wouldn't it be strange to define "eject" = "eject cd0" such that "mt offline" and "eject" suddenly operate on different devices? For consistency, the default for eject should be st0 as well. Then again, who is using eject with st0, nowadays? So i'm not sure defining that default helps a lot. > Ok? I don't strongly object, but i'm not quite convinced either. Yours, Ingo > Index: mt.c > =================================================================== > RCS file: /cvs/src/bin/mt/mt.c,v > retrieving revision 1.35 > diff -u -p -r1.35 mt.c > --- mt.c 5 May 2011 19:51:48 -0000 1.35 > +++ mt.c 20 May 2012 14:44:56 -0000 > @@ -53,6 +53,10 @@ > > #include "mt.h" > > +#ifndef DEFAULT_CD_DRIVE > +# define DEFAULT_CD_DRIVE "cd0" > +#endif > + > struct commands { > char *c_name; > int c_code; > @@ -148,7 +152,7 @@ main(int argc, char *argv[]) > if (strcmp(progname, "eject") == 0) { > opts = "t"; > eject = 1; > - tape = NULL; > + tape = DEFAULT_CD_DRIVE; > } else { > opts = "f:"; > if ((tape = getenv("TAPE")) == NULL) > @@ -180,9 +184,6 @@ main(int argc, char *argv[]) > } else if (argc < 1 || argc > 2) > usage(); > > - if (tape == NULL) > - usage(); > - > if (strchr(tape, ':')) { > #ifdef RMT > host = tape; > @@ -315,7 +316,7 @@ void > usage(void) > { > if (eject) > - (void)fprintf(stderr, "usage: %s [-t] device\n", progname); > + (void)fprintf(stderr, "usage: %s [-t] [device]\n", progname); > else > (void)fprintf(stderr, > "usage: %s [-f device] command [count]\n", progname); > Index: mt.1 > =================================================================== > RCS file: /cvs/src/bin/mt/mt.1,v > retrieving revision 1.28 > diff -u -p -r1.28 mt.1 > --- mt.1 3 Sep 2010 13:14:55 -0000 1.28 > +++ mt.1 20 May 2012 14:24:42 -0000 > @@ -44,7 +44,7 @@ > .Op Ar count > .Nm eject > .Op Fl t > -.Ar device > +.Op Ar device > .Sh DESCRIPTION > The > .Nm > @@ -74,7 +74,8 @@ with the > .Cm offline > command specified. > .Nm eject > -may also be used to eject other types of removable media. > +may also be used to eject other types of removable media, the default is > +.Pa cd0 . > .Pp > The options for > .Nm > @@ -178,6 +179,8 @@ is not given. > raw SCSI tape interface > .It Pa /dev/rmt* > raw magnetic tape interface > +.It Pa /dev/rcd* > +raw CD drive interface > .It Pa /usr/src/sys/scsi/scsi_tape.h > list of SCSI2 density codes > .El