Re: Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer?

From: Arnd Bergmann
Date: Tue Apr 26 2011 - 08:38:06 EST


On Tuesday 26 April 2011, Amit Ben Shahar wrote:
> (if i'm off topic or should look elsewhere i apologize - couldn't find
> information anywhere)
> I am coding a kernel module and implementing a file's operations, the
> read operation received an loff_t *offset parameter, why is this a
> pointer? is it in userspace?

The read function must update the offset independent of the return value.
See simple_read_from_buffer() as an example.

Arnd
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/