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:
@ -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)
|
||||
{
|
||||
|
Reference in New Issue
Block a user