diff options
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r-- | include/linux/fs.h | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 7617ee04f066..2c28271ab9d4 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h | |||
@@ -301,7 +301,7 @@ size_t iov_iter_copy_from_user(struct page *page, | |||
301 | struct iov_iter *i, unsigned long offset, size_t bytes); | 301 | struct iov_iter *i, unsigned long offset, size_t bytes); |
302 | void iov_iter_advance(struct iov_iter *i, size_t bytes); | 302 | void iov_iter_advance(struct iov_iter *i, size_t bytes); |
303 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); | 303 | int iov_iter_fault_in_readable(struct iov_iter *i, size_t bytes); |
304 | size_t iov_iter_single_seg_count(struct iov_iter *i); | 304 | size_t iov_iter_single_seg_count(const struct iov_iter *i); |
305 | 305 | ||
306 | static inline void iov_iter_init(struct iov_iter *i, | 306 | static inline void iov_iter_init(struct iov_iter *i, |
307 | const struct iovec *iov, unsigned long nr_segs, | 307 | const struct iovec *iov, unsigned long nr_segs, |
@@ -769,7 +769,7 @@ struct file { | |||
769 | } f_u; | 769 | } f_u; |
770 | struct path f_path; | 770 | struct path f_path; |
771 | #define f_dentry f_path.dentry | 771 | #define f_dentry f_path.dentry |
772 | #define f_vfsmnt f_path.mnt | 772 | struct inode *f_inode; /* cached value */ |
773 | const struct file_operations *f_op; | 773 | const struct file_operations *f_op; |
774 | 774 | ||
775 | /* | 775 | /* |
@@ -1807,7 +1807,6 @@ struct file_system_type { | |||
1807 | #define FS_HAS_SUBTYPE 4 | 1807 | #define FS_HAS_SUBTYPE 4 |
1808 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ | 1808 | #define FS_USERNS_MOUNT 8 /* Can be mounted by userns root */ |
1809 | #define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ | 1809 | #define FS_USERNS_DEV_MOUNT 16 /* A userns mount does not imply MNT_NODEV */ |
1810 | #define FS_REVAL_DOT 16384 /* Check the paths ".", ".." for staleness */ | ||
1811 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ | 1810 | #define FS_RENAME_DOES_D_MOVE 32768 /* FS will handle d_move() during rename() internally. */ |
1812 | struct dentry *(*mount) (struct file_system_type *, int, | 1811 | struct dentry *(*mount) (struct file_system_type *, int, |
1813 | const char *, void *); | 1812 | const char *, void *); |
@@ -1826,6 +1825,8 @@ struct file_system_type { | |||
1826 | struct lock_class_key i_mutex_dir_key; | 1825 | struct lock_class_key i_mutex_dir_key; |
1827 | }; | 1826 | }; |
1828 | 1827 | ||
1828 | #define MODULE_ALIAS_FS(NAME) MODULE_ALIAS("fs-" NAME) | ||
1829 | |||
1829 | extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, | 1830 | extern struct dentry *mount_ns(struct file_system_type *fs_type, int flags, |
1830 | void *data, int (*fill_super)(struct super_block *, void *, int)); | 1831 | void *data, int (*fill_super)(struct super_block *, void *, int)); |
1831 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, | 1832 | extern struct dentry *mount_bdev(struct file_system_type *fs_type, |
@@ -2217,6 +2218,11 @@ static inline bool execute_ok(struct inode *inode) | |||
2217 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); | 2218 | return (inode->i_mode & S_IXUGO) || S_ISDIR(inode->i_mode); |
2218 | } | 2219 | } |
2219 | 2220 | ||
2221 | static inline struct inode *file_inode(struct file *f) | ||
2222 | { | ||
2223 | return f->f_inode; | ||
2224 | } | ||
2225 | |||
2220 | /* | 2226 | /* |
2221 | * get_write_access() gets write permission for a file. | 2227 | * get_write_access() gets write permission for a file. |
2222 | * put_write_access() releases this write permission. | 2228 | * put_write_access() releases this write permission. |
@@ -2239,7 +2245,7 @@ static inline int get_write_access(struct inode *inode) | |||
2239 | } | 2245 | } |
2240 | static inline int deny_write_access(struct file *file) | 2246 | static inline int deny_write_access(struct file *file) |
2241 | { | 2247 | { |
2242 | struct inode *inode = file->f_path.dentry->d_inode; | 2248 | struct inode *inode = file_inode(file); |
2243 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; | 2249 | return atomic_dec_unless_positive(&inode->i_writecount) ? 0 : -ETXTBSY; |
2244 | } | 2250 | } |
2245 | static inline void put_write_access(struct inode * inode) | 2251 | static inline void put_write_access(struct inode * inode) |
@@ -2249,7 +2255,7 @@ static inline void put_write_access(struct inode * inode) | |||
2249 | static inline void allow_write_access(struct file *file) | 2255 | static inline void allow_write_access(struct file *file) |
2250 | { | 2256 | { |
2251 | if (file) | 2257 | if (file) |
2252 | atomic_inc(&file->f_path.dentry->d_inode->i_writecount); | 2258 | atomic_inc(&file_inode(file)->i_writecount); |
2253 | } | 2259 | } |
2254 | #ifdef CONFIG_IMA | 2260 | #ifdef CONFIG_IMA |
2255 | static inline void i_readcount_dec(struct inode *inode) | 2261 | static inline void i_readcount_dec(struct inode *inode) |
@@ -2274,6 +2280,7 @@ static inline void i_readcount_inc(struct inode *inode) | |||
2274 | extern int do_pipe_flags(int *, int); | 2280 | extern int do_pipe_flags(int *, int); |
2275 | 2281 | ||
2276 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); | 2282 | extern int kernel_read(struct file *, loff_t, char *, unsigned long); |
2283 | extern ssize_t kernel_write(struct file *, const char *, size_t, loff_t); | ||
2277 | extern struct file * open_exec(const char *); | 2284 | extern struct file * open_exec(const char *); |
2278 | 2285 | ||
2279 | /* fs/dcache.c -- generic fs support functions */ | 2286 | /* fs/dcache.c -- generic fs support functions */ |
@@ -2463,7 +2470,7 @@ extern int page_symlink(struct inode *inode, const char *symname, int len); | |||
2463 | extern const struct inode_operations page_symlink_inode_operations; | 2470 | extern const struct inode_operations page_symlink_inode_operations; |
2464 | extern int generic_readlink(struct dentry *, char __user *, int); | 2471 | extern int generic_readlink(struct dentry *, char __user *, int); |
2465 | extern void generic_fillattr(struct inode *, struct kstat *); | 2472 | extern void generic_fillattr(struct inode *, struct kstat *); |
2466 | extern int vfs_getattr(struct vfsmount *, struct dentry *, struct kstat *); | 2473 | extern int vfs_getattr(struct path *, struct kstat *); |
2467 | void __inode_add_bytes(struct inode *inode, loff_t bytes); | 2474 | void __inode_add_bytes(struct inode *inode, loff_t bytes); |
2468 | void inode_add_bytes(struct inode *inode, loff_t bytes); | 2475 | void inode_add_bytes(struct inode *inode, loff_t bytes); |
2469 | void inode_sub_bytes(struct inode *inode, loff_t bytes); | 2476 | void inode_sub_bytes(struct inode *inode, loff_t bytes); |