Subject: Re: bin/6259: can't eject(1) /dev/cd2d
To: der Mouse <mouse@Rodents.Montreal.QC.CA>
From: Robert Elz <kre@munnari.OZ.AU>
List: netbsd-bugs
Date: 10/09/1998 00:01:24
    Date:        Thu, 8 Oct 1998 09:24:11 -0400 (EDT)
    From:        der Mouse  <mouse@Rodents.Montreal.QC.CA>
    Message-ID:  <199810081324.JAA02664@Twig.Rodents.Montreal.QC.CA>

  | The trouble is, there is no single way to eject.  You have to do it
  | differently depending on whether you're talking to the cd driver or the
  | floppy driver or the tape driver or whatever.

That's a pity, but sometimes things like that can't be helped.

  | This is why -t is necessary when the device is not one
  | eject knows about, since then it doesn't know how to eject it - you
  | have to tell it.

But that's insane.    Can't we have a "device capabilities" ioctl that
is implemented by all block and char special files (all of them) which
returns some basic info on what kind of device is out there - and for this,
only the kinds of information that are applicable to all devices (so no
sizes for disks, no resolutions for frame buffers, etc - just what kind of
device it is, and the most crude of capabilities - whether the device is
random access of sequential, and if the latter, rewindable or not, whether
read/write, read only, write only, or readable and writeable independantly
(like com ports, which can be read from, and written to, but there's no
way to read back what was previously written), and whether the device has
some kind of unloadable media or not).

But even without this, there really shouldn't be a reason that eject when
it doesn't know what kind of object is out there can't simply try all the
ways that might work.   It turns out there are just two, disks and tapes,
to deal with, and currently at least, neither of those understands the
ioctls that apply to the other, so trying both can't do any harm.

And finally, since "eject" is such a basic operation for dismountable media,
all the drivers really ought to support the same method - tapes are going
to need to keep supporting the MTIOCTOP with mt_op == MTOFFL method for
ever, for compatability, but there's no reason they can't also support the
DIOCEJECT ioctl as well (and the other few ioctls that are currently
sprinkled throughout the disk, floppy, and cd drivers, which really ought
apply to all dismountable media).