Please tell me if I've negotiated this twisty maze correctly:
The function which is passed into create_proc_read_entry() has the
following API:
ret= read_proc(
char *page_buffer,
char **my_first_byte,
off_t virtual_start,
int length,
int *eof,
void *data);
Where:
The caller has a virtual view of the read operation. It is trying to
read the window of data between virtual_start and virtual_start+length
Virtual data:
-----------------------------------------------------------
| | | | | | |a|b|c|d|e|f|g|h|i|j|k|l|m|n| | | | | | | | | |
-----------------------------------------------------------
^ virtual_start
^ virtual_start+length
But the read_proc function is passed a little page into which it has to
put _some_ of the data at *virtual_start:
Page buffer:
-------------------------------
| | |a|b|c|d|e|f|g| | | | | | |
-------------------------------
^ my_first_byte
^my_first_byte+ret
So read_proc()'s responsibility is to grab _some_ of the data which
starts at 'a' (up to 'length') and to put it _somewhere_ in the
page_buffer. It puts a pointer to the first byte into *my_first_byte
and returns the number of bytes written to the caller.
If the byte 'g' was the last one which read_proc() wants to produce then
it sets *eof to 1.
I think I've convinced myself. Now, what does 'data' do?
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/
This archive was generated by hypermail 2b29 : Tue Feb 29 2000 - 21:00:11 EST