Date: Wed, 28 May 2003 20:28:06 +0400 From: Yar Tikhiy <yar@freebsd.org> To: Bruce Evans <bde@zeta.org.au> Cc: joerg@freebsd.org Subject: Re: kern/52338: fd(4) floppy disk driver & non-blocking I/O Message-ID: <20030528162805.GA35083@comp.chem.msu.su> In-Reply-To: <20030522220631.P43165@gamplex.bde.org> References: <200305161646.h4GGkdDS000677@stylish.chem.msu.su> <20030517165718.B15076@gamplex.bde.org> <20030517091047.GA82314@comp.chem.msu.su> <20030517235738.U16304@gamplex.bde.org> <20030519182357.GA99588@comp.chem.msu.su> <20030522220631.P43165@gamplex.bde.org>
next in thread | previous in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20030528162805.GA35083>