aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/linux/fs.h')
-rw-r--r--include/linux/fs.h39
1 files changed, 39 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h
index a957d4366c24..4e41a4a331bb 100644
--- a/include/linux/fs.h
+++ b/include/linux/fs.h
@@ -223,6 +223,13 @@ typedef void (dio_iodone_t)(struct kiocb *iocb, loff_t offset,
223#define ATTR_TIMES_SET (1 << 16) 223#define ATTR_TIMES_SET (1 << 16)
224 224
225/* 225/*
226 * Whiteout is represented by a char device. The following constants define the
227 * mode and device number to use.
228 */
229#define WHITEOUT_MODE 0
230#define WHITEOUT_DEV 0
231
232/*
226 * This is the Inode Attributes structure, used for notify_change(). It 233 * This is the Inode Attributes structure, used for notify_change(). It
227 * uses the above definitions as flags, to know which values have changed. 234 * uses the above definitions as flags, to know which values have changed.
228 * Also, in this manner, a Filesystem can look at only the values it cares 235 * Also, in this manner, a Filesystem can look at only the values it cares
@@ -254,6 +261,12 @@ struct iattr {
254 */ 261 */
255#include <linux/quota.h> 262#include <linux/quota.h>
256 263
264/*
265 * Maximum number of layers of fs stack. Needs to be limited to
266 * prevent kernel stack overflow
267 */
268#define FILESYSTEM_MAX_STACK_DEPTH 2
269
257/** 270/**
258 * enum positive_aop_returns - aop return codes with specific semantics 271 * enum positive_aop_returns - aop return codes with specific semantics
259 * 272 *
@@ -1266,6 +1279,11 @@ struct super_block {
1266 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp; 1279 struct list_lru s_dentry_lru ____cacheline_aligned_in_smp;
1267 struct list_lru s_inode_lru ____cacheline_aligned_in_smp; 1280 struct list_lru s_inode_lru ____cacheline_aligned_in_smp;
1268 struct rcu_head rcu; 1281 struct rcu_head rcu;
1282
1283 /*
1284 * Indicates how deep in a filesystem stack this SB is
1285 */
1286 int s_stack_depth;
1269}; 1287};
1270 1288
1271extern struct timespec current_fs_time(struct super_block *sb); 1289extern struct timespec current_fs_time(struct super_block *sb);
@@ -1398,6 +1416,7 @@ extern int vfs_link(struct dentry *, struct inode *, struct dentry *, struct ino
1398extern int vfs_rmdir(struct inode *, struct dentry *); 1416extern int vfs_rmdir(struct inode *, struct dentry *);
1399extern int vfs_unlink(struct inode *, struct dentry *, struct inode **); 1417extern int vfs_unlink(struct inode *, struct dentry *, struct inode **);
1400extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int); 1418extern int vfs_rename(struct inode *, struct dentry *, struct inode *, struct dentry *, struct inode **, unsigned int);
1419extern int vfs_whiteout(struct inode *, struct dentry *);
1401 1420
1402/* 1421/*
1403 * VFS dentry helper functions. 1422 * VFS dentry helper functions.
@@ -1528,6 +1547,9 @@ struct inode_operations {
1528 umode_t create_mode, int *opened); 1547 umode_t create_mode, int *opened);
1529 int (*tmpfile) (struct inode *, struct dentry *, umode_t); 1548 int (*tmpfile) (struct inode *, struct dentry *, umode_t);
1530 int (*set_acl)(struct inode *, struct posix_acl *, int); 1549 int (*set_acl)(struct inode *, struct posix_acl *, int);
1550
1551 /* WARNING: probably going away soon, do not use! */
1552 int (*dentry_open)(struct dentry *, struct file *, const struct cred *);
1531} ____cacheline_aligned; 1553} ____cacheline_aligned;
1532 1554
1533ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector, 1555ssize_t rw_copy_check_uvector(int type, const struct iovec __user * uvector,
@@ -1625,6 +1647,9 @@ struct super_operations {
1625#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT) 1647#define IS_AUTOMOUNT(inode) ((inode)->i_flags & S_AUTOMOUNT)
1626#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC) 1648#define IS_NOSEC(inode) ((inode)->i_flags & S_NOSEC)
1627 1649
1650#define IS_WHITEOUT(inode) (S_ISCHR(inode->i_mode) && \
1651 (inode)->i_rdev == WHITEOUT_DEV)
1652
1628/* 1653/*
1629 * Inode state bits. Protected by inode->i_lock 1654 * Inode state bits. Protected by inode->i_lock
1630 * 1655 *
@@ -2040,6 +2065,7 @@ extern struct file *file_open_name(struct filename *, int, umode_t);
2040extern struct file *filp_open(const char *, int, umode_t); 2065extern struct file *filp_open(const char *, int, umode_t);
2041extern struct file *file_open_root(struct dentry *, struct vfsmount *, 2066extern struct file *file_open_root(struct dentry *, struct vfsmount *,
2042 const char *, int); 2067 const char *, int);
2068extern int vfs_open(const struct path *, struct file *, const struct cred *);
2043extern struct file * dentry_open(const struct path *, int, const struct cred *); 2069extern struct file * dentry_open(const struct path *, int, const struct cred *);
2044extern int filp_close(struct file *, fl_owner_t id); 2070extern int filp_close(struct file *, fl_owner_t id);
2045 2071
@@ -2253,7 +2279,9 @@ extern sector_t bmap(struct inode *, sector_t);
2253#endif 2279#endif
2254extern int notify_change(struct dentry *, struct iattr *, struct inode **); 2280extern int notify_change(struct dentry *, struct iattr *, struct inode **);
2255extern int inode_permission(struct inode *, int); 2281extern int inode_permission(struct inode *, int);
2282extern int __inode_permission(struct inode *, int);
2256extern int generic_permission(struct inode *, int); 2283extern int generic_permission(struct inode *, int);
2284extern int __check_sticky(struct inode *dir, struct inode *inode);
2257 2285
2258static inline bool execute_ok(struct inode *inode) 2286static inline bool execute_ok(struct inode *inode)
2259{ 2287{
@@ -2452,6 +2480,9 @@ extern ssize_t iter_file_splice_write(struct pipe_inode_info *,
2452 struct file *, loff_t *, size_t, unsigned int); 2480 struct file *, loff_t *, size_t, unsigned int);
2453extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe, 2481extern ssize_t generic_splice_sendpage(struct pipe_inode_info *pipe,
2454 struct file *out, loff_t *, size_t len, unsigned int flags); 2482 struct file *out, loff_t *, size_t len, unsigned int flags);
2483extern long do_splice_direct(struct file *in, loff_t *ppos, struct file *out,
2484 loff_t *opos, size_t len, unsigned int flags);
2485
2455 2486
2456extern void 2487extern void
2457file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping); 2488file_ra_state_init(struct file_ra_state *ra, struct address_space *mapping);
@@ -2737,6 +2768,14 @@ static inline int is_sxid(umode_t mode)
2737 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2768 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2738} 2769}
2739 2770
2771static inline int check_sticky(struct inode *dir, struct inode *inode)
2772{
2773 if (!(dir->i_mode & S_ISVTX))
2774 return 0;
2775
2776 return __check_sticky(dir, inode);
2777}
2778
2740static inline void inode_has_no_xattr(struct inode *inode) 2779static inline void inode_has_no_xattr(struct inode *inode)
2741{ 2780{
2742 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) 2781 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))