From cc6d5c66090f576383c26bd0bdefadbcad708435 Mon Sep 17 00:00:00 2001 From: Csaba Henk Date: Mon, 18 Apr 2011 17:25:24 +0000 Subject: cli: preliminary cleanup for system:: commands Signed-off-by: Csaba Henk Signed-off-by: Anand Avati BUG: 2785 (gsyncd logs on slave side go to /dev/null) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2785 --- cli/src/cli-cmd-system.c | 28 +++++++++++++--------------- 1 file changed, 13 insertions(+), 15 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-cmd-system.c b/cli/src/cli-cmd-system.c index 36583893b..e9d017f1d 100644 --- a/cli/src/cli-cmd-system.c +++ b/cli/src/cli-cmd-system.c @@ -33,8 +33,6 @@ #include "cli-mem-types.h" #include "protocol-common.h" -#define GETSPEC_SYNTAX "system:: getspec " -#define BRICKTOPORT_SYNTAX "system:: portmap brick2port " extern struct rpc_clnt *global_rpc; @@ -61,7 +59,7 @@ cli_cmd_getspec_cbk (struct cli_state *state, struct cli_cmd_word *word, goto out; if (wordcount != 3) { - cli_out ("Usage: " GETSPEC_SYNTAX); + cli_usage_out (word->pattern); goto out; } @@ -104,7 +102,7 @@ cli_cmd_pmap_b2p_cbk (struct cli_state *state, struct cli_cmd_word *word, goto out; if (wordcount != 4) { - cli_out ("Usage: " BRICKTOPORT_SYNTAX); + cli_usage_out (word->pattern); goto out; } @@ -130,21 +128,21 @@ out: } int -cli_cmd_fsm_log (struct cli_state *state, struct cli_cmd_word *word, - const char **words, int wordcount) +cli_cmd_fsm_log_cbk (struct cli_state *state, struct cli_cmd_word *word, + const char **words, int wordcount) { int ret = -1; rpc_clnt_procedure_t *proc = NULL; call_frame_t *frame = NULL; char *name = ""; - if ((wordcount != 3) && (wordcount != 2)) { + if ((wordcount != 4) && (wordcount != 3)) { cli_usage_out (word->pattern); goto out; } - if (wordcount == 3) - name = (char*)words[2]; + if (wordcount == 4) + name = (char*)words[3]; proc = &cli_rpc_prog->proctable[GLUSTER_CLI_FSM_LOG]; if (proc && proc->fn) { frame = create_frame (THIS, THIS->ctx->pool); @@ -157,22 +155,22 @@ out: } struct cli_cmd cli_system_cmds[] = { - { GETSPEC_SYNTAX, + { "system:: getspec ", cli_cmd_getspec_cbk, "fetch spec for volume "}, - { BRICKTOPORT_SYNTAX, + { "system:: portmap brick2port ", cli_cmd_pmap_b2p_cbk, "query which port listens on"}, + { "system:: fsm log []", + cli_cmd_fsm_log_cbk, + "display fsm transitions"}, + { "system:: help", cli_cmd_system_help_cbk, "display help for system commands"}, - { "fsm log []", - cli_cmd_fsm_log, - "display fsm transitions"}, - { NULL, NULL, NULL } }; -- cgit