[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: about kiobuf
On Fri, May 11, 2001 at 10:44:43AM +0100, petur thors wrote:
> HI
>
> I have a few questions about the kiobuf architecture, specialy about the
> map_user_kiobuf routine:
> int map_user_kiobuf(int rw, struct kiobuf *iobuf, unsigned long va, size_t
> len)
> I know that the ´va´ must be page-aligned but how can I determine the size_t
> len?
> Suppose this code is in mydriver_write() and the application programm sends
> in a char *user_buffer and I want to map the pages of the buffer and lock
> them down how can I determine the length of the user_buffer? Should I just
> put it to the maximun length of one kiobuf structure (64K)?
> The va parameter would be:
> addr = (unsigned long)user_buffer & PAGE_MASK;
> But what about size_t len?
static ssize_t
foo_write(struct file *fp, const char *bufp, size_t size, loff_t *offp)
^^^^^^^^^
Hope that helps - a very good example that also does some rounding,
etc is drivers/char/raw.c.
Christoph
--
Whip me. Beat me. Make me maintain AIX.
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/