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/posix_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/posix_acl.c')
-rw-r--r-- | fs/posix_acl.c | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/fs/posix_acl.c b/fs/posix_acl.c index 0aa9f167672..365a0712da6 100644 --- a/fs/posix_acl.c +++ b/fs/posix_acl.c @@ -388,6 +388,24 @@ posix_acl_chmod_masq(struct posix_acl *acl, mode_t mode) } 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) { struct posix_acl *clone = posix_acl_clone(*acl, gfp); |