Subject: Re: Error code for "No Media"
To: Manuel Bouyer <bouyer@antioche.eu.org>
From: Matthew Jacob <mjacob@feral.com>
List: tech-kern
Date: 01/27/1999 10:21:52
On Wed, 27 Jan 1999, Manuel Bouyer wrote:

> Hi,
> I made the necessery changes to the sd and cd drivers to get a different
> error code for the "no media" case. For now I use ENODEV, this can easily be
> changed. 
> As pointed out, FreeBSD returns ENXIO, which I don't like very much
> (ENXIO  is also used for device doesn't exist, or partition doesn't exist).

Which makes *some* sense given their notion of device instance and pack
validation.

> 
> Also, I'm planning to retrict open for the raw block device too (you could
> open only the raw character device when the drive is empty).
> The reason is that a read on the block device returns a short read
> instead of and error (a 'mount /cdrom' will complain for EINVAL instead
> of ENODEV, and dd if=/dev/cd0d will return no error, just 0 block transfered).


I don't understand this step. What do you mean 'restrict'? If you do this,
please add a control minor so that the device can be opened
unconditionally if need be.

-matt