You don't. (there is code in 2.4.* kernels to make this possible,
however).
: shall I look in the source code for the implementation of read() system
: call??? I couldn't figure out where it is.
It's nowhere and everywhere. Each block device will provide it's own
implementation of read. They'll be read/write of BLOCKs, however.
It'll be your file system that translates r/w calls on FILEs to r/w
calls on blocks.
Peter
Instead, have a user mode helper application send it to you.
This has been discussed on linux-kernel several times.
Here is one particular response:
http://www.uwsg.indiana.edu/hypermail/linux/kernel/0005.3/0061.html
More can be found at:
http://www.uwsg.indiana.edu/hypermail/linux/kernel/index.html
Do a search on "open file kernel mode"
mrc
--
Mike Castle Life is like a clock: You can work constantly
www.netcom.com/~dalgoda/ and be right at least twice a day. -- mrc
We are all of us living in the shadow of Manhattan. -- Watchmen
1. Accessing files from within a kernel module
I need to read a file from within a kernel module (a pseudo block device
driver).
The file is a simple ASCII in /opt, I couldn't figure out a metode to open
and read from it.
I'm trying to open with filp_open() and then read using the read pointed by
the file->dentry->inode->file operation structure i get, but the open()
fails with error code -14
May it is because I allocate the buffer in kernel space, while I should pass
a userspace pointer?
I'd really appreciate any hints, thanks.
2. for (i=1, i<y, i++){do something} in sh
3. Can not open a file within a kernel module
4. Solaris-2.4 and LaserWriter help..
5. File access within a kernel mod
7. How can I tell if a kernel module is loaded from within kernel code?
8. Bad network performance on firewall host.
9. Environment Variables- access from within module
10. Accessing files / network from inside kernel module
11. Kernel Driver Module accessing a text file: How to?
12. Normal file access in a kernel module
13. Kernel Driver Module accessing a text file: How to?