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>
This commit is contained in:
Al Viro
2011-07-23 03:10:32 -04:00
parent 95203befa8
commit 826cae2f2b
16 changed files with 114 additions and 202 deletions

View File

@ -387,6 +387,24 @@ posix_acl_chmod_masq(struct posix_acl *acl, mode_t mode)
return 0;
}
int
posix_acl_create(struct posix_acl **acl, gfp_t gfp, mode_t *mode_p)
{
struct posix_acl *clone = posix_acl_clone(*acl, gfp);
int err = -ENOMEM;
if (clone) {
err = posix_acl_create_masq(clone, mode_p);
if (err < 0) {
posix_acl_release(clone);
clone = NULL;
}
}
posix_acl_release(*acl);
*acl = clone;
return err;
}
EXPORT_SYMBOL(posix_acl_create);
int
posix_acl_chmod(struct posix_acl **acl, gfp_t gfp, mode_t mode)
{