struct path {

struct vfsmount *mnt; struct dentry *dentry;

struct dentry provides a connection between filename and inode. I discuss it in Section 8.3.5. Information about the mounted filesystem is contained in struct vfs_mount, discussed in Section 8.4.1.

Since former kernel versions did not use struct path but had explicit dentry and vfsmount members in struct file, corresponding helper macros are required ensuring that code that is not yet updated continues to work.

f_version; *f_mapping;

□ f_op specifies the functions invoked for file operations (see Section 8.3.4).

□ f_version is used by filesystems to check whether a file instance is still compatible with the contents of the associated inode. This is important to ensure the consistency of cached objects.

□ mapping points to the address space mapping that belongs to the inode instance with which the file is associated. Usually, it is a shorthand for inode->i_mapping, but filesystems or other subsystems of the kernel may modify it for their purposes, which I will not discuss any further.

Every superblock provides an s_list list head element to hold file objects — linked by means of file->f_list. The list includes all opened files of the filesystem represented by the superblock. It is scanned when, for example, a filesystem in Read/Write mode is to be remounted in Read Only mode. Of course, this cannot be done if files are still open in Write mode — and the kernel checks this list to find out.8

file instances can be reserved with get_empty_filp, which employs its own cache and pre-initializes the instances with essential data.

Continue reading here: Fsfilec

Was this article helpful?

0 0