----- Original Message -----
From: "Douglas Gilbert" <[EMAIL PROTECTED]>
To: "Oliver Neukum" <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Tuesday, April 25, 2000 9:30 AM
Subject: Re: question on short transfers


> Oliver Neukum wrote:
> >
> > Hi,
> >
> > how do I indicate to the higher layers that less data than requested has
> > been transfered ?
>
> In lk 2.3/2.4 with:
>         int resid;              /* Number of bytes requested to be
>                                    transferred less actual number
>                                    transferred (0 if not supported) */
> See aha152x or advansys drivers for examples of this. The sg driver
> since lk 2.3.43 makes resid available to user applications.
>
> Also in lk 2.2, 2.3/2.4 there is:
>         unsigned underflow;     /* Return error if less than
>                                    this amount is transfered */
> See the aic7xxx driver for an example.

    Not all upper level drivers pay attention to this.  In particular, the
disk and cdrom driver will expect that either the full amount will be
transferred, or that an error of some sort will be returned.  In the event
of an error, it is expected that the sector number for the bad sector will
be returned in the sense data, that all sectors up to the bad sector were
processed correctly, and that none of the sectors after the bad sector were
handled.  I believe that the tape driver

    The resid field is probably of more interest  to people using sg, where
the buffer size isn't contolled by the kernel.

    The underflow field isn't really used very much.  Someone else added it
long ago, and I never bothered to figure out exactly when and how it is
supposed to be used.  Thus the mid-level usually doesn't set the field.  I
am not wild about half-supported options - we should either rip it out
entirely or figure out what it is supposed to be used for and finish the
support.  A lot of this depends upon whether support for underflow is
something that people feel is worthwhile or not.

-Eric



-
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [EMAIL PROTECTED]

Reply via email to