简体   繁体   中英

About file operation in linux kernel

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM