Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Dec 1997 08:41:03 -0800 (PST)
From:      dan@math.berkeley.edu (Dan Strick)
To:        joerg_wunsch@uriah.heep.sax.de
Cc:        dan@math.berkeley.edu, scsi@freebsd.org
Subject:   Re: Questions about mt and SCSI subsystem
Message-ID:  <199712111641.IAA20249@math.berkeley.edu>

next in thread | raw e-mail | index | archive | help
> >   For drives
> > that are not capable of overwriting EOF marks, I favor the convention
> > that a single EOF mark (with no backspace) be written in these
> > circumstances and that a double EOF mark be written before rewinds
> > (even though this may inconvenience lazy programmers who don't think
> > ahead).
> 
> Still, this would break appending to the tape, where it leaves the
> double EOF.

Yes, it would inconvenience those lazy programmers who don't think ahead.

> > The convention that a raw tape driver return a single zero length
> > read to mark EOF is very ancient and should be respected because it
> > is so darn useful.
> 
> Right he is!  Note that this convention doesn't only apply to tape
> devices, it applies to any Unix device.  It was handled rather sloppy
> in FreeBSD, it's not that long ago that i've fixed the floppy disk
> driver's EOF handling.

I think of that more as a different convention specifically for random
access devices.  A read that begins (at least one byte) beyond the end
of the device (or disk partition) should return -1 with error code ENXIO.
A read that begins at or before the end of the device and extends past
the end of the device (or partition) should return the available data
without error (i.e. do a short read).

In my opinion, short writes should not be allowed.  The driver should
return an error in such circumstances.  The man page for write(2) in
the Unix Sixth Edition manual did in fact require this.  Somewhere in
between then and now that requirement was relaxed, but it would still
seem to apply to disk writes.

Dan Strick
dan@math.berkeley.edu



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