Vfs_stat for Kernel File System APIs and apivfs_stat for Kernel
Vfs_stat for Kernel File System APIs
Static inline int vfs_stat (const char _ user * filename, struct kstat * stat) is used to find the attribute information of the file represented by the filename parameter, save it to the form parameter stat and return it to the user for source code analysis: static inline int vfs_stat (const char _ user * filename, struct kstat * stat) {return vfs_statx (AT_FDCWD, filename, AT_NO_AUTOMOUNT, stat, STATX_BASIC_STATS);} The basic query information is shown here. Example vfs_statx (int dfd, const char _ user * filename, int flags, struct kstat * stat, u32 requ Est_mask) {struct path; int error =-EINVAL; unsigned int lookup_flags = LOOKUP_FOLLOW | LOOKUP_AUTOMOUNT; # lookup_flagsif (flags &~ (AT_SYMLINK_NOFOLLOW | AT_NO_AUTOMOUNT | AT_EMPTY_PATH | KSTAT_QUERY_FLAGS ))! = 0) return-EINVAL; if (flags & AT_SYMLINK_NOFOLLOW) lookup_flags & = ~ LOOKUP_FOLLOW; if (flags & AT_NO_AUTOMOUNT) lookup_flags & = ~ LOOKUP_AUTOMOUNT; if (flags & tables) lookup_flags | = LOOKUP_EMPTY; retry: # Find the patherror = user_path_at (dfd, filename, lookup_flags, & path); if (error) goto out; # Get the File Attribute Information Based on path and save it to stat. Return error = vfs_getattr (& path, stat, request_mask, flags); path_put (& path ); # When the file property is found, the error is equal to zero if (retry_estale (error, lookup_flags) {lookup_flags | = LOOKUP_REVAL; goto retry;} out: return error ;}