Skip to content

Commit

Permalink
glusterd: refactor to use simpler dict APIs (#3620)
Browse files Browse the repository at this point in the history
Refactor to prefer 'dict_set_XXX_sizen()' and 'dict_get_YYY()'
dict API functions to avoid a lot of explicit 'SLEN()' calls,
adjust style and comments. No (expected) functional changes.

Signed-off-by: Dmitry Antipov <dantipov@cloudlinux.com>
Suggested-by: Yaniv Kaul <ykaul@redhat.com>
Updates: #1000
  • Loading branch information
dmantipov authored Jul 7, 2022
1 parent 05b0264 commit 70f987b
Show file tree
Hide file tree
Showing 22 changed files with 681 additions and 868 deletions.
118 changes: 50 additions & 68 deletions xlators/mgmt/glusterd/src/glusterd-brick-ops.c

Large diffs are not rendered by default.

3 changes: 1 addition & 2 deletions xlators/mgmt/glusterd/src/glusterd-conn-mgmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,7 @@ glusterd_conn_init(glusterd_conn_t *conn, char *sockpath, time_t frame_timeout,
if (ret)
goto out;

ret = dict_set_int32n(options, "transport.socket.ignore-enoent",
SLEN("transport.socket.ignore-enoent"), 1);
ret = dict_set_int32_sizen(options, "transport.socket.ignore-enoent", 1);
if (ret) {
gf_smsg(this->name, GF_LOG_ERROR, -ret, GD_MSG_DICT_SET_FAILED,
"Key=transport.socket.ignore-enoent", NULL);
Expand Down
10 changes: 4 additions & 6 deletions xlators/mgmt/glusterd/src/glusterd-gfproxyd-svc.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,8 @@ glusterd_gfproxydsvc_init(glusterd_volinfo_t *volinfo)
goto out;
}

if (dict_get_strn(this->options, "transport.socket.bind-address",
SLEN("transport.socket.bind-address"),
&volfileserver) != 0) {
if (dict_get_str(this->options, "transport.socket.bind-address",
&volfileserver) != 0) {
volfileserver = "localhost";
}
ret = glusterd_proc_init(&(svc->proc), gfproxyd_svc_name, pidfile, logdir,
Expand Down Expand Up @@ -320,9 +319,8 @@ glusterd_gfproxydsvc_start(glusterd_svc_t *svc, int flags)

if (volinfo->memory_accounting)
runner_add_arg(&runner, "--mem-accounting");
if (dict_get_strn(priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY,
SLEN(GLUSTERD_LOCALTIME_LOGGING_KEY),
&localtime_logging) == 0) {
if (dict_get_str(priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY,
&localtime_logging) == 0) {
if (strcmp(localtime_logging, "enable") == 0)
runner_add_arg(&runner, "--localtime-logging");
}
Expand Down
Loading

0 comments on commit 70f987b

Please sign in to comment.