summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorCsaba Henk <csaba@gluster.com>2011-04-18 17:25:24 +0000
committerAnand Avati <avati@gluster.com>2011-04-19 02:30:14 -0700
commitcc6d5c66090f576383c26bd0bdefadbcad708435 (patch)
tree11462fa0644173f987d75ccbbb0e8f69e11e18cd
parent853293b6dd759a20418a4878821db57f933cc50d (diff)
cli: preliminary cleanup for system:: commands
Signed-off-by: Csaba Henk <csaba@lowlife.hu> Signed-off-by: Anand Avati <avati@gluster.com> BUG: 2785 (gsyncd logs on slave side go to /dev/null) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2785
-rw-r--r--cli/src/cli-cmd-system.c28
1 files changed, 13 insertions, 15 deletions
diff --git a/cli/src/cli-cmd-system.c b/cli/src/cli-cmd-system.c
index 36583893b81..e9d017f1d16 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 <VOLID>"
-#define BRICKTOPORT_SYNTAX "system:: portmap brick2port <BRICK>"
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 <VOLID>",
cli_cmd_getspec_cbk,
"fetch spec for volume <VOLID>"},
- { BRICKTOPORT_SYNTAX,
+ { "system:: portmap brick2port <BRICK>",
cli_cmd_pmap_b2p_cbk,
"query which port <BRICK> listens on"},
+ { "system:: fsm log [<peer-name>]",
+ cli_cmd_fsm_log_cbk,
+ "display fsm transitions"},
+
{ "system:: help",
cli_cmd_system_help_cbk,
"display help for system commands"},
- { "fsm log [<peer-name>]",
- cli_cmd_fsm_log,
- "display fsm transitions"},
-
{ NULL, NULL, NULL }
};