From 1f14a1fccd5a8eed92936d9910d4b9a45ca1b56c Mon Sep 17 00:00:00 2001 From: Junaid Date: Tue, 14 Jun 2011 03:28:59 +0000 Subject: cli: 'QUOTA' Display the limit-set and size of the directory in KB, MB, etc Signed-off-by: Junaid Signed-off-by: Anand Avati BUG: 2829 (Display the quota limit as it is configured) URL: http://bugs.gluster.com/cgi-bin/bugzilla3/show_bug.cgi?id=2829 --- cli/src/cli-rpc-ops.c | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) (limited to 'cli/src/cli-rpc-ops.c') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 382e1110cc1..bca4c1ac227 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -1310,12 +1310,13 @@ out: } int32_t -print_limit_list (char *volname, char *limit_list) +gf_cli3_1_print_limit_list (char *volname, char *limit_list) { int64_t size = 0; int64_t limit_value = 0; int32_t i, j, k; int32_t len = 0, ret = -1; + char *size_str = NULL; char path [PATH_MAX] = {0, }; char ret_str [1024] = {0, }; char value [1024] = {0, }; @@ -1382,8 +1383,15 @@ print_limit_list (char *volname, char *limit_list) } else { sscanf (ret_str, "%"PRId64",%"PRId64, &size, &limit_value); - cli_out ("%-20s %10"PRId64" %20"PRId64, path, - limit_value, size); + size_str = gf_uint64_2human_readable ((uint64_t) size); + if (size_str == NULL) { + cli_out ("%-20s %10s %20"PRId64, path, + value, size); + } else { + cli_out ("%-20s %10s %20s", path, + value, size_str); + GF_FREE (size_str); + } } i++; } @@ -1432,7 +1440,8 @@ gf_cli3_1_quota_cbk (struct rpc_req *req, struct iovec *iov, if (rsp.type == GF_QUOTA_OPTION_TYPE_LIST) { if (rsp.limit_list) - print_limit_list (rsp.volname, rsp.limit_list); + gf_cli3_1_print_limit_list (rsp.volname, + rsp.limit_list); } else { gf_log ("cli", GF_LOG_INFO, "Received resp to quota command "); if (rsp.op_errstr) -- cgit