diff options
Diffstat (limited to 'cli/src/cli-cmd.c')
| -rw-r--r-- | cli/src/cli-cmd.c | 46 |
1 files changed, 23 insertions, 23 deletions
diff --git a/cli/src/cli-cmd.c b/cli/src/cli-cmd.c index 396cabebbbe..2d458b16a56 100644 --- a/cli/src/cli-cmd.c +++ b/cli/src/cli-cmd.c @@ -28,11 +28,7 @@ static pthread_cond_t conn = PTHREAD_COND_INITIALIZER; static pthread_mutex_t conn_mutex = PTHREAD_MUTEX_INITIALIZER; int cli_op_ret = 0; -int connected = 0; - -int -cli_cmd_log_help_cbk(struct cli_state *state, struct cli_cmd_word *in_word, - const char **words, int wordcount); +static gf_boolean_t connected = _gf_false; static unsigned cli_cmd_needs_connection(struct cli_cmd_word *word) @@ -108,12 +104,14 @@ cli_cmd_process(struct cli_state *state, int argc, char **argv) } if (!word) { - cli_out("unrecognized word: %s (position %d)", argv[i], i); + cli_out("unrecognized word: %s (position %d)\n", argv[i], i); + usage(); return -1; } if (!word->cbkfn) { - cli_out("unrecognized command"); + cli_out("unrecognized command\n"); + usage(); return -1; } @@ -234,18 +232,6 @@ out: } int -cli_cmd_cond_init() -{ - pthread_mutex_init(&cond_mutex, NULL); - pthread_cond_init(&cond, NULL); - - pthread_mutex_init(&conn_mutex, NULL); - pthread_cond_init(&conn, NULL); - - return 0; -} - -int cli_cmd_lock() { pthread_mutex_lock(&cond_mutex); @@ -342,19 +328,32 @@ cli_cmd_await_connected(unsigned conn_timo) } int32_t -cli_cmd_broadcast_connected() +cli_cmd_broadcast_connected(gf_boolean_t status) { pthread_mutex_lock(&conn_mutex); { - connected = 1; + connected = status; pthread_cond_broadcast(&conn); } - pthread_mutex_unlock(&conn_mutex); return 0; } +gf_boolean_t +cli_cmd_connected(void) +{ + gf_boolean_t status; + + pthread_mutex_lock(&conn_mutex); + { + status = connected; + } + pthread_mutex_unlock(&conn_mutex); + + return status; +} + int cli_cmd_submit(struct rpc_clnt *rpc, void *req, call_frame_t *frame, rpc_clnt_prog_t *prog, int procnum, struct iobref *iobref, @@ -364,7 +363,8 @@ cli_cmd_submit(struct rpc_clnt *rpc, void *req, call_frame_t *frame, unsigned timeout = 0; if ((GLUSTER_CLI_PROFILE_VOLUME == procnum) || - (GLUSTER_CLI_HEAL_VOLUME == procnum)) + (GLUSTER_CLI_HEAL_VOLUME == procnum) || + (GLUSTER_CLI_GANESHA == procnum)) timeout = cli_ten_minutes_timeout; else timeout = cli_default_conn_timeout; |
