diff options
Diffstat (limited to 'cli/src/cli-rpc-ops.c')
-rw-r--r-- | cli/src/cli-rpc-ops.c | 48 |
1 files changed, 16 insertions, 32 deletions
diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 0f57d94b506..9b6b0c7fa50 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -47,10 +47,7 @@ enum gf_task_types { GF_TASK_TYPE_REBALANCE, GF_TASK_TYPE_REMOVE_BRICK }; -extern struct rpc_clnt *global_quotad_rpc; rpc_clnt_prog_t cli_quotad_clnt; -extern rpc_clnt_prog_t *cli_rpc_prog; -extern int connected; static int32_t gf_cli_remove_brick(call_frame_t *frame, xlator_t *this, void *data); @@ -158,9 +155,9 @@ gf_cli_probe_cbk(struct rpc_req *req, struct iovec *iov, int count, gf_log("cli", GF_LOG_INFO, "Received resp to probe"); - if (rsp.op_ret) { - if (rsp.op_errstr && rsp.op_errstr[0] != '\0') { - snprintf(msg, sizeof(msg), "%s", rsp.op_errstr); + if (rsp.op_errstr && rsp.op_errstr[0] != '\0') { + snprintf(msg, sizeof(msg), "%s", rsp.op_errstr); + if (rsp.op_ret) { gf_log("cli", GF_LOG_ERROR, "%s", msg); } } @@ -3406,7 +3403,7 @@ gf_cli_quota_list(cli_local_t *local, char *volname, dict_t *dict, char *default_sl, int count, int op_ret, int op_errno, char *op_errstr) { - if (!connected) + if (!cli_cmd_connected()) goto out; if (count > 0) { @@ -4875,14 +4872,6 @@ gf_cli_gsync_status_output(dict_t *dict, gf_boolean_t is_detail) ret = -1; goto out; } - for (i = 0; i < gsync_count; i++) { - sts_vals[i] = GF_CALLOC(1, sizeof(gf_gsync_status_t), - gf_common_mt_char); - if (!sts_vals[i]) { - ret = -1; - goto out; - } - } ret = gf_cli_read_status_data(dict, sts_vals, spacing, gsync_count, num_of_fields); @@ -5352,7 +5341,8 @@ cmd_profile_volume_brick_out(dict_t *dict, int count, int interval) double total_percentage_latency = 0; for (i = 0; i < 32; i++) { - snprintf(key, sizeof(key), "%d-%d-read-%d", count, interval, (1 << i)); + snprintf(key, sizeof(key), "%d-%d-read-%" PRIu32, count, interval, + (1U << i)); ret = dict_get_uint64(dict, key, &rb_counts[i]); if (ret) { gf_log("cli", GF_LOG_DEBUG, "failed to get %s from dict", key); @@ -5360,7 +5350,8 @@ cmd_profile_volume_brick_out(dict_t *dict, int count, int interval) } for (i = 0; i < 32; i++) { - snprintf(key, sizeof(key), "%d-%d-write-%d", count, interval, (1 << i)); + snprintf(key, sizeof(key), "%d-%d-write-%" PRIu32, count, interval, + (1U << i)); ret = dict_get_uint64(dict, key, &wb_counts[i]); if (ret) { gf_log("cli", GF_LOG_DEBUG, "failed to get %s from dict", key); @@ -5446,7 +5437,8 @@ cmd_profile_volume_brick_out(dict_t *dict, int count, int interval) if ((rb_counts[i] == 0) && (wb_counts[i] == 0)) continue; per_line++; - snprintf(output + index, sizeof(output) - index, "%19db+ ", (1 << i)); + snprintf(output + index, sizeof(output) - index, "%19" PRIu32 "b+ ", + (1U << i)); if (rb_counts[i]) { snprintf(read_blocks + index, sizeof(read_blocks) - index, "%21" PRId64 " ", rb_counts[i]); @@ -5733,7 +5725,7 @@ gf_cli_top_volume_cbk(struct rpc_req *req, struct iovec *iov, int count, double time = 0; int32_t time_sec = 0; long int time_usec = 0; - char timestr[256] = { + char timestr[GF_TIMESTR_SIZE] = { 0, }; char *openfd_str = NULL; @@ -7823,7 +7815,7 @@ cmd_heal_volume_brick_out(dict_t *dict, int brick) char *status = NULL; uint64_t i = 0; uint32_t time = 0; - char timestr[32] = {0}; + char timestr[GF_TIMESTR_SIZE] = {0}; char *shd_status = NULL; snprintf(key, sizeof key, "%d-hostname", brick); @@ -7926,8 +7918,6 @@ gf_is_cli_heal_get_command(gf_xl_afr_op_t heal_op) [GF_SHD_OP_HEAL_INDEX] = 0, [GF_SHD_OP_HEAL_FULL] = 0, [GF_SHD_OP_INDEX_SUMMARY] = 1, - [GF_SHD_OP_HEALED_FILES] = 1, - [GF_SHD_OP_HEAL_FAILED_FILES] = 1, [GF_SHD_OP_SPLIT_BRAIN_FILES] = 1, [GF_SHD_OP_STATISTICS] = 1, [GF_SHD_OP_STATISTICS_HEAL_COUNT] = 1, @@ -8014,12 +8004,6 @@ gf_cli_heal_volume_cbk(struct rpc_req *req, struct iovec *iov, int count, case GF_SHD_OP_INDEX_SUMMARY: heal_op_str = "list of entries to be healed"; break; - case GF_SHD_OP_HEALED_FILES: - heal_op_str = "list of healed entries"; - break; - case GF_SHD_OP_HEAL_FAILED_FILES: - heal_op_str = "list of heal failed entries"; - break; case GF_SHD_OP_SPLIT_BRAIN_FILES: heal_op_str = "list of split brain entries"; break; @@ -8032,12 +8016,14 @@ gf_cli_heal_volume_cbk(struct rpc_req *req, struct iovec *iov, int count, case GF_SHD_OP_STATISTICS_HEAL_COUNT_PER_REPLICA: heal_op_str = "count of entries to be healed per replica"; break; - /* The below 4 cases are never hit; they're coded only to make - * compiler warnings go away.*/ case GF_SHD_OP_SBRAIN_HEAL_FROM_BIGGER_FILE: case GF_SHD_OP_SBRAIN_HEAL_FROM_LATEST_MTIME: case GF_SHD_OP_SBRAIN_HEAL_FROM_BRICK: case GF_SHD_OP_HEAL_SUMMARY: + case GF_SHD_OP_HEALED_FILES: + case GF_SHD_OP_HEAL_FAILED_FILES: + /* These cases are never hit; they're coded just to silence the + * compiler warnings.*/ break; case GF_SHD_OP_INVALID: @@ -8112,8 +8098,6 @@ gf_cli_heal_volume_cbk(struct rpc_req *req, struct iovec *iov, int count, cmd_heal_volume_statistics_heal_count_out(dict, i); break; case GF_SHD_OP_INDEX_SUMMARY: - case GF_SHD_OP_HEALED_FILES: - case GF_SHD_OP_HEAL_FAILED_FILES: case GF_SHD_OP_SPLIT_BRAIN_FILES: for (i = 0; i < brick_count; i++) cmd_heal_volume_brick_out(dict, i); |