diff options
author | Zhou Zhengping <johnzzpcrystal@gmail.com> | 2017-04-17 10:06:20 +0800 |
---|---|---|
committer | Jeff Darcy <jeff@pl.atyp.us> | 2017-04-21 14:36:57 +0000 |
commit | b5ebf8adf6127e052ac0dae42051a5f1f791343d (patch) | |
tree | 8fd8e8f4f916a6e3f7bd01f26b0c8127d287c1d9 /xlators/debug/error-gen/src | |
parent | e5f9ba138571bd18226462c49ff6a55f5c3ed3a4 (diff) |
debug/error-gen: Use STACK_WIND_TAIL instead of STACK_WIND
Also remove unnecessary fop cbks, which are no longer necessary.
1.We don't need to call STACK_WIND if we care nothing in cbk stack, so
I use STACK_WIND_TAIL instead of STACK_WIND without new a frame
2.Fix several indent problems
3.Fix return value issues in init and reconfigure
Change-Id: Id57a68fec39b5b47cd4ff77664399ed3ef1d3888
Signed-off-by: Zhou Zhengping <johnzzpcrystal@gmail.com>
Reviewed-on: https://review.gluster.org/17062
NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
Reviewed-by: Jeff Darcy <jeff@pl.atyp.us>
Smoke: Gluster Build System <jenkins@build.gluster.org>
Diffstat (limited to 'xlators/debug/error-gen/src')
-rw-r--r-- | xlators/debug/error-gen/src/error-gen.c | 653 |
1 files changed, 87 insertions, 566 deletions
diff --git a/xlators/debug/error-gen/src/error-gen.c b/xlators/debug/error-gen/src/error-gen.c index 103c302d3ba..f86a6bb0257 100644 --- a/xlators/debug/error-gen/src/error-gen.c +++ b/xlators/debug/error-gen/src/error-gen.c @@ -10,6 +10,7 @@ #include "xlator.h" #include "error-gen.h" #include "statedump.h" +#include "defaults.h" sys_error_t error_no_list[] = { [GF_FOP_LOOKUP] = { .error_no_count = 4, @@ -374,18 +375,6 @@ error_gen (xlator_t *this, int op_no) return ret; } - -int -error_gen_lookup_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, dict_t *xdata, struct iatt *postparent) -{ - STACK_UNWIND_STRICT (lookup, frame, op_ret, op_errno, inode, - buf, xdata, postparent); - return 0; -} - - int error_gen_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) @@ -404,25 +393,15 @@ error_gen_lookup (call_frame_t *frame, xlator_t *this, loc_t *loc, GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (lookup, frame, -1, op_errno, NULL, NULL, NULL, NULL); - return 0; + return 0; } - STACK_WIND (frame, error_gen_lookup_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lookup, loc, xdata); return 0; } - -int -error_gen_stat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (stat, frame, op_ret, op_errno, buf, xdata); - return 0; -} - int error_gen_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { @@ -439,27 +418,14 @@ error_gen_stat (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (stat, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_stat_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->stat, - loc, xdata); + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->stat, loc, xdata); return 0; } - -int -error_gen_setattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iatt *preop, struct iatt *postop, dict_t *xdata) -{ - STACK_UNWIND_STRICT (setattr, frame, op_ret, op_errno, preop, postop, xdata); - return 0; -} - - int error_gen_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, struct iatt *stbuf, int32_t valid, dict_t *xdata) @@ -477,11 +443,10 @@ error_gen_setattr (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (setattr, frame, -1, op_errno, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_setattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setattr, loc, stbuf, valid, xdata); return 0; @@ -505,28 +470,15 @@ error_gen_fsetattr (call_frame_t *frame, xlator_t *this, fd_t *fd, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fsetattr, frame, -1, op_errno, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_setattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetattr, fd, stbuf, valid, xdata); return 0; } - -int -error_gen_truncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t 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 error_gen_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, off_t offset, dict_t *xdata) @@ -545,28 +497,15 @@ error_gen_truncate (call_frame_t *frame, xlator_t *this, loc_t *loc, GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (truncate, frame, -1, op_errno, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_truncate_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->truncate, loc, offset, xdata); return 0; } - -int -error_gen_ftruncate_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t 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 error_gen_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, off_t offset, dict_t *xdata) @@ -585,26 +524,15 @@ error_gen_ftruncate (call_frame_t *frame, xlator_t *this, fd_t *fd, GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (ftruncate, frame, -1, op_errno, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_ftruncate_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->ftruncate, fd, offset, xdata); return 0; } - -int -error_gen_access_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (access, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_access (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t mask, dict_t *xdata) @@ -622,27 +550,15 @@ error_gen_access (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (access, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_access_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->access, loc, mask, xdata); return 0; } - -int -error_gen_readlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - const char *path, struct iatt *sbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (readlink, frame, op_ret, op_errno, path, sbuf, xdata); - return 0; -} - - int error_gen_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, size_t size, dict_t *xdata) @@ -660,30 +576,15 @@ error_gen_readlink (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (readlink, frame, -1, op_errno, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_readlink_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readlink, loc, size, xdata); return 0; } - -int -error_gen_mknod_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (mknod, frame, op_ret, op_errno, - inode, buf, - preparent, postparent, xdata); - return 0; -} - - int error_gen_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, dev_t rdev, mode_t umask, dict_t *xdata) @@ -702,29 +603,15 @@ error_gen_mknod (call_frame_t *frame, xlator_t *this, loc_t *loc, GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (mknod, frame, -1, op_errno, NULL, NULL, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_mknod_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mknod, loc, mode, rdev, umask, xdata); return 0; } - -int -error_gen_mkdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (mkdir, frame, op_ret, op_errno, - inode, buf, - preparent, postparent, xdata); - return 0; -} - int error_gen_mkdir (call_frame_t *frame, xlator_t *this, loc_t *loc, mode_t mode, mode_t umask, dict_t *xdata) @@ -746,25 +633,12 @@ error_gen_mkdir (call_frame_t *frame, xlator_t *this, return 0; } - STACK_WIND (frame, error_gen_mkdir_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->mkdir, loc, mode, umask, xdata); return 0; } - -int -error_gen_unlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t 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 error_gen_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, dict_t *xdata) @@ -786,26 +660,12 @@ error_gen_unlink (call_frame_t *frame, xlator_t *this, loc_t *loc, int xflag, return 0; } - STACK_WIND (frame, error_gen_unlink_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->unlink, loc, xflag, xdata); return 0; } - -int -error_gen_rmdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t 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 error_gen_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, dict_t *xdata) @@ -823,29 +683,15 @@ error_gen_rmdir (call_frame_t *frame, xlator_t *this, loc_t *loc, int flags, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (rmdir, frame, -1, op_errno, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_rmdir_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rmdir, loc, flags, xdata); return 0; } - -int -error_gen_symlink_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, inode_t *inode, - struct iatt *buf, struct iatt *preparent, - struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (symlink, frame, op_ret, op_errno, inode, buf, - preparent, postparent, xdata); - return 0; -} - - int error_gen_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, loc_t *loc, mode_t umask, dict_t *xdata) @@ -867,28 +713,12 @@ error_gen_symlink (call_frame_t *frame, xlator_t *this, const char *linkpath, return 0; } - STACK_WIND (frame, error_gen_symlink_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->symlink, linkpath, loc, umask, xdata); return 0; } - -int -error_gen_rename_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t 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 error_gen_rename (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, dict_t *xdata) @@ -910,26 +740,12 @@ error_gen_rename (call_frame_t *frame, xlator_t *this, return 0; } - STACK_WIND (frame, error_gen_rename_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->rename, oldloc, newloc, xdata); return 0; } - -int -error_gen_link_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t 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 error_gen_link (call_frame_t *frame, xlator_t *this, loc_t *oldloc, loc_t *newloc, dict_t *xdata) @@ -951,26 +767,12 @@ error_gen_link (call_frame_t *frame, xlator_t *this, return 0; } - STACK_WIND (frame, error_gen_link_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->link, oldloc, newloc, xdata); return 0; } - -int -error_gen_create_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - fd_t *fd, inode_t *inode, struct iatt *buf, - struct iatt *preparent, struct iatt *postparent, dict_t *xdata) -{ - STACK_UNWIND_STRICT (create, frame, op_ret, op_errno, fd, inode, buf, - preparent, postparent, xdata); - return 0; -} - - int error_gen_create (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, mode_t mode, mode_t umask, fd_t *fd, @@ -993,23 +795,12 @@ error_gen_create (call_frame_t *frame, xlator_t *this, loc_t *loc, return 0; } - STACK_WIND (frame, error_gen_create_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->create, loc, flags, mode, umask, fd, xdata); return 0; } - -int -error_gen_open_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) -{ - STACK_UNWIND_STRICT (open, frame, op_ret, op_errno, fd, xdata); - return 0; -} - - int error_gen_open (call_frame_t *frame, xlator_t *this, loc_t *loc, int32_t flags, fd_t *fd, dict_t *xdata) @@ -1027,29 +818,15 @@ error_gen_open (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (open, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_open_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->open, loc, flags, fd, xdata); return 0; } - -int -error_gen_readv_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, - struct iovec *vector, int32_t 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 error_gen_readv (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t offset, uint32_t flags, dict_t *xdata) @@ -1068,28 +845,15 @@ error_gen_readv (call_frame_t *frame, xlator_t *this, GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (readv, frame, -1, op_errno, NULL, 0, NULL, NULL, xdata); - return 0; + return 0; } - - STACK_WIND (frame, error_gen_readv_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readv, fd, size, offset, flags, xdata); return 0; } - -int -error_gen_writev_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t 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 error_gen_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, struct iovec *vector, int32_t count, @@ -1098,6 +862,7 @@ error_gen_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, int op_errno = 0; eg_t *egp = NULL; int enable = 1; + struct iovec *shortvec = NULL; egp = this->private; enable = egp->enable[GF_FOP_WRITE]; @@ -1106,7 +871,6 @@ error_gen_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, op_errno = error_gen (this, GF_FOP_WRITE); if (op_errno == GF_ERROR_SHORT_WRITE) { - struct iovec *shortvec; /* * A short write error returns some value less than what was @@ -1115,35 +879,23 @@ error_gen_writev (call_frame_t *frame, xlator_t *this, fd_t *fd, */ shortvec = iov_dup(vector, 1); shortvec->iov_len /= 2; - - STACK_WIND(frame, error_gen_writev_cbk, FIRST_CHILD(this), - FIRST_CHILD(this)->fops->writev, fd, shortvec, count, - off, flags, iobref, xdata); - GF_FREE(shortvec); - return 0; + goto wind; } else if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (writev, frame, -1, op_errno, NULL, NULL, xdata); return 0; } +wind: + STACK_WIND_TAIL (frame, FIRST_CHILD(this), + FIRST_CHILD(this)->fops->writev, + fd, shortvec?shortvec:vector, + count, off, flags, iobref, xdata); - STACK_WIND (frame, error_gen_writev_cbk, - FIRST_CHILD(this), - FIRST_CHILD(this)->fops->writev, - fd, vector, count, off, flags, iobref, xdata); + if (shortvec) + GF_FREE (shortvec); return 0; } - -int -error_gen_flush_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (flush, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { @@ -1160,28 +912,15 @@ error_gen_flush (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (flush, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_flush_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->flush, fd, xdata); return 0; } - -int -error_gen_fsync_cbk (call_frame_t *frame, void *cookie, - xlator_t *this, int32_t op_ret, - int32_t op_errno, struct iatt *prebuf, - struct iatt *postbuf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsync, frame, op_ret, op_errno, prebuf, postbuf, xdata); - return 0; -} - - int error_gen_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata) { @@ -1198,26 +937,15 @@ error_gen_fsync (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, d if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fsync, frame, -1, op_errno, NULL, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_fsync_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsync, fd, flags, xdata); return 0; } - -int -error_gen_fstat_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct iatt *buf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fstat, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - int error_gen_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) { @@ -1234,26 +962,15 @@ error_gen_fstat (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *xdata) if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fstat, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_fstat_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fstat, fd, xdata); return 0; } - -int -error_gen_opendir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, fd_t *fd, dict_t *xdata) -{ - STACK_UNWIND_STRICT (opendir, frame, op_ret, op_errno, fd, xdata); - return 0; -} - - int error_gen_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, dict_t *xdata) { @@ -1270,26 +987,16 @@ error_gen_opendir (call_frame_t *frame, xlator_t *this, loc_t *loc, fd_t *fd, di if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (opendir, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_opendir_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->opendir, loc, fd, xdata); return 0; } int -error_gen_fsyncdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsyncdir, frame, op_ret, op_errno, xdata); - return 0; -} - - -int error_gen_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t flags, dict_t *xdata) { @@ -1306,26 +1013,15 @@ error_gen_fsyncdir (call_frame_t *frame, xlator_t *this, fd_t *fd, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fsyncdir, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_fsyncdir_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsyncdir, fd, flags, xdata); return 0; } - -int -error_gen_statfs_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct statvfs *buf, dict_t *xdata) -{ - STACK_UNWIND_STRICT (statfs, frame, op_ret, op_errno, buf, xdata); - return 0; -} - - int error_gen_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata) { @@ -1342,26 +1038,15 @@ error_gen_statfs (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *xdata if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (statfs, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_statfs_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->statfs, loc, xdata); return 0; } - -int -error_gen_setxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (setxattr, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, dict_t *dict, int32_t flags, dict_t *xdata) @@ -1379,26 +1064,15 @@ error_gen_setxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (setxattr, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_setxattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->setxattr, loc, dict, flags, xdata); return 0; } - -int -error_gen_getxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) -{ - STACK_UNWIND_STRICT (getxattr, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - int error_gen_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, dict_t *xdata) @@ -1416,26 +1090,16 @@ error_gen_getxattr (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (getxattr, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_getxattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->getxattr, loc, name, xdata); return 0; } int -error_gen_fsetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fsetxattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int error_gen_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, dict_t *dict, int32_t flags, dict_t *xdata) { @@ -1452,26 +1116,15 @@ error_gen_fsetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fsetxattr, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_fsetxattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fsetxattr, fd, dict, flags, xdata); return 0; } - -int -error_gen_fgetxattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fgetxattr, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - int error_gen_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name, dict_t *xdata) @@ -1489,26 +1142,15 @@ error_gen_fgetxattr (call_frame_t *frame, xlator_t *this, fd_t *fd, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fgetxattr, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_fgetxattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fgetxattr, fd, name, xdata); return 0; } - -int -error_gen_xattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) -{ - STACK_UNWIND_STRICT (xattrop, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - int error_gen_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) @@ -1526,26 +1168,15 @@ error_gen_xattrop (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (xattrop, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_xattrop_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->xattrop, loc, flags, dict, xdata); return 0; } - -int -error_gen_fxattrop_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *dict, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fxattrop, frame, op_ret, op_errno, dict, xdata); - return 0; -} - - int error_gen_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, gf_xattrop_flags_t flags, dict_t *dict, dict_t *xdata) @@ -1563,26 +1194,15 @@ error_gen_fxattrop (call_frame_t *frame, xlator_t *this, fd_t *fd, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fxattrop, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_fxattrop_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fxattrop, fd, flags, dict, xdata); return 0; } - -int -error_gen_removexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (removexattr, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, const char *name, dict_t *xdata) @@ -1600,26 +1220,16 @@ error_gen_removexattr (call_frame_t *frame, xlator_t *this, loc_t *loc, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (removexattr, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_removexattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->removexattr, loc, name, xdata); return 0; } int -error_gen_fremovexattr_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fremovexattr, frame, op_ret, op_errno, xdata); - return 0; -} - - -int error_gen_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, const char *name, dict_t *xdata) { @@ -1636,26 +1246,15 @@ error_gen_fremovexattr (call_frame_t *frame, xlator_t *this, fd_t *fd, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (fremovexattr, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_fremovexattr_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fremovexattr, fd, name, xdata); return 0; } - -int -error_gen_lk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, struct gf_flock *lock, dict_t *xdata) -{ - STACK_UNWIND_STRICT (lk, frame, op_ret, op_errno, lock, xdata); - return 0; -} - - int error_gen_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, struct gf_flock *lock, dict_t *xdata) @@ -1673,26 +1272,15 @@ error_gen_lk (call_frame_t *frame, xlator_t *this, fd_t *fd, int32_t cmd, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (lk, frame, -1, op_errno, NULL, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_lk_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->lk, fd, cmd, lock, xdata); return 0; } - -int -error_gen_inodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (inodelk, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_inodelk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, int32_t cmd, @@ -1711,26 +1299,15 @@ error_gen_inodelk (call_frame_t *frame, xlator_t *this, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (inodelk, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_inodelk_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->inodelk, volume, loc, cmd, lock, xdata); return 0; } - -int -error_gen_finodelk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (finodelk, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_finodelk (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, int32_t cmd, @@ -1749,26 +1326,15 @@ error_gen_finodelk (call_frame_t *frame, xlator_t *this, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (finodelk, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_finodelk_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->finodelk, volume, fd, cmd, lock, xdata); return 0; } - -int -error_gen_entrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (entrylk, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_entrylk (call_frame_t *frame, xlator_t *this, const char *volume, loc_t *loc, const char *basename, @@ -1787,26 +1353,15 @@ error_gen_entrylk (call_frame_t *frame, xlator_t *this, if (op_errno) { GF_ERROR(this, "unwind(-1, %s)", strerror (op_errno)); STACK_UNWIND_STRICT (entrylk, frame, -1, op_errno, xdata); - return 0; + return 0; } - STACK_WIND (frame, error_gen_entrylk_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->entrylk, volume, loc, basename, cmd, type, xdata); return 0; } - -int -error_gen_fentrylk_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, dict_t *xdata) -{ - STACK_UNWIND_STRICT (fentrylk, frame, op_ret, op_errno, xdata); - return 0; -} - - int error_gen_fentrylk (call_frame_t *frame, xlator_t *this, const char *volume, fd_t *fd, const char *basename, @@ -1828,26 +1383,12 @@ error_gen_fentrylk (call_frame_t *frame, xlator_t *this, return 0; } - STACK_WIND (frame, error_gen_fentrylk_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->fentrylk, volume, fd, basename, cmd, type, xdata); return 0; } - -/* Management operations */ - - -int -error_gen_getspec_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, char *spec_data) -{ - STACK_UNWIND_STRICT (getspec, frame, op_ret, op_errno, spec_data); - return 0; -} - - int error_gen_getspec (call_frame_t *frame, xlator_t *this, const char *key, int32_t flags) @@ -1868,24 +1409,12 @@ error_gen_getspec (call_frame_t *frame, xlator_t *this, const char *key, return 0; } - STACK_WIND (frame, error_gen_getspec_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->getspec, key, flags); return 0; } - -int -error_gen_readdir_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (readdir, frame, op_ret, op_errno, entries, xdata); - return 0; -} - - int error_gen_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t off, dict_t *xdata) @@ -1906,24 +1435,12 @@ error_gen_readdir (call_frame_t *frame, xlator_t *this, fd_t *fd, return 0; } - STACK_WIND (frame, error_gen_readdir_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdir, fd, size, off, xdata); return 0; } - -int -error_gen_readdirp_cbk (call_frame_t *frame, void *cookie, xlator_t *this, - int32_t op_ret, int32_t op_errno, gf_dirent_t *entries, - dict_t *xdata) -{ - STACK_UNWIND_STRICT (readdirp, frame, op_ret, op_errno, entries, xdata); - return 0; -} - - int error_gen_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, off_t off, dict_t *dict) @@ -1944,8 +1461,7 @@ error_gen_readdirp (call_frame_t *frame, xlator_t *this, fd_t *fd, size_t size, return 0; } - STACK_WIND (frame, error_gen_readdirp_cbk, - FIRST_CHILD(this), + STACK_WIND_TAIL (frame, FIRST_CHILD(this), FIRST_CHILD(this)->fops->readdirp, fd, size, off, dict); return 0; @@ -2062,6 +1578,8 @@ reconfigure (xlator_t *this, dict_t *options) pvt = this->private; + ret = -1; + GF_OPTION_RECONF ("error-no", pvt->error_no, options, str, out); GF_OPTION_RECONF ("failure", failure_percent_int, options, int32, @@ -2110,6 +1628,8 @@ init (xlator_t *this) LOCK_INIT (&pvt->lock); + ret = -1; + GF_OPTION_INIT ("error-no", pvt->error_no, str, out); GF_OPTION_INIT ("failure", failure_percent_int, int32, out); @@ -2126,6 +1646,8 @@ init (xlator_t *this) /* Give some seed value here */ srand (time(NULL)); + + ret = 0; out: if (ret) GF_FREE (pvt); @@ -2189,7 +1711,6 @@ struct xlator_fops fops = { .ftruncate = error_gen_ftruncate, .fstat = error_gen_fstat, .lk = error_gen_lk, - .lookup_cbk = error_gen_lookup_cbk, .xattrop = error_gen_xattrop, .fxattrop = error_gen_fxattrop, .inodelk = error_gen_inodelk, |