Vfs_statfs for Kernel File System API, kernel apivfs_statfs
Kernel File System API-vfs_statfs
Int vfs_statfs (const struct path * path, struct kstatfs * buf) is used to return the results returned by the mount point of the file indicated by the path parameter and the valid flags of the super block. The structure is as follows: struct kstatfs {long f_type; long f_bsize; u64 f_blocks; u64 f_bfree; u64 f_bavail; u64 f_files; u64 f_ffree ;__ kernel_fsid_t f_fsid; long f_namelen; long f_frsize; long f_flags; long f_spare [4];}; source code analysis: int vfs_statfs (const struct path * path, struct kstatfs * buf) {int error; # Check pat Whether the dentry corresponding to h has errorerror = statfs_by_dentry (path-> dentry, buf); if (! Error) # If no error exists, the effective flagsbuf-> f_flags = calculate_f_flags (path-> mnt); return error;} of the mount point and super block are returned ;} the following function clearly shows that effective flagsstatic int calculate_f_flags (struct vfsmount * mnt) {return ST_VALID | flags_by_mnt (mnt-> mnt_flags) of mnt and super blocks are returned) | flags_by_sb (mnt-> mnt_sb-> s_flags );}