diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-23 03:10:32 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2011-07-25 14:27:32 -0400 |
commit | 826cae2f2b4d726b925f43bc208a571639da4761 (patch) | |
tree | b7f83eecf3bde8c4e455d89c7c535988b3e8bd59 /fs/reiserfs/xattr_acl.c | |
parent | 95203befa8887997f14077d8557e67d78457ee02 (diff) |
kill boilerplates around posix_acl_create_masq()
new helper: posix_acl_create(&acl, gfp, mode_p). Replaces acl with
modified clone, on failure releases acl and replaces with NULL.
Returns 0 or -ve on error. All callers of posix_acl_create_masq()
switched.
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/reiserfs/xattr_acl.c')
-rw-r--r-- | fs/reiserfs/xattr_acl.c | 30 |
1 files changed, 7 insertions, 23 deletions
diff --git a/fs/reiserfs/xattr_acl.c b/fs/reiserfs/xattr_acl.c index 26b08acf913f..7362cf4c946a 100644 --- a/fs/reiserfs/xattr_acl.c +++ b/fs/reiserfs/xattr_acl.c | |||
@@ -354,9 +354,7 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | |||
354 | return PTR_ERR(acl); | 354 | return PTR_ERR(acl); |
355 | 355 | ||
356 | if (acl) { | 356 | if (acl) { |
357 | struct posix_acl *acl_copy; | ||
358 | mode_t mode = inode->i_mode; | 357 | mode_t mode = inode->i_mode; |
359 | int need_acl; | ||
360 | 358 | ||
361 | /* Copy the default ACL to the default ACL of a new directory */ | 359 | /* Copy the default ACL to the default ACL of a new directory */ |
362 | if (S_ISDIR(inode->i_mode)) { | 360 | if (S_ISDIR(inode->i_mode)) { |
@@ -368,29 +366,15 @@ reiserfs_inherit_default_acl(struct reiserfs_transaction_handle *th, | |||
368 | 366 | ||
369 | /* Now we reconcile the new ACL and the mode, | 367 | /* Now we reconcile the new ACL and the mode, |
370 | potentially modifying both */ | 368 | potentially modifying both */ |
371 | acl_copy = posix_acl_clone(acl, GFP_NOFS); | 369 | err = posix_acl_create(&acl, GFP_NOFS, &mode); |
372 | if (!acl_copy) { | 370 | if (err < 0) |
373 | err = -ENOMEM; | 371 | return err; |
374 | goto cleanup; | ||
375 | } | ||
376 | 372 | ||
377 | need_acl = posix_acl_create_masq(acl_copy, &mode); | 373 | inode->i_mode = mode; |
378 | if (need_acl >= 0) { | ||
379 | if (mode != inode->i_mode) { | ||
380 | inode->i_mode = mode; | ||
381 | } | ||
382 | 374 | ||
383 | /* If we need an ACL.. */ | 375 | /* If we need an ACL.. */ |
384 | if (need_acl > 0) { | 376 | if (err > 0) |
385 | err = reiserfs_set_acl(th, inode, | 377 | err = reiserfs_set_acl(th, inode, ACL_TYPE_ACCESS, acl); |
386 | ACL_TYPE_ACCESS, | ||
387 | acl_copy); | ||
388 | if (err) | ||
389 | goto cleanup_copy; | ||
390 | } | ||
391 | } | ||
392 | cleanup_copy: | ||
393 | posix_acl_release(acl_copy); | ||
394 | cleanup: | 378 | cleanup: |
395 | posix_acl_release(acl); | 379 | posix_acl_release(acl); |
396 | } else { | 380 | } else { |