Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 28 May 2003 09:30:13 -0700 (PDT)
From:      Yar Tikhiy <yar@freebsd.org>
To:        freebsd-bugs@FreeBSD.org
Subject:   Re: kern/52338: fd(4) floppy disk driver & non-blocking I/O
Message-ID:  <200305281630.h4SGUDrj000158@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help
The following reply was made to PR kern/52338; it has been noted by GNATS.

From: Yar Tikhiy <yar@freebsd.org>
To: Bruce Evans <bde@zeta.org.au>
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);
  



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305281630.h4SGUDrj000158>