| 1 - High level view of Relationship between process fd, and structures file,file_operations and inode. | ||||
| My interpretaions.: --------------------- 1- For every process who are opening a same file a strcuture file will be created by kernel and occupy in kernel space. 2- The filed f_op of the strucutre file points to the strucutre file_operations which defines the functions for the operations which can be perfomed on that file like open,write,read,mmap,lseek. etc. 3- if in case a driver is being written for that device( nothing but a file) then f_op will point to that file_oprations structure which is being written in the driver code. The driver code may override the defaul actions of methods which can be performed on that device like open,write,read... etc..... 4- Filesystem driver is the one which fetches the data from HDD by looking into the struct inode for that device file and read the data block belonging to that file from HDD. 5- So whenever a file is created struct inode is created in the inode block of the filesystem. whenever a file is opened by a process then struct file will created in the kernel space. |
||||