Re: proc_file_read() hack?

Todd Inglett (tinglett@vnet.ibm.com)
Mon, 25 Mar 2002 12:18:28 -0600


J.D. Hood wrote:

> I posted a patch which includes the following comment:
>
> + /*
> + * How to be a proc read function
> + * ------------------------------
[...]

How about applying my trivial patch and then adding this to your nice
comment?

3) Set *start = an address outside the buffer.
Put the data of the requested offset at *start.
Return the number of bytes of data placed there.
If this number is greater than zero and you
didn't signal eof and the reader is prepared to
take more data you will be called again with the
requested offset advanced by the number ob tyes
absorbed.

The code should still work with the other cases now that the hack is
fixed. Of course, rather than add 3), it would be better to re-word 2)
(e.g. "Set *start = address of the buffer which may or may not be in the
given buffer.).

There are cases where the data is available and need not be copied. My
code got simpler when I got rid of the need to copy my data around.

-todd

-
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/