In following functions, taken from LDD:
ssize_t read(struct file *filp, char __user *buff, size_t count, loff_t *offp);
ssize_t write(struct file *filp, const char __user *buff, size_t count, loff_t *offp);
Why there is the need of loff_t *offp
? Can't I use directly filp
to update f_pos
?
Moreover in page 54 the author says:
Read and write should update a position using the pointer they receive as the last argument instead of acting on
filp->f_pos
directly. The one exception to this...
OK, so it's better to use the offp
pointer, but why?