Commit 1d5ccd1c authored by Linus Torvalds's avatar Linus Torvalds

ext[234]: move over to 'check_acl' permission model

Don't implement per-filesystem 'extX_permission()' functions that have
to be called for every path component operation, and instead just expose
the actual ACL checking so that the VFS layer can now do it for us.
Reviewed-by: default avatarJames Morris <jmorris@namei.org>
Acked-by: default avatarSerge Hallyn <serue@us.ibm.com>
Signed-off-by: default avatarLinus Torvalds <torvalds@linux-foundation.org>
parent 6d848a48
...@@ -230,7 +230,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl) ...@@ -230,7 +230,7 @@ ext2_set_acl(struct inode *inode, int type, struct posix_acl *acl)
return error; return error;
} }
static int int
ext2_check_acl(struct inode *inode, int mask) ext2_check_acl(struct inode *inode, int mask)
{ {
struct posix_acl *acl = ext2_get_acl(inode, ACL_TYPE_ACCESS); struct posix_acl *acl = ext2_get_acl(inode, ACL_TYPE_ACCESS);
...@@ -246,12 +246,6 @@ ext2_check_acl(struct inode *inode, int mask) ...@@ -246,12 +246,6 @@ ext2_check_acl(struct inode *inode, int mask)
return -EAGAIN; return -EAGAIN;
} }
int
ext2_permission(struct inode *inode, int mask)
{
return generic_permission(inode, mask, ext2_check_acl);
}
/* /*
* Initialize the ACLs of a new inode. Called from ext2_new_inode. * Initialize the ACLs of a new inode. Called from ext2_new_inode.
* *
......
...@@ -54,13 +54,13 @@ static inline int ext2_acl_count(size_t size) ...@@ -54,13 +54,13 @@ static inline int ext2_acl_count(size_t size)
#ifdef CONFIG_EXT2_FS_POSIX_ACL #ifdef CONFIG_EXT2_FS_POSIX_ACL
/* acl.c */ /* acl.c */
extern int ext2_permission (struct inode *, int); extern int ext2_check_acl (struct inode *, int);
extern int ext2_acl_chmod (struct inode *); extern int ext2_acl_chmod (struct inode *);
extern int ext2_init_acl (struct inode *, struct inode *); extern int ext2_init_acl (struct inode *, struct inode *);
#else #else
#include <linux/sched.h> #include <linux/sched.h>
#define ext2_permission NULL #define ext2_check_acl NULL
#define ext2_get_acl NULL #define ext2_get_acl NULL
#define ext2_set_acl NULL #define ext2_set_acl NULL
......
...@@ -85,6 +85,6 @@ const struct inode_operations ext2_file_inode_operations = { ...@@ -85,6 +85,6 @@ const struct inode_operations ext2_file_inode_operations = {
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.setattr = ext2_setattr, .setattr = ext2_setattr,
.permission = ext2_permission, .check_acl = ext2_check_acl,
.fiemap = ext2_fiemap, .fiemap = ext2_fiemap,
}; };
...@@ -400,7 +400,7 @@ const struct inode_operations ext2_dir_inode_operations = { ...@@ -400,7 +400,7 @@ const struct inode_operations ext2_dir_inode_operations = {
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.setattr = ext2_setattr, .setattr = ext2_setattr,
.permission = ext2_permission, .check_acl = ext2_check_acl,
}; };
const struct inode_operations ext2_special_inode_operations = { const struct inode_operations ext2_special_inode_operations = {
...@@ -411,5 +411,5 @@ const struct inode_operations ext2_special_inode_operations = { ...@@ -411,5 +411,5 @@ const struct inode_operations ext2_special_inode_operations = {
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.setattr = ext2_setattr, .setattr = ext2_setattr,
.permission = ext2_permission, .check_acl = ext2_check_acl,
}; };
...@@ -238,7 +238,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type, ...@@ -238,7 +238,7 @@ ext3_set_acl(handle_t *handle, struct inode *inode, int type,
return error; return error;
} }
static int int
ext3_check_acl(struct inode *inode, int mask) ext3_check_acl(struct inode *inode, int mask)
{ {
struct posix_acl *acl = ext3_get_acl(inode, ACL_TYPE_ACCESS); struct posix_acl *acl = ext3_get_acl(inode, ACL_TYPE_ACCESS);
...@@ -254,12 +254,6 @@ ext3_check_acl(struct inode *inode, int mask) ...@@ -254,12 +254,6 @@ ext3_check_acl(struct inode *inode, int mask)
return -EAGAIN; return -EAGAIN;
} }
int
ext3_permission(struct inode *inode, int mask)
{
return generic_permission(inode, mask, ext3_check_acl);
}
/* /*
* Initialize the ACLs of a new inode. Called from ext3_new_inode. * Initialize the ACLs of a new inode. Called from ext3_new_inode.
* *
......
...@@ -54,13 +54,13 @@ static inline int ext3_acl_count(size_t size) ...@@ -54,13 +54,13 @@ static inline int ext3_acl_count(size_t size)
#ifdef CONFIG_EXT3_FS_POSIX_ACL #ifdef CONFIG_EXT3_FS_POSIX_ACL
/* acl.c */ /* acl.c */
extern int ext3_permission (struct inode *, int); extern int ext3_check_acl (struct inode *, int);
extern int ext3_acl_chmod (struct inode *); extern int ext3_acl_chmod (struct inode *);
extern int ext3_init_acl (handle_t *, struct inode *, struct inode *); extern int ext3_init_acl (handle_t *, struct inode *, struct inode *);
#else /* CONFIG_EXT3_FS_POSIX_ACL */ #else /* CONFIG_EXT3_FS_POSIX_ACL */
#include <linux/sched.h> #include <linux/sched.h>
#define ext3_permission NULL #define ext3_check_acl NULL
static inline int static inline int
ext3_acl_chmod(struct inode *inode) ext3_acl_chmod(struct inode *inode)
......
...@@ -137,7 +137,7 @@ const struct inode_operations ext3_file_inode_operations = { ...@@ -137,7 +137,7 @@ const struct inode_operations ext3_file_inode_operations = {
.listxattr = ext3_listxattr, .listxattr = ext3_listxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.permission = ext3_permission, .check_acl = ext3_check_acl,
.fiemap = ext3_fiemap, .fiemap = ext3_fiemap,
}; };
...@@ -2445,7 +2445,7 @@ const struct inode_operations ext3_dir_inode_operations = { ...@@ -2445,7 +2445,7 @@ const struct inode_operations ext3_dir_inode_operations = {
.listxattr = ext3_listxattr, .listxattr = ext3_listxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.permission = ext3_permission, .check_acl = ext3_check_acl,
}; };
const struct inode_operations ext3_special_inode_operations = { const struct inode_operations ext3_special_inode_operations = {
...@@ -2456,5 +2456,5 @@ const struct inode_operations ext3_special_inode_operations = { ...@@ -2456,5 +2456,5 @@ const struct inode_operations ext3_special_inode_operations = {
.listxattr = ext3_listxattr, .listxattr = ext3_listxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.permission = ext3_permission, .check_acl = ext3_check_acl,
}; };
...@@ -236,7 +236,7 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type, ...@@ -236,7 +236,7 @@ ext4_set_acl(handle_t *handle, struct inode *inode, int type,
return error; return error;
} }
static int int
ext4_check_acl(struct inode *inode, int mask) ext4_check_acl(struct inode *inode, int mask)
{ {
struct posix_acl *acl = ext4_get_acl(inode, ACL_TYPE_ACCESS); struct posix_acl *acl = ext4_get_acl(inode, ACL_TYPE_ACCESS);
...@@ -252,12 +252,6 @@ ext4_check_acl(struct inode *inode, int mask) ...@@ -252,12 +252,6 @@ ext4_check_acl(struct inode *inode, int mask)
return -EAGAIN; return -EAGAIN;
} }
int
ext4_permission(struct inode *inode, int mask)
{
return generic_permission(inode, mask, ext4_check_acl);
}
/* /*
* Initialize the ACLs of a new inode. Called from ext4_new_inode. * Initialize the ACLs of a new inode. Called from ext4_new_inode.
* *
......
...@@ -54,13 +54,13 @@ static inline int ext4_acl_count(size_t size) ...@@ -54,13 +54,13 @@ static inline int ext4_acl_count(size_t size)
#ifdef CONFIG_EXT4_FS_POSIX_ACL #ifdef CONFIG_EXT4_FS_POSIX_ACL
/* acl.c */ /* acl.c */
extern int ext4_permission(struct inode *, int); extern int ext4_check_acl(struct inode *, int);
extern int ext4_acl_chmod(struct inode *); extern int ext4_acl_chmod(struct inode *);
extern int ext4_init_acl(handle_t *, struct inode *, struct inode *); extern int ext4_init_acl(handle_t *, struct inode *, struct inode *);
#else /* CONFIG_EXT4_FS_POSIX_ACL */ #else /* CONFIG_EXT4_FS_POSIX_ACL */
#include <linux/sched.h> #include <linux/sched.h>
#define ext4_permission NULL #define ext4_check_acl NULL
static inline int static inline int
ext4_acl_chmod(struct inode *inode) ext4_acl_chmod(struct inode *inode)
......
...@@ -207,7 +207,7 @@ const struct inode_operations ext4_file_inode_operations = { ...@@ -207,7 +207,7 @@ const struct inode_operations ext4_file_inode_operations = {
.listxattr = ext4_listxattr, .listxattr = ext4_listxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.permission = ext4_permission, .check_acl = ext4_check_acl,
.fallocate = ext4_fallocate, .fallocate = ext4_fallocate,
.fiemap = ext4_fiemap, .fiemap = ext4_fiemap,
}; };
......
...@@ -2536,7 +2536,7 @@ const struct inode_operations ext4_dir_inode_operations = { ...@@ -2536,7 +2536,7 @@ const struct inode_operations ext4_dir_inode_operations = {
.listxattr = ext4_listxattr, .listxattr = ext4_listxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.permission = ext4_permission, .check_acl = ext4_check_acl,
.fiemap = ext4_fiemap, .fiemap = ext4_fiemap,
}; };
...@@ -2548,5 +2548,5 @@ const struct inode_operations ext4_special_inode_operations = { ...@@ -2548,5 +2548,5 @@ const struct inode_operations ext4_special_inode_operations = {
.listxattr = ext4_listxattr, .listxattr = ext4_listxattr,
.removexattr = generic_removexattr, .removexattr = generic_removexattr,
#endif #endif
.permission = ext4_permission, .check_acl = ext4_check_acl,
}; };
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment