Bug 13843

Summary: da driver does not support 'CDIOCEJECT' ioctl
Product: Base System Reporter: kientzle
Component: kernAssignee: Kenneth D. Merry <ken>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: 3.2-RELEASE   
Hardware: Any   
OS: Any   

Description kientzle 1999-09-20 00:50:00 UTC
Since 'od' isn't a CAM driver, shouldn't 'da' support
the 'CDIOCEJECT' ioctl, which is used to eject a variety
of removable media (e.g., ZIP drives)?

Having a way to programatically eject ZIP disks is quite
handy; using 'od' on 2.2.X, I had edited rc.shutdown to
eject any ZIP disks, which avoids some painful drive-lettering
problems when you boot Windows.  (It also ejects the disk,
which is otherwise impossible---at least for internal
drives---without turning the machine back on.)

				- Tim Kientzle

Fix: 

It looks like the code might be cut/pasted from scsi_cd.c to scsi_da.c.
I don't know enough about the code to be sure; might be necessary
to check and do this only for removable drives.
How-To-Repeat: The command: cdcontrol -f da0 eject

Does not work with a SCSI internal ZIP drive (nor with an
external parallel-port drive accessed through vp interface).
Comment 1 ken 1999-09-20 05:15:37 UTC
kientzle@acm.org wrote...
> Since 'od' isn't a CAM driver, shouldn't 'da' support
> the 'CDIOCEJECT' ioctl, which is used to eject a variety
> of removable media (e.g., ZIP drives)?
> 
> Having a way to programatically eject ZIP disks is quite
> handy; using 'od' on 2.2.X, I had edited rc.shutdown to
> eject any ZIP disks, which avoids some painful drive-lettering
> problems when you boot Windows.  (It also ejects the disk,
> which is otherwise impossible---at least for internal
> drives---without turning the machine back on.)
> 
> 				- Tim Kientzle
> 
> >How-To-Repeat:
> The command: cdcontrol -f da0 eject
> 
> Does not work with a SCSI internal ZIP drive (nor with an
> external parallel-port drive accessed through vp interface).
> 
> >Fix:
> It looks like the code might be cut/pasted from scsi_cd.c to scsi_da.c.
> I don't know enough about the code to be sure; might be necessary
> to check and do this only for removable drives.

It seems sort of kludgy to use part of the CD ioctl set with drives that
obviously aren't CDROM drives.

In any case, there is already a way to eject media from any SCSI device
that has removable media:

camcontrol eject da0

Note that this won't work unless the disk is unmounted.  When the da device
is open, removal will be prevented.

Ken
-- 
Kenneth Merry
ken@kdm.org
Comment 2 Kenneth D. Merry freebsd_committer freebsd_triage 1999-09-21 06:17:00 UTC
State Changed
From-To: open->suspended

There's already a way to eject any SCSI removable media -- with camcontrol. 
However the PR author brought up a reasonable point about a generic ioctl 
to handle removable media.  I'm sticking this in suspended state until 
I get a chance to think about it some more.  At that point, I may either 
do something about it or decide that it isn't worth dealing with and close 
the PR. 


Comment 3 Kenneth D. Merry freebsd_committer freebsd_triage 1999-09-21 06:17:00 UTC
Responsible Changed
From-To: freebsd-bugs->ken

I'll take this one. 
Comment 4 Craig Rodrigues freebsd_committer freebsd_triage 2007-02-07 02:42:47 UTC
State Changed
From-To: suspended->closed

"camcontrol eject da0" is the way to eject media from a removable 
SCSI device.