Question

I have a question about the how the file_operations in the struct file is defined in linux kernel

vfs_read() calls

ret = file->f_op->read(file, buf, count, pos);

I know this read is a function pointer, which is defined in some driver code, but is there a way to find where it is actually defined?

Was it helpful?

Solution

VFS is "virtual file system". It is an abstraction over the underlying file system details, which of course differ greatly.

f_op is a set of file_operations that depend on which file system file is using.

For example, look at ext2_file_operations, where the ext2 filesystem exposes to the kernel which functions to use for its file operations.

If you want to see more, look for references to struct file_operations in the fs/ directory.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top