LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Kernel (https://www.linuxquestions.org/questions/linux-kernel-70/)
-   -   tracking a file in user and Kernel space (https://www.linuxquestions.org/questions/linux-kernel-70/tracking-a-file-in-user-and-kernel-space-772501/)

viswesh530 11-30-2009 02:10 PM

tracking a file in user and Kernel space
 
Hi,

I am a Linux newbie and am currently looking at understanding the operation of the VFS, specifically the read and write operation. I have created a file using open() and am reading from it using the read() call. I want to print information like the read ahead size, block/segment information each time from the kernel whenever this specific file is accessed. Any pointers on how I could identify the file uniquely in my application as well as from vfs would be extremely helpful. Looking forward to the responses...

syg00 12-01-2009 02:48 AM

The VFS is an abstraction layer that is designed to specifically hide those sort of details. Nobody(*) cares. What matters is that application writers can write generic code, and "something" manages to get it out to (or from) the device. Whatever that device is, and whatever its capabilities.
To get into ugly details, you need to be talking at the block device driver layer. Which is what the VFS is protecting you from.
Userspace uses file descriptors to reference files - kernelspace cares about inodes. Have a look at task_struct.

viswesh530 12-03-2009 12:08 PM

Thanks a lot Syg00..I see your point..i managed to get the information I was looking for using plain old printk statements.


All times are GMT -5. The time now is 07:11 PM.