From owner-freebsd-bugs@FreeBSD.ORG Wed May 28 09:30:13 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id B8B2237B401 for ; Wed, 28 May 2003 09:30:13 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5F5A243F3F for ; Wed, 28 May 2003 09:30:13 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h4SGUDUp000159 for ; Wed, 28 May 2003 09:30:13 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h4SGUDrj000158; Wed, 28 May 2003 09:30:13 -0700 (PDT) Date: Wed, 28 May 2003 09:30:13 -0700 (PDT) Message-Id: <200305281630.h4SGUDrj000158@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org From: Yar Tikhiy Subject: Re: kern/52338: fd(4) floppy disk driver & non-blocking I/O X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Yar Tikhiy List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 28 May 2003 16:30:14 -0000 The following reply was made to PR kern/52338; it has been noted by GNATS. From: Yar Tikhiy To: Bruce Evans Cc: FreeBSD-gnats-submit@freebsd.org, freebsd-bugs@freebsd.org, joerg@freebsd.org Subject: Re: kern/52338: fd(4) floppy disk driver & non-blocking I/O Date: Wed, 28 May 2003 20:28:06 +0400 As for panic in fdioctl(), I've been convinced upon second thought that your approach should be preferred. Indeed, for what sake may the system happily return some fictitious media parameters before the media has been detected? I've considered just moving the media ioctl handlers to the blocking part of fdioctl(), but this seemed to be a poor idea as long as the media type was settable through ioctl(FD_STYPE), which gave non-null fd->ft even in non-blocking mode. The following patch does the same as your change to fdioctl() except that fdioctl() will return EAGAIN if media type is unset in non-blocking mode, as per fdc(4). Does this look reasonable? BTW, thank you for your valuable help on this topic. I'd like to express my deep respect to your comprehensive experience with the system's internals. -- Yar --- fd.c.dist Tue Apr 1 19:06:25 2003 +++ fd.c Wed May 28 20:15:02 2003 @@ -2621,10 +2621,14 @@ switch (cmd) { case DIOCGMEDIASIZE: + if (fd->ft == 0) + return ((fd->flags & FD_NONBLOCK) ? EAGAIN : ENXIO); *(off_t *)addr = (128 << (fd->ft->secsize)) * fd->ft->size; return (0); case DIOCGSECTORSIZE: + if (fd->ft == 0) + return ((fd->flags & FD_NONBLOCK) ? EAGAIN : ENXIO); *(u_int *)addr = 128 << (fd->ft->secsize); return (0);