Subject: Re: Addition to force open to open only regular files
To: NetBSD Kernel Technical Discussion List <>
From: Greywolf <>
List: tech-kern
Date: 11/15/2000 17:34:22
On Wed, 15 Nov 2000, Greg A. Woods wrote:

# [ On Sunday, November 12, 2000 at 21:14:16 (+1100), Simon Burge wrote: ]
# > Subject: Re: Addition to force open to open only regular files 
# >
# > It's that act of opening and then closing a file that would, for
# > example, cause a tape drive to rewind or eject.  By then it's too
# > late - fstat() will only tell you that the tape device you just
# > opened will eject when you close the device.
# This is a bogus concern.  Any device which suffers this problem is
# broken by design and does not fit into the Unix model and should be
# fixed.

Agreed, sort of, but I suggest you go back and check your own historic
device trees.  I seem to recall

	/dev/rmt/0n	no-rewind
	/dev/rmt/0hn	no-rewind high-density


# Open(2) and close(2) should never do "destructive" things of
# this sort.  If the device must not be rewound unexpectedly then it
# should require an explicit ioctl() to trigger the rewind and should not
# support a rewind-on-close.  Tapes in particular should always rewind on
# close so as to allow eject/removal/unmount (whether by mechanised or
# manual intervention) but they should not eject so that they cannot be
# used again without manual intervention.

GACK!  What are you SAYING?  Tapes should ALWAYS REWIND ON CLOSE?

Only IFF you can ioctl() the descriptor and set the no-rewind flag
when it's still open.  I'd not mind that.  Of course, I'd like to
be able to tell it to rewoffl-on-close, as well.

But if you can't tell the tape NOT to rewind on close, then you've
just crippled our current driver.

I *do* think that handling all this via the minor number is an
unmistakable flaw with which, regrettably, we are somewhat stuck,
since programs like tar, dd, dump, restore and the like tend to blindly
open the device and go about their business.

Do we need a /dev/rmt controlling device to say something like
"set norewind,high-density on 0"?  (that might create a race condition
if someone's sitting on /dev/rmt waiting for you to open the tape drive).

Maybe we need a combination of the two.

I'm just tossing stuff out there at this point.  I hope you have your
shotguns ready. :-)

"Never mind the bollocks, here's BSD!"