Re: proc_file_read bug?

Thomas Hood (jdthood@mail.com)
25 Jan 2002 10:00:12 -0500


On Fri, 2002-01-25 at 09:29, Andreas Schwab wrote:
> |> /* This is a hack to allow mangling of file pos independent
> |> * of actual bytes read. Simply place the data at page,
> |> * return the bytes, and set `start' to the desired offset
> |> * as an unsigned int. - Paul.Russell@rustcorp.com.au
> |> */

> It is documented, RTFC.

Comment or Code? The comment is somewhat ambiguous and incorrect.

Reading the code, I take it that "start" is either a pointer into
the buffer where the string of n data bytes starts, or else
(when it is assigned a value less than the beginning of the buffer)
it is a special value by which the file offset is to be adjusted,
instead of n. Thus the comment might be clarified:
/*
* This is a hack to allow adjusting the file offset
* by a number different from the number of bytes read.
* Simply place the data at page, return the number of
* bytes read, and set "start" to the (signed long) amount
* by which the file offset is to be increased or
* decreased
*/

My question then is: why would one want to adjust the file
offset other than by +n?

--
Thomas

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/