diff options
author | Yaniv Kaul <ykaul@redhat.com> | 2018-09-03 13:55:01 +0300 |
---|---|---|
committer | Atin Mukherjee <amukherj@redhat.com> | 2018-09-09 01:53:59 +0000 |
commit | 09198e203ece6925791a8a3a6121c5f808e4e873 (patch) | |
tree | 152f83348592c21fa697aeb0fc606e824ab7c993 /xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c | |
parent | 44e4db05a953a6f231c62225b462470cacb16bd4 (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-svc-mgmt.c')
-rw-r--r-- | xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c index fcf8e666d3e..9a1fa1dff11 100644 --- a/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c +++ b/xlators/mgmt/glusterd/src/glusterd-svc-mgmt.c @@ -97,8 +97,9 @@ glusterd_svc_init_common (glusterd_svc_t *svc, glusterd_svc_build_volfileid_path (svc_name, volfileid, sizeof(volfileid)); - if (dict_get_str (this->options, "transport.socket.bind-address", - &volfileserver) != 0) { + if (dict_get_strn (this->options, "transport.socket.bind-address", + SLEN ("transport.socket.bind-address"), + &volfileserver) != 0) { volfileserver = "localhost"; } @@ -199,13 +200,15 @@ glusterd_svc_start (glusterd_svc_t *svc, int flags, dict_t *cmdline) "-S", svc->conn.sockpath, NULL); - if (dict_get_str (priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY, - &localtime_logging) == 0) { + if (dict_get_strn (priv->opts, GLUSTERD_LOCALTIME_LOGGING_KEY, + SLEN (GLUSTERD_LOCALTIME_LOGGING_KEY), + &localtime_logging) == 0) { if (strcmp (localtime_logging, "enable") == 0) runner_add_arg (&runner, "--localtime-logging"); } - if (dict_get_str (priv->opts, GLUSTERD_DAEMON_LOG_LEVEL_KEY, - &log_level) == 0) { + if (dict_get_strn (priv->opts, GLUSTERD_DAEMON_LOG_LEVEL_KEY, + SLEN (GLUSTERD_DAEMON_LOG_LEVEL_KEY), + &log_level) == 0) { snprintf (daemon_log_level, 30, "--log-level=%s", log_level); runner_add_arg (&runner, daemon_log_level); } |