From owner-freebsd-scsi Sun Aug 25 0: 2:10 2002 Delivered-To: freebsd-scsi@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8CC1637B400; Sun, 25 Aug 2002 00:02:04 -0700 (PDT) Received: from mailman.zeta.org.au (mailman.zeta.org.au [203.26.10.16]) by mx1.FreeBSD.org (Postfix) with ESMTP id B5C9643E65; Sun, 25 Aug 2002 00:02:02 -0700 (PDT) (envelope-from bde@zeta.org.au) Received: from bde.zeta.org.au (bde.zeta.org.au [203.2.228.102]) by mailman.zeta.org.au (8.9.3/8.8.7) with ESMTP id HAA06963; Sun, 25 Aug 2002 07:01:41 GMT Date: Sun, 25 Aug 2002 17:07:32 +1000 (EST) From: Bruce Evans X-X-Sender: bde@gamplex.bde.org To: "Kenneth D. Merry" Cc: "M. Warner Losh" , , , , , , Subject: Re: kern/15608: acd0 / cd0 give inconsistent errors on empty tray open() In-Reply-To: <20020822223203.A13222@panzer.kdm.org> Message-ID: <20020825164629.H14756-100000@gamplex.bde.org> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Sender: owner-freebsd-scsi@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org 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