0.sys_open ()
(1) Find an idle item from the Open File table of the current process get_unused_fs ()
(2) Establish the context Filp_open () of file read and write (see 1)
(3) Install the context in the File open table
1.filp_open (): Creating a context for file reading and writing
(1) Get the Dentry and Vfsmount:open_namei () pointing to the filename.
If only open, search by Path_init () and Path_walk ()
If there is a requirement to create, then (see 3)
3. Get the Dentry and vfsmount that point to the filename, if not, create
(1) Find the parent dentry of the path_name corresponding node
(2) Find the dentry of the target file
(3) If not present, create dentry:vfs_create () (see 4)
(4) Judge Dentry:
In the case of an installation point, access to the installed file system
If a join symbol, expand the target node, go to 3-(1)
(5) The inode is calculated by Dentry
(6) Various inspection of the Inode
(7) If necessary, truncate the file
A. The content after the length of the cut
B. Modifying the Inode
C. Hooking the inode into a dirty queue
4.vfs_create (): Creating a dentry for a file
(1) Create a file on the storage device in the index node and in-memory Inode:ext2_new_inode ()
(2) write the filename of the target file and the index node number to the directory Ext2_add_entry ()
(3) Linking the dentry structure of the target file with the Inode structure d_instantiate ()