Subject: Re: (2nd send) opinion sought about EOM handling for tapes
To: Todd Whitesel <toddpw@best.com>
From: Matthew Jacob <mjacob@feral.com>
List: tech-kern
Date: 07/13/1998 18:29:15
On Mon, 13 Jul 1998, Todd Whitesel wrote:

> > 	EARLY WARNING behaviour enabled is defined as a guarantee that
> > 	if early warning (logical EOM) is detected, the tape driver
> > 	will ensure that the writing application will be notified by
> > 	a 'short' write (non-zero residual). This may be delivered
> > 	by either the EOM itself causing a residual, but also may
> > 	require the driver to internally 'note' that EOM has occurred
> > 	and to terminate the next write immediately with the residual
> > 	set to the byte count of that request.
> 
> Wait a minute, in the latter case how do you know that it's a residual
> and not a complete write?
> 
> Maybe I missed something, but it seems that these methods have a slight
> problem when your "short write" hasn't written any bytes yet, so the only
> 'correct' residual would be exactly zero.
> 

I may not be being clear (again!). You know it's not a complete write
when you get returned from the write(2) system call a number less than
that which you requested.

The only trick here is that you may get, in the driver, EARLY WARNING
but still have satisfied the I/O request completely. In this case, the
driver has to maintain state so that the *next* write gets a (synthesized
and immediate) 'short' write (with a value returned such that the
application believes (correctly) that no data was moved for this I/O
operation).

Does this explain it better?

-matt