kern/52338: fd(4) floppy disk driver & non-blocking I/O
Yar Tikhiy
yar at freebsd.org
Wed May 28 09:30:14 PDT 2003
The following reply was made to PR kern/52338; it has been noted by GNATS.
From: Yar Tikhiy <yar at freebsd.org>
To: Bruce Evans <bde at zeta.org.au>
Cc: FreeBSD-gnats-submit at freebsd.org, freebsd-bugs at freebsd.org,
joerg at 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);
More information about the freebsd-bugs
mailing list