* Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer?
@ 2011-04-26 11:58 Amit Ben Shahar
2011-04-26 12:30 ` Jiri Slaby
2011-04-26 12:37 ` Arnd Bergmann
0 siblings, 2 replies; 4+ messages in thread
From: Amit Ben Shahar @ 2011-04-26 11:58 UTC (permalink / raw)
To: linux-kernel
(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?
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer?
2011-04-26 11:58 Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer? Amit Ben Shahar
@ 2011-04-26 12:30 ` Jiri Slaby
2011-04-26 12:37 ` Arnd Bergmann
1 sibling, 0 replies; 4+ messages in thread
From: Jiri Slaby @ 2011-04-26 12:30 UTC (permalink / raw)
To: Amit Ben Shahar; +Cc: linux-kernel
On 04/26/2011 01:58 PM, 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?
Because you are responsible for changing it appropriately.
> is it in userspace?
Nope, in kernelspace.
I think this is described in LDD3, isn't it?
regards,
--
js
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer?
2011-04-26 11:58 Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer? Amit Ben Shahar
2011-04-26 12:30 ` Jiri Slaby
@ 2011-04-26 12:37 ` Arnd Bergmann
2011-04-26 12:55 ` Amit Ben Shahar
1 sibling, 1 reply; 4+ messages in thread
From: Arnd Bergmann @ 2011-04-26 12:37 UTC (permalink / raw)
To: Amit Ben Shahar; +Cc: linux-kernel
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
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer?
2011-04-26 12:37 ` Arnd Bergmann
@ 2011-04-26 12:55 ` Amit Ben Shahar
0 siblings, 0 replies; 4+ messages in thread
From: Amit Ben Shahar @ 2011-04-26 12:55 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: linux-kernel
> The read function must update the offset independent of the return value.
> See simple_read_from_buffer() as an example.
Thank you - that helped greatly and solved my problem.
Amit.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-04-26 12:55 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-04-26 11:58 Why is the 'loff_t *offset' parameter in the file_operations' read function a pointer? Amit Ben Shahar
2011-04-26 12:30 ` Jiri Slaby
2011-04-26 12:37 ` Arnd Bergmann
2011-04-26 12:55 ` Amit Ben Shahar
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).