Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 25 Aug 2002 17:07:32 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        "Kenneth D. Merry" <ken@kdm.org>
Cc:        "M. Warner Losh" <imp@bsdimp.com>, <johan@FreeBSD.ORG>, <nsayer@quack.kfu.com>, <freebsd-gnats-submit@FreeBSD.ORG>, <freebsd-scsi@FreeBSD.ORG>, <freebsd-standards@FreeBSD.ORG>, <sos@FreeBSD.ORG>
Subject:   Re: kern/15608: acd0 / cd0 give inconsistent errors on empty tray open()
Message-ID:  <20020825164629.H14756-100000@gamplex.bde.org>
In-Reply-To: <20020822223203.A13222@panzer.kdm.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 22 Aug 2002, Kenneth D. Merry wrote:

> On Fri, Aug 23, 2002 at 12:41:28 +1000, Bruce Evans wrote:
> > I think the bug is that the open doesn't succeed.  The device is
> > reported as being there at boot time, and there is enough of it there
> > to tell which parts of it aren't there, so why not open() it so that
> > you do things like ioctl() on it to close its door and make it there?
>
> There is no ioctl in the interface for loading a CD.  None of the other
> ioctls, I think, make much sense without media in the drive.

There is a CDIOCCLOSE which seems to be supported by acd and by some
unmaintained cdrom drivers by not by the scsi cdrom driver.

> The reason we need to do a read capacity in the open() routine, which is
> why the open fails when there is no media, is so we can fill in the
> d_secsize and d_secperunit fields in the disklabel.

acdopen() calls acd_read_toc() which does similar things.  When there is
no media, acd_read_toc() fails with the not quite right error EBUSY, but
acdopen() ignores this error and the open succeeds and you can try
CDIOCCLOSE() to attempt to load media.  So it seems that acdopen() already
works like I want, and the EIO error reported earlier doesn't actually
occur for acdopen().

dsopen() has similar issues.  It attempts to read MBRs and disk labels
and can probably return EIO for read errors when there is no media or
bad media.  One reason why the fd driver doesn't use the slice layer
is that I never got this working well enough for floppies.  It is hard
to issue formatting ioctls when the open fails because the MBR is
unreadable.

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-scsi" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20020825164629.H14756-100000>