aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/fs.h
diff options
context:
space:
mode:
authorMiklos Szeredi <mszeredi@suse.cz>2014-10-23 18:14:36 -0400
committerMiklos Szeredi <mszeredi@suse.cz>2014-10-23 18:14:36 -0400
commitcbdf35bcb833bfd00f0925d7a9a33a21f41ea582 (patch)
treefe76fb2eeaaf2b56d4961840caf97719567c6a88 /include/linux/fs.h
parentc771d683a62e5d36bc46036f5c07f4f5bb7dda61 (diff)
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/linux/fs.h')
-rw-r--r--include/linux/fs.h9
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 **);
2259extern int inode_permission(struct inode *, int); 2259extern int inode_permission(struct inode *, int);
2260extern int __inode_permission(struct inode *, int); 2260extern int __inode_permission(struct inode *, int);
2261extern int generic_permission(struct inode *, int); 2261extern int generic_permission(struct inode *, int);
2262extern int __check_sticky(struct inode *dir, struct inode *inode);
2262 2263
2263static inline bool execute_ok(struct inode *inode) 2264static inline bool execute_ok(struct inode *inode)
2264{ 2265{
@@ -2745,6 +2746,14 @@ static inline int is_sxid(umode_t mode)
2745 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP)); 2746 return (mode & S_ISUID) || ((mode & S_ISGID) && (mode & S_IXGRP));
2746} 2747}
2747 2748
2749static inline int check_sticky(struct inode *dir, struct inode *inode)
2750{
2751 if (!(dir->i_mode & S_ISVTX))
2752 return 0;
2753
2754 return __check_sticky(dir, inode);
2755}
2756
2748static inline void inode_has_no_xattr(struct inode *inode) 2757static inline void inode_has_no_xattr(struct inode *inode)
2749{ 2758{
2750 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC)) 2759 if (!is_sxid(inode->i_mode) && (inode->i_sb->s_flags & MS_NOSEC))