lkml.org 
[lkml]   [2000]   [Feb]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectread_proc_t API
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/

\
 
 \ /
  Last update: 2005-03-22 13:56    [W:0.236 / U:0.644 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site