From owner-freebsd-standards Thu Aug 22 21:32:16 2002 Delivered-To: freebsd-standards@freebsd.org Received: from mx1.FreeBSD.org (mx1.FreeBSD.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 50C6C37B40A; Thu, 22 Aug 2002 21:32:11 -0700 (PDT) Received: from panzer.kdm.org (panzer.kdm.org [216.160.178.169]) by mx1.FreeBSD.org (Postfix) with ESMTP id 797C843E6A; Thu, 22 Aug 2002 21:32:10 -0700 (PDT) (envelope-from ken@panzer.kdm.org) Received: from panzer.kdm.org (localhost [127.0.0.1]) by panzer.kdm.org (8.12.5/8.12.5) with ESMTP id g7N4W5KD013272; Thu, 22 Aug 2002 22:32:05 -0600 (MDT) (envelope-from ken@panzer.kdm.org) Received: (from ken@localhost) by panzer.kdm.org (8.12.5/8.12.5/Submit) id g7N4W4Rx013271; Thu, 22 Aug 2002 22:32:04 -0600 (MDT) (envelope-from ken) Date: Thu, 22 Aug 2002 22:32:04 -0600 From: "Kenneth D. Merry" To: Bruce Evans Cc: "M. Warner Losh" , 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: <20020822223203.A13222@panzer.kdm.org> References: <20020822.152329.129782316.imp@bsdimp.com> <20020823122010.S6402-100000@gamplex.bde.org> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i In-Reply-To: <20020823122010.S6402-100000@gamplex.bde.org>; from bde@zeta.org.au on Fri, Aug 23, 2002 at 12:41:28PM +1000 Sender: owner-freebsd-standards@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG On Fri, Aug 23, 2002 at 12:41:28 +1000, Bruce Evans wrote: > On Thu, 22 Aug 2002, M. Warner Losh wrote: > > > In message: <20020822150931.A10866@panzer.kdm.org> > > "Kenneth D. Merry" writes: > > : So is there any opinion on -standards as to what sort of error we should > > : return on open if there is no media in a drive? > > > > EIO means "The device is there, but the driver had problems > > interacting with it" while ENXIO means "the device isn't there at > > all." As such, EIO is the more correct error to return in this case. > > No, EIO means that an input/output arror occurred. open.2 only documents > EIO for creating files. Otherwise open() normally doesn't do any i/o. > So ENXIO is the more correct error. Cool. > 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. 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. > > I don't know if the standards speak to this specific issue (no or bad > > media in a device with removable media). > > POSIX doesn't say anything much different from open.2 about this. > > Bruce Ken -- Kenneth Merry ken@kdm.org To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-standards" in the body of the message