On Tue, Nov 8, 2011 at 12:06 PM, Dan Luedtke <[email protected]> wrote:
> Hallo everyone,
>
> could someone please give me a hint on how to get a block (e.g. 512
> bytes) from a block device from a kernel module?
>
> What .txt should I consult? Which headerfiles must I include?
> Where can I find the required function's definitions?
>
> In userspace I used fopen() with the device path as filename, I bet it
> isn't that easy in kernel mode.
>

Well even when is not considered a good practice, you can invoke the
file operations syscall handlers from your module.

Look at this LJ article: http://www.linuxjournal.com/node/8110/print

But I think that the right question is not _how_ to do it but _why_.

The kernel can't assume a filesystem layout and the location of a file.

Can you tell what are you trying to achieve? Maybe there are better
ways to do it.

Best regards,

-- 
Javier Martínez Canillas
(+34) 682 39 81 69
Barcelona, Spain

_______________________________________________
Kernelnewbies mailing list
[email protected]
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

Reply via email to