Skip to content

Conversation

@amarts
Copy link
Owner

@amarts amarts commented Sep 22, 2020

  • return signature of all 'fops' callback changed to gf_return_t.

  • provide IS_ERROR()/IS_SUCCESS() macros to check only this type of argument.

  • provide 2 global variables gf_success and gf_error introduced, which
    can used instead of -1 and 0 return used largely today.

Change-Id: Ib91216afaa89d7e4509757b50dd8a7d60a6bf0a9
Updates: #280
Signed-off-by: Amar Tumballi amar@kadalu.io

return 0;
gf_return_t ret;
ret.op_ret = -1;
STACK_UNWIND_STRICT (@NAME@, frame, ret, op_errno, @ERROR_ARGS@);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just use gf_error

#define IS_ERROR(ret) (((ret).op_ret) < 0)
#define IS_SUCCESS(ret) (((ret).op_ret) >= 0)
#define GET_RET(ret) ((ret).op_ret)
#define SET_RET(ret, val) ((ret).op_ret = val)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(val) is recommened.

\
if (!frame) { \
stb->op_ret = -1; \
stb->op_ret.op_ret = -1; \
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set to gf_error

GF_XLATOR_BACKEND = 125,
GF_XLATOR_EXTERNAL = 126,
GF_XLATOR_MAXVALUE = 127,
};
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not a complete list!

op_ret = inode_ctx_get(inode, this, &need_lookup);
if (op_ret == -1) {
op_ret.op_ret = inode_ctx_get(inode, this, &need_lookup);
if (IS_ERROR(op_ret)) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

use some other type.

*/
AFR_STACK_UNWIND(setxattr, frame, 0, 0, NULL);
gf_return_t op_ret = {0};
AFR_STACK_UNWIND(setxattr, frame, op_ret, 0, NULL);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gf_success

gf_msg_debug(this->name, 0, "we're done locking");

int_lock->lock_op_ret = 0;
SET_RET(int_lock->lock_op_ret, 0);
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gf_success

&local->stbuf, &local->preparent,
&local->postparent, local->xattr);
SET_RET(op_ret, 0);
dht_lookup_linkfile_create_cbk(
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gf_success

@@ -8760,17 +8801,19 @@ dht_create_finish(call_frame_t *frame, xlator_t *this, int op_ret,
DHT_STACK_DESTROY(lock_frame);
}

if (op_ret == 0)
if (ret >= 0)
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ret == 0

}
}
if (local->ret_cache[conf->subvolume_cnt]) {
if (IS_SUCCESS(local->ret_cache[conf->subvolume_cnt])) {
Copy link
Owner Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IS_ERROR()

* return signature of all 'fops' callback changed to `gf_return_t`.

* provide IS_ERROR()/IS_SUCCESS() macros to check only this type of argument.

* provide 2 global variables `gf_success` and `gf_error` introduced, which
  can used instead of -1 and 0 return used largely today.

Change-Id: Ib91216afaa89d7e4509757b50dd8a7d60a6bf0a9
Updates: #280
Signed-off-by: Amar Tumballi <amar@kadalu.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants