diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 36 |
1 files changed, 32 insertions, 4 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index caa8e8879f4b..540004970ad5 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -1192,6 +1192,8 @@ static inline int ra_has_index(struct file_ra_state *ra, pgoff_t index) * @f_cred: stashed credentials of creator/opener * @f_owner: file owner * @f_path: path of the file + * @__f_path: writable alias for @f_path; *ONLY* for core VFS and only before + * the file gets open * @f_pos_lock: lock protecting file position * @f_pipe: specific to pipes * @f_pos: file position @@ -1217,7 +1219,10 @@ struct file { const struct cred *f_cred; struct fown_struct *f_owner; /* --- cacheline 1 boundary (64 bytes) --- */ - struct path f_path; + union { + const struct path f_path; + struct path __f_path; + }; union { /* regular files (with FMODE_ATOMIC_POS) and directories */ struct mutex f_pos_lock; @@ -2877,7 +2882,7 @@ struct file *dentry_open_nonotify(const struct path *path, int flags, const struct cred *cred); struct file *dentry_create(const struct path *path, int flags, umode_t mode, const struct cred *cred); -struct path *backing_file_user_path(const struct file *f); +const struct path *backing_file_user_path(const struct file *f); /* * When mmapping a file on a stackable filesystem (e.g., overlayfs), the file @@ -3739,12 +3744,35 @@ static inline bool generic_ci_validate_strict_name(struct inode *dir, } #endif +static inline struct unicode_map *sb_encoding(const struct super_block *sb) +{ +#if IS_ENABLED(CONFIG_UNICODE) + return sb->s_encoding; +#else + return NULL; +#endif +} + static inline bool sb_has_encoding(const struct super_block *sb) { + return !!sb_encoding(sb); +} + +/* + * Compare if two super blocks have the same encoding and flags + */ +static inline bool sb_same_encoding(const struct super_block *sb1, + const struct super_block *sb2) +{ #if IS_ENABLED(CONFIG_UNICODE) - return !!sb->s_encoding; + if (sb1->s_encoding == sb2->s_encoding) + return true; + + return (sb1->s_encoding && sb2->s_encoding && + (sb1->s_encoding->version == sb2->s_encoding->version) && + (sb1->s_encoding_flags == sb2->s_encoding_flags)); #else - return false; + return true; #endif } |