diff options
author | Christoph Hellwig <hch@lst.de> | 2011-07-23 11:37:31 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:30:23 -0400 |
commit | 4e34e719e457f2e031297175410fc0bd4016a085 (patch) | |
tree | ab969a371e0d2efc6bfbf503ca6cdfce3af3bf6c /fs/jffs2 | |
parent | edde854e8bb34a7f32fa993d721f1da0faf64165 (diff) |
fs: take the ACL checks to common code
Replace the ->check_acl method with a ->get_acl method that simply reads an
ACL from disk after having a cache miss. This means we can replace the ACL
checking boilerplate code with a single implementation in namei.c.
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/jffs2')
-rw-r--r-- | fs/jffs2/acl.c | 18 | ||||
-rw-r--r-- | fs/jffs2/acl.h | 4 | ||||
-rw-r--r-- | fs/jffs2/dir.c | 2 | ||||
-rw-r--r-- | fs/jffs2/file.c | 2 | ||||
-rw-r--r-- | fs/jffs2/symlink.c | 2 |
5 files changed, 6 insertions, 22 deletions
diff --git a/fs/jffs2/acl.c b/fs/jffs2/acl.c index 5783ed81171b..27c511a1cf05 100644 --- a/fs/jffs2/acl.c +++ b/fs/jffs2/acl.c | |||
@@ -156,7 +156,7 @@ static void *jffs2_acl_to_medium(const struct posix_acl *acl, size_t *size) | |||
156 | return ERR_PTR(-EINVAL); | 156 | return ERR_PTR(-EINVAL); |
157 | } | 157 | } |
158 | 158 | ||
159 | static struct posix_acl *jffs2_get_acl(struct inode *inode, int type) | 159 | struct posix_acl *jffs2_get_acl(struct inode *inode, int type) |
160 | { | 160 | { |
161 | struct posix_acl *acl; | 161 | struct posix_acl *acl; |
162 | char *value = NULL; | 162 | char *value = NULL; |
@@ -259,22 +259,6 @@ static int jffs2_set_acl(struct inode *inode, int type, struct posix_acl *acl) | |||
259 | return rc; | 259 | return rc; |
260 | } | 260 | } |
261 | 261 | ||
262 | int jffs2_check_acl(struct inode *inode, int mask) | ||
263 | { | ||
264 | struct posix_acl *acl; | ||
265 | int rc; | ||
266 | |||
267 | acl = jffs2_get_acl(inode, ACL_TYPE_ACCESS); | ||
268 | if (IS_ERR(acl)) | ||
269 | return PTR_ERR(acl); | ||
270 | if (acl) { | ||
271 | rc = posix_acl_permission(inode, acl, mask); | ||
272 | posix_acl_release(acl); | ||
273 | return rc; | ||
274 | } | ||
275 | return -EAGAIN; | ||
276 | } | ||
277 | |||
278 | int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, mode_t *i_mode) | 262 | int jffs2_init_acl_pre(struct inode *dir_i, struct inode *inode, mode_t *i_mode) |
279 | { | 263 | { |
280 | struct posix_acl *acl; | 264 | struct posix_acl *acl; |
diff --git a/fs/jffs2/acl.h b/fs/jffs2/acl.h index 9973073b9c47..b3421c78d9f8 100644 --- a/fs/jffs2/acl.h +++ b/fs/jffs2/acl.h | |||
@@ -26,7 +26,7 @@ struct jffs2_acl_header { | |||
26 | 26 | ||
27 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL | 27 | #ifdef CONFIG_JFFS2_FS_POSIX_ACL |
28 | 28 | ||
29 | extern int jffs2_check_acl(struct inode *, int); | 29 | struct posix_acl *jffs2_get_acl(struct inode *inode, int type); |
30 | extern int jffs2_acl_chmod(struct inode *); | 30 | extern int jffs2_acl_chmod(struct inode *); |
31 | extern int jffs2_init_acl_pre(struct inode *, struct inode *, mode_t *); | 31 | extern int jffs2_init_acl_pre(struct inode *, struct inode *, mode_t *); |
32 | extern int jffs2_init_acl_post(struct inode *); | 32 | extern int jffs2_init_acl_post(struct inode *); |
@@ -36,7 +36,7 @@ extern const struct xattr_handler jffs2_acl_default_xattr_handler; | |||
36 | 36 | ||
37 | #else | 37 | #else |
38 | 38 | ||
39 | #define jffs2_check_acl (NULL) | 39 | #define jffs2_get_acl (NULL) |
40 | #define jffs2_acl_chmod(inode) (0) | 40 | #define jffs2_acl_chmod(inode) (0) |
41 | #define jffs2_init_acl_pre(dir_i,inode,mode) (0) | 41 | #define jffs2_init_acl_pre(dir_i,inode,mode) (0) |
42 | #define jffs2_init_acl_post(inode) (0) | 42 | #define jffs2_init_acl_post(inode) (0) |
diff --git a/fs/jffs2/dir.c b/fs/jffs2/dir.c index 5f243cd63afc..9659b7c00468 100644 --- a/fs/jffs2/dir.c +++ b/fs/jffs2/dir.c | |||
@@ -56,7 +56,7 @@ const struct inode_operations jffs2_dir_inode_operations = | |||
56 | .rmdir = jffs2_rmdir, | 56 | .rmdir = jffs2_rmdir, |
57 | .mknod = jffs2_mknod, | 57 | .mknod = jffs2_mknod, |
58 | .rename = jffs2_rename, | 58 | .rename = jffs2_rename, |
59 | .check_acl = jffs2_check_acl, | 59 | .get_acl = jffs2_get_acl, |
60 | .setattr = jffs2_setattr, | 60 | .setattr = jffs2_setattr, |
61 | .setxattr = jffs2_setxattr, | 61 | .setxattr = jffs2_setxattr, |
62 | .getxattr = jffs2_getxattr, | 62 | .getxattr = jffs2_getxattr, |
diff --git a/fs/jffs2/file.c b/fs/jffs2/file.c index 3989f7e09f7f..61e6723535b9 100644 --- a/fs/jffs2/file.c +++ b/fs/jffs2/file.c | |||
@@ -63,7 +63,7 @@ const struct file_operations jffs2_file_operations = | |||
63 | 63 | ||
64 | const struct inode_operations jffs2_file_inode_operations = | 64 | const struct inode_operations jffs2_file_inode_operations = |
65 | { | 65 | { |
66 | .check_acl = jffs2_check_acl, | 66 | .get_acl = jffs2_get_acl, |
67 | .setattr = jffs2_setattr, | 67 | .setattr = jffs2_setattr, |
68 | .setxattr = jffs2_setxattr, | 68 | .setxattr = jffs2_setxattr, |
69 | .getxattr = jffs2_getxattr, | 69 | .getxattr = jffs2_getxattr, |
diff --git a/fs/jffs2/symlink.c b/fs/jffs2/symlink.c index b955626071c2..e3035afb1814 100644 --- a/fs/jffs2/symlink.c +++ b/fs/jffs2/symlink.c | |||
@@ -20,7 +20,7 @@ const struct inode_operations jffs2_symlink_inode_operations = | |||
20 | { | 20 | { |
21 | .readlink = generic_readlink, | 21 | .readlink = generic_readlink, |
22 | .follow_link = jffs2_follow_link, | 22 | .follow_link = jffs2_follow_link, |
23 | .check_acl = jffs2_check_acl, | 23 | .get_acl = jffs2_get_acl, |
24 | .setattr = jffs2_setattr, | 24 | .setattr = jffs2_setattr, |
25 | .setxattr = jffs2_setxattr, | 25 | .setxattr = jffs2_setxattr, |
26 | .getxattr = jffs2_getxattr, | 26 | .getxattr = jffs2_getxattr, |