diff options
author | Miklos Szeredi <mszeredi@suse.cz> | 2014-10-24 00:14:36 +0200 |
---|---|---|
committer | Miklos Szeredi <mszeredi@suse.cz> | 2014-10-24 00:14:36 +0200 |
commit | cbdf35bcb833bfd00f0925d7a9a33a21f41ea582 (patch) | |
tree | fe76fb2eeaaf2b56d4961840caf97719567c6a88 /include | |
parent | vfs: introduce clone_private_mount() (diff) | |
download | linux-cbdf35bcb833bfd00f0925d7a9a33a21f41ea582.tar.xz linux-cbdf35bcb833bfd00f0925d7a9a33a21f41ea582.zip |
vfs: export check_sticky()
It's already duplicated in btrfs and about to be used in overlayfs too.
Move the sticky bit check to an inline helper and call the out-of-line
helper only in the unlikly case of the sticky bit being set.
Signed-off-by: Miklos Szeredi <mszeredi@suse.cz>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/fs.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/fs.h b/include/linux/fs.h index 5419df70a835..55cc0a319baa 100644 --- a/include/linux/fs.h +++ b/include/linux/fs.h @@ -2259,6 +2259,7 @@ extern int notify_change(struct dentry *, struct iattr *, struct inode **); extern int inode_permission(struct inode *, int); extern int __inode_permission(struct inode *, int); extern int generic_permission(struct inode *, int); +extern int __check_sticky(struct inode *dir, struct inode *inode); static inline bool execute_ok(struct inode *inode) { @@ -2745,6 +2746,14 @@ static inline int is_sxid(umode_t mode) return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); } +static inline int check_sticky(struct inode *dir, struct inode *inode) +{ + if (!(dir->i_mode & S_ISVTX)) + return 0; + + return __check_sticky(dir, inode); +} + static inline void inode_has_no_xattr(struct inode *inode) { if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) |