Results 1 to 1 of 1
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Aug 2010
Driver programming: using copy_to_user
The last argument to the read/write function is an loff_t* giving the offset in the buffer where the data is to be read/written to/from. How do I pass this into copy_to_user to ensure it reads from the correct point?
The second arg to copy_to_user is a pointer to the driver's internal buffer as obtained from kmalloc, but if I just pass this straight into copy_to_user it will start copying from the beginning of the buffer, which may not be what the user requested. Presumably I need to somehow advance this pointer forward by the amount held in the loff_t struct?