Subject: Re: CHanges to sd and cd drivers
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Tom Javen <tomja@InnoTrac.fi>
List: tech-kern
Date: 01/21/1999 08:12:30
On Wed, 20 Jan 1999, Manuel Bouyer wrote:

Works great on Alps 4x4 !

Thanks Manuel,

> Hi,
> I'd like to make a few changes to the sd and cd drivers
> (patches included below):
> - don't reset the SDEV_MEDIA_LOADED flag when the last partition of a sd device
>   is closed, but only when we believe the media has changed (cd already behaves
>   this way). The reset of SDEV_MEDIA_LOADED is done in the generic error
>   handler. This change allows to load a in-memory disklabel, and then
>   mount a partition. For now one would have to use a kludge to keep a parition
>   open while changing the disklabel, otherwise it would get lost when
>   'disklabel' closes the raw device.
> - allows the raw partition of a sd or cd device to be opened even if
>   scsi_start() returns an error. The main goal here is to allow IOCTLs even
>   when there's no media in a removable device (for example, the CDIOCCLOSE
>   ioctl is totally useless for now, this is also needed for changers that don't
>   have a separate LUN from the drive, like ATAPI changers),
>   but one could want to send some commands to a disk that doesn't spin up to
>   help diagnose or solve the problem ... 
>   read/write are allowed only if SDEV_MEDIA_LOADED is set, which doesn't
>   happen if scsipi_start() failed ...
>   For now only an explicit list of IOCTL are allowed when SDEV_MEDIA_LOADED
>   is not set. Maybe all ioctls should be allowed, letting the device return
>   an error if appropriate.
> 
> Another change that could be made: add SCSI_IGNORE_NOT_READY when
> unlocking the device (for CDIOCALLOW, and DIOCLOCK when unlocking), to that
> a CD tray could be opened by eject(1) even when no disk is loaded
> (this would also require to change eject to use the raw part instead of
> 'a'; it could also be changed to issue CDIOCCLOSE ioctls as well).
> 
> These changes have been tested with a SCSI magneto-opetical drive and an
> ATAPI CDROM, all seems to behave as expected so far. If no one complains,
> I'll commit these changes next week.
> 
> --
> Manuel Bouyer, LIP6, Universite Paris VI.           Manuel.Bouyer@lip6.fr
> --
> 

-- 
=============================+===========================
Tom Javen                    |   Innotrac Diagnostics Oy
email tom.javen@innotrac.fi  |   Finland
gsm   +358-40-5860532        |   phone +358-2-2410025
                             |   fax   +358-2-2410024
=============================+===========================