summaryrefslogtreecommitdiffstats
path: root/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
diff options
context:
space:
mode:
authorYaniv Kaul <ykaul@redhat.com>2018-09-03 13:55:01 +0300
committerAtin Mukherjee <amukherj@redhat.com>2018-09-09 01:53:59 +0000
commit09198e203ece6925791a8a3a6121c5f808e4e873 (patch)
tree152f83348592c21fa697aeb0fc606e824ab7c993 /xlators/mgmt/glusterd/src/glusterd-reset-brick.c
parent44e4db05a953a6f231c62225b462470cacb16bd4 (diff)
Some (mgmt) xlators: use dict_{setn|getn|deln|get_int32n|set_int32n|set_strn}
In a previous patch (https://review.gluster.org/20769) we've added the key length to be passed to dict_* funcs, to remove the need to strlen() it. This patch moves some xlators to use it. - It also adds dict_get_int32n which was missing. - It also reduces the size of some key variables. They were set to 1024b or PATH_MAX, where sometimes 64 bytes were really enough. Please review carefully: 1. That I did not reduce some the size of the key variables too much. 2. That I did not mix up some keys. Compile-tested only! Change-Id: Ic729baf179f40e8d02bc2350491d4bb9b6934266 updates: bz#1193929 Signed-off-by: Yaniv Kaul <ykaul@redhat.com>
Diffstat (limited to 'xlators/mgmt/glusterd/src/glusterd-reset-brick.c')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-reset-brick.c16
1 files changed, 10 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
index c1de0432a73..52ddf1ba791 100644
--- a/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
+++ b/xlators/mgmt/glusterd/src/glusterd-reset-brick.c
@@ -154,7 +154,8 @@ glusterd_reset_brick_prevalidate (dict_t *dict, char **op_errstr,
volinfo->rep_brick.src_brick = src_brickinfo;
volinfo->rep_brick.dst_brick = dst_brickinfo;
- ret = dict_get_int32 (dict, "ignore-partition", &ignore_partition);
+ ret = dict_get_int32n (dict, "ignore-partition",
+ SLEN ("ignore-partition"), &ignore_partition);
ret = 0;
if (gf_is_local_addr (host)) {
ret = glusterd_validate_and_create_brickpath
@@ -217,7 +218,8 @@ glusterd_reset_brick_prevalidate (dict_t *dict, char **op_errstr,
}
}
- ret = dict_set_int32 (rsp_dict, "brick_count", 1);
+ ret = dict_set_int32n (rsp_dict, "brick_count",
+ SLEN ( "brick_count"), 1);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_SET_FAILED,
@@ -254,14 +256,14 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
priv = this->private;
GF_ASSERT (priv);
- ret = dict_get_str (dict, "operation", &op);
+ ret = dict_get_strn (dict, "operation", SLEN ("operation"), &op);
if (ret) {
gf_msg_debug (this->name, 0,
"dict_get on operation failed");
goto out;
}
- ret = dict_get_str (dict, "volname", &volname);
+ ret = dict_get_strn (dict, "volname", SLEN ("volname"), &volname);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED, "Unable to get volume name");
@@ -272,7 +274,8 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
if (ret)
goto out;
- ret = dict_get_str (dict, "src-brick", &src_brick);
+ ret = dict_get_strn (dict, "src-brick", SLEN ("src-brick"),
+ &src_brick);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED, "Unable to get src brick");
@@ -305,7 +308,8 @@ glusterd_op_reset_brick (dict_t *dict, dict_t *rsp_dict)
} else if (!strcmp (op, "GF_RESET_OP_COMMIT") ||
!strcmp (op, "GF_RESET_OP_COMMIT_FORCE")) {
- ret = dict_get_str (dict, "dst-brick", &dst_brick);
+ ret = dict_get_strn (dict, "dst-brick", SLEN ("dst-brick"),
+ &dst_brick);
if (ret) {
gf_msg (this->name, GF_LOG_ERROR, 0,
GD_MSG_DICT_GET_FAILED,