summaryrefslogtreecommitdiffstats
path: root/xlators/system
diff options
context:
space:
mode:
authorAmar Tumballi <amarts@redhat.com>2019-04-01 09:55:54 +0530
committerAmar Tumballi <amarts@redhat.com>2019-04-03 04:27:46 +0000
commite3ef34cc33772e1f05a6a3dbaad2352f6561e5f0 (patch)
tree3dd7dabed9fd86ffa08ed10e9fdaa17be3b6b9b6 /xlators/system
parentec1b84300fe267dd12c1e42e7e91905db935f1e2 (diff)
posix-acl: remove default functions, and use library fn instead
this works as a better solution, as we reuse more functions from library. Also just do write/read on a file when acl is enabled, so we can see improvement in code coverage. updates: bz#1693692 Change-Id: If3359260c8ec2cf4fcf148fb4b95fdecc922c252 Signed-off-by: Amar Tumballi <amarts@redhat.com>
Diffstat (limited to 'xlators/system')
-rw-r--r--xlators/system/posix-acl/src/posix-acl.c183
1 files changed, 18 insertions, 165 deletions
diff --git a/xlators/system/posix-acl/src/posix-acl.c b/xlators/system/posix-acl/src/posix-acl.c
index 38e48b8ced3..bae47bdfcac 100644
--- a/xlators/system/posix-acl/src/posix-acl.c
+++ b/xlators/system/posix-acl/src/posix-acl.c
@@ -12,6 +12,7 @@
#include <glusterfs/xlator.h>
#include <glusterfs/glusterfs.h>
+#include <glusterfs/defaults.h>
#include "posix-acl.h"
#include "posix-acl-xattr.h"
@@ -608,9 +609,8 @@ posix_acl_set_specific(inode_t *inode, xlator_t *this, struct posix_acl *acl,
}
UNLOCK(&conf->acl_lock);
- if (oldret == 0) {
- if (old_acl)
- posix_acl_unref(this, old_acl);
+ if (!oldret && old_acl) {
+ posix_acl_unref(this, old_acl);
}
return ret;
@@ -1113,17 +1113,6 @@ unwind:
}
int
-posix_acl_truncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct iatt *prebuf,
- struct iatt *postbuf, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(truncate, frame, op_ret, op_errno, prebuf, postbuf,
- xdata);
-
- return 0;
-}
-
-int
posix_acl_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t off,
dict_t *xdata)
{
@@ -1146,21 +1135,12 @@ posix_acl_truncate(call_frame_t *frame, xlator_t *this, loc_t *loc, off_t off,
return 0;
green:
- STACK_WIND(frame, posix_acl_truncate_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_truncate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->truncate, loc, off, xdata);
return 0;
}
int
-posix_acl_open_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, fd_t *fd, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(open, frame, op_ret, op_errno, fd, xdata);
-
- return 0;
-}
-
-int
posix_acl_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
fd_t *fd, dict_t *xdata)
{
@@ -1193,7 +1173,7 @@ posix_acl_open(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
else
goto red;
green:
- STACK_WIND(frame, posix_acl_open_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_open_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->open, loc, flags, fd, xdata);
return 0;
red:
@@ -1202,16 +1182,6 @@ red:
}
int
-posix_acl_readv_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct iovec *vector, int count,
- struct iatt *stbuf, struct iobref *iobref, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(readv, frame, op_ret, op_errno, vector, count, stbuf,
- iobref, xdata);
- return 0;
-}
-
-int
posix_acl_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, uint32_t flags, dict_t *xdata)
{
@@ -1224,7 +1194,7 @@ posix_acl_readv(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
goto red;
green:
- STACK_WIND(frame, posix_acl_readv_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_readv_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readv, fd, size, offset, flags, xdata);
return 0;
red:
@@ -1233,16 +1203,6 @@ red:
}
int
-posix_acl_writev_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct iatt *prebuf,
- struct iatt *postbuf, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(writev, frame, op_ret, op_errno, prebuf, postbuf,
- xdata);
- return 0;
-}
-
-int
posix_acl_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
struct iovec *vector, int count, off_t offset, uint32_t flags,
struct iobref *iobref, dict_t *xdata)
@@ -1256,7 +1216,7 @@ posix_acl_writev(call_frame_t *frame, xlator_t *this, fd_t *fd,
goto red;
green:
- STACK_WIND(frame, posix_acl_writev_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_writev_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->writev, fd, vector, count, offset,
flags, iobref, xdata);
return 0;
@@ -1266,16 +1226,6 @@ red:
}
int
-posix_acl_ftruncate_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct iatt *prebuf,
- struct iatt *postbuf, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(ftruncate, frame, op_ret, op_errno, prebuf, postbuf,
- xdata);
- return 0;
-}
-
-int
posix_acl_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
dict_t *xdata)
{
@@ -1288,7 +1238,7 @@ posix_acl_ftruncate(call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset,
goto red;
green:
- STACK_WIND(frame, posix_acl_ftruncate_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_ftruncate_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->ftruncate, fd, offset, xdata);
return 0;
red:
@@ -1297,15 +1247,6 @@ red:
}
int
-posix_acl_opendir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, fd_t *fd, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(opendir, frame, op_ret, op_errno, fd, xdata);
-
- return 0;
-}
-
-int
posix_acl_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
dict_t *xdata)
{
@@ -1314,7 +1255,7 @@ posix_acl_opendir(call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd,
else
goto red;
green:
- STACK_WIND(frame, posix_acl_opendir_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_opendir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->opendir, loc, fd, xdata);
return 0;
red:
@@ -1478,16 +1419,6 @@ red:
}
int
-posix_acl_unlink_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(unlink, frame, op_ret, op_errno, preparent, postparent,
- xdata);
- return 0;
-}
-
-int
posix_acl_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
dict_t *xdata)
{
@@ -1499,7 +1430,7 @@ posix_acl_unlink(call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag,
else
goto red;
green:
- STACK_WIND(frame, posix_acl_unlink_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_unlink_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->unlink, loc, xflag, xdata);
return 0;
red:
@@ -1508,16 +1439,6 @@ red:
}
int
-posix_acl_rmdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct iatt *preparent,
- struct iatt *postparent, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(rmdir, frame, op_ret, op_errno, preparent, postparent,
- xdata);
- return 0;
-}
-
-int
posix_acl_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
dict_t *xdata)
{
@@ -1529,7 +1450,7 @@ posix_acl_rmdir(call_frame_t *frame, xlator_t *this, loc_t *loc, int flags,
else
goto red;
green:
- STACK_WIND(frame, posix_acl_rmdir_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_rmdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rmdir, loc, flags, xdata);
return 0;
red:
@@ -1538,18 +1459,6 @@ red:
}
int
-posix_acl_rename_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, struct iatt *buf,
- struct iatt *preoldparent, struct iatt *postoldparent,
- struct iatt *prenewparent, struct iatt *postnewparent,
- dict_t *xdata)
-{
- STACK_UNWIND_STRICT(rename, frame, op_ret, op_errno, buf, preoldparent,
- postoldparent, prenewparent, postnewparent, xdata);
- return 0;
-}
-
-int
posix_acl_rename(call_frame_t *frame, xlator_t *this, loc_t *old, loc_t *new,
dict_t *xdata)
{
@@ -1567,7 +1476,7 @@ posix_acl_rename(call_frame_t *frame, xlator_t *this, loc_t *old, loc_t *new,
goto red;
}
- STACK_WIND(frame, posix_acl_rename_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_rename_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->rename, old, new, xdata);
return 0;
red:
@@ -1577,17 +1486,6 @@ red:
}
int
-posix_acl_link_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, inode_t *inode, struct iatt *buf,
- struct iatt *preparent, struct iatt *postparent,
- dict_t *xdata)
-{
- STACK_UNWIND_STRICT(link, frame, op_ret, op_errno, inode, buf, preparent,
- postparent, xdata);
- return 0;
-}
-
-int
posix_acl_link(call_frame_t *frame, xlator_t *this, loc_t *old, loc_t *new,
dict_t *xdata)
{
@@ -1610,7 +1508,7 @@ posix_acl_link(call_frame_t *frame, xlator_t *this, loc_t *old, loc_t *new,
goto red;
}
- STACK_WIND(frame, posix_acl_link_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_link_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->link, old, new, xdata);
return 0;
red:
@@ -1621,15 +1519,6 @@ red:
}
int
-posix_acl_readdir_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, gf_dirent_t *entries,
- dict_t *xdata)
-{
- STACK_UNWIND_STRICT(readdir, frame, op_ret, op_errno, entries, xdata);
- return 0;
-}
-
-int
posix_acl_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
off_t offset, dict_t *xdata)
{
@@ -1638,7 +1527,7 @@ posix_acl_readdir(call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size,
else
goto red;
green:
- STACK_WIND(frame, posix_acl_readdir_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_readdir_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->readdir, fd, size, offset, xdata);
return 0;
red:
@@ -2094,15 +1983,6 @@ red:
}
int
-posix_acl_fsetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(fsetxattr, frame, op_ret, op_errno, xdata);
-
- return 0;
-}
-
-int
posix_acl_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
dict_t *xattr, int flags, dict_t *xdata)
{
@@ -2117,7 +1997,7 @@ posix_acl_fsetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
dict_get(xattr, POSIX_ACL_DEFAULT_XATTR))
posix_acl_setxattr_update(this, fd->inode, xattr);
- STACK_WIND(frame, posix_acl_fsetxattr_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_fsetxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fsetxattr, fd, xattr, flags, xdata);
return 0;
red:
@@ -2127,15 +2007,6 @@ red:
}
int
-posix_acl_getxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, dict_t *xattr, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(getxattr, frame, op_ret, op_errno, xattr, xdata);
-
- return 0;
-}
-
-int
posix_acl_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
@@ -2148,7 +2019,7 @@ posix_acl_getxattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
goto red;
green:
- STACK_WIND(frame, posix_acl_getxattr_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_getxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->getxattr, loc, name, xdata);
return 0;
@@ -2159,15 +2030,6 @@ red:
}
int
-posix_acl_fgetxattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, dict_t *xattr, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(fgetxattr, frame, op_ret, op_errno, xattr, xdata);
-
- return 0;
-}
-
-int
posix_acl_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
const char *name, dict_t *xdata)
{
@@ -2179,7 +2041,7 @@ posix_acl_fgetxattr(call_frame_t *frame, xlator_t *this, fd_t *fd,
else
goto red;
green:
- STACK_WIND(frame, posix_acl_fgetxattr_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_fgetxattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->fgetxattr, fd, name, xdata);
return 0;
red:
@@ -2189,15 +2051,6 @@ red:
}
int
-posix_acl_removexattr_cbk(call_frame_t *frame, void *cookie, xlator_t *this,
- int op_ret, int op_errno, dict_t *xdata)
-{
- STACK_UNWIND_STRICT(removexattr, frame, op_ret, op_errno, xdata);
-
- return 0;
-}
-
-int
posix_acl_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
const char *name, dict_t *xdata)
{
@@ -2225,7 +2078,7 @@ posix_acl_removexattr(call_frame_t *frame, xlator_t *this, loc_t *loc,
else
goto red;
green:
- STACK_WIND(frame, posix_acl_removexattr_cbk, FIRST_CHILD(this),
+ STACK_WIND(frame, default_removexattr_cbk, FIRST_CHILD(this),
FIRST_CHILD(this)->fops->removexattr, loc, name, xdata);
return 0;
red: