diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-23 00:18:02 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:27:30 -0400 |
commit | bc26ab5f65ae41b71df86ea46df3c3833d1d8d83 (patch) | |
tree | 85bbc4e0da4fac99ccf31b3609c61e2b148a8498 /fs/btrfs | |
parent | 4482a087d4c5a6ffbc385c56b4a4e2f694d9fd5d (diff) |
kill boilerplate around posix_acl_chmod_masq()
new helper: posix_acl_chmod(&acl, gfp, mode). Replaces acl with modified
clone or with NULL if that has failed; returns 0 or -ve on error. All
callers of posix_acl_chmod_masq() switched to that - they'd been doing
exactly the same thing.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/btrfs')
-rw-r--r-- | fs/btrfs/acl.c | 16 |
1 files changed, 5 insertions, 11 deletions
diff --git a/fs/btrfs/acl.c b/fs/btrfs/acl.c index c13ea9fbf36b..88bca53b302a 100644 --- a/fs/btrfs/acl.c +++ b/fs/btrfs/acl.c | |||
@@ -272,7 +272,7 @@ failed: | |||
272 | 272 | ||
273 | int btrfs_acl_chmod(struct inode *inode) | 273 | int btrfs_acl_chmod(struct inode *inode) |
274 | { | 274 | { |
275 | struct posix_acl *acl, *clone; | 275 | struct posix_acl *acl; |
276 | int ret = 0; | 276 | int ret = 0; |
277 | 277 | ||
278 | if (S_ISLNK(inode->i_mode)) | 278 | if (S_ISLNK(inode->i_mode)) |
@@ -285,17 +285,11 @@ int btrfs_acl_chmod(struct inode *inode) | |||
285 | if (IS_ERR_OR_NULL(acl)) | 285 | if (IS_ERR_OR_NULL(acl)) |
286 | return PTR_ERR(acl); | 286 | return PTR_ERR(acl); |
287 | 287 | ||
288 | clone = posix_acl_clone(acl, GFP_KERNEL); | 288 | ret = posix_acl_chmod(&acl, GFP_KERNEL, inode->i_mode); |
289 | if (ret) | ||
290 | return ret; | ||
291 | ret = btrfs_set_acl(NULL, inode, acl, ACL_TYPE_ACCESS); | ||
289 | posix_acl_release(acl); | 292 | posix_acl_release(acl); |
290 | if (!clone) | ||
291 | return -ENOMEM; | ||
292 | |||
293 | ret = posix_acl_chmod_masq(clone, inode->i_mode); | ||
294 | if (!ret) | ||
295 | ret = btrfs_set_acl(NULL, inode, clone, ACL_TYPE_ACCESS); | ||
296 | |||
297 | posix_acl_release(clone); | ||
298 | |||
299 | return ret; | 293 | return ret; |
300 | } | 294 | } |
301 | 295 | ||