0

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?

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
jiawen
  • 1,198
  • 2
  • 17
  • 29

1 Answers1

1

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.

Jonathon Reinhart
  • 132,704
  • 33
  • 254
  • 328
  • thanks. I found it. it is defined here http://lxr.free-electrons.com/source/fs/read_write.c?v=3.1;a=arm#L322 – jiawen Jan 24 '14 at 04:43