Subject: Re: proposal: sys/dkio.h
To: Michael Graff <>
From: Jason Thorpe <>
List: tech-kern
Date: 01/29/1996 14:12:34
On Sun, 28 Jan 1996 23:05:03 -0600 
 "Michael Graff" <> wrote:

 > Don't forget eject in there...

That was listed above.  I've actually done something slightly different 
that what I've posted previously.  See below.

 > I hacked the sd.c driver to do the eject call, (it wasn't tough, of
 > course) but either I messed up or it doesn't want to eject my zip
 > drive.

The trick is that you need to unlock the disk pack.  On a ZIP, you have 
to do something like this before the eject is performed:

	scsi_prevent(sd->sc_link, PR_ALLOW, 0);

The CD-ROM driver implementes CDIOC{PREVENT,ALLOW}.  I originally modeled 
the DIOC{PREVENT,ALLOW} ioctls after these.  However, I took Chris's 
suggestion and implemented a single ioctl for disk, cdroms, floppies, 
etc. called DIOCLCKPACK which takes an int argument: 0 for unlock, 
non-zero for lock.

So, all removable-media drivers which support eject commands now 
implement DIOCLCKPACK and DIOCEJECT.  I've modified eject(1) to 
understand this new interface.  There is now a single eject_disk() 
function instead of eject_floppy(), eject_cdrom(), and eject_disk().

If someone would like to verify for me that this works properly with 
their ZIPs, I'd appreciate it.

Jason R. Thorpe                             
NASA Ames Research Center                               Home: 408.866.1912
NAS: M/S 258-6                                          Work: 415.604.0935
Moffett Field, CA 94035                                Pager: 415.428.6939