From ca502ca780202c71623a34349c88d114ad58ec12 Mon Sep 17 00:00:00 2001 From: Raghavendra Bhat Date: Wed, 22 Feb 2012 14:38:42 +0530 Subject: cli: print the type of the inode in gluster volume status inode output Instead of a number print the type of the inode in the output of gluster volume status inode. This is what the output symbols indicate. R -----> Regular file D -----> Directory L -----> symbolic Link B -----> Block special device C -----> Character special device F -----> FIFO S -----> Socket I -----> Invalid inode type Also supress a warning message displayed at the time of build. Change-Id: I5a2adfe044ce21d9da159652d4b6e25cd0a2fdca BUG: 796078 Signed-off-by: Raghavendra Bhat Reviewed-on: http://review.gluster.com/2794 Reviewed-by: Amar Tumballi Tested-by: Gluster Build System Reviewed-by: Vijay Bellur --- cli/src/cli-rpc-ops.c | 34 +++++++++++++++++++++++++++++++--- 1 file changed, 31 insertions(+), 3 deletions(-) (limited to 'cli') diff --git a/cli/src/cli-rpc-ops.c b/cli/src/cli-rpc-ops.c index 9537c977d12..5dfdbe063f5 100644 --- a/cli/src/cli-rpc-ops.c +++ b/cli/src/cli-rpc-ops.c @@ -4360,6 +4360,7 @@ cli_print_volume_status_inode_entry (dict_t *dict, char *prefix) uint64_t nlookup = 0; uint32_t ref = 0; int ia_type = 0; + char inode_type; GF_ASSERT (dict); GF_ASSERT (prefix); @@ -4388,8 +4389,35 @@ cli_print_volume_status_inode_entry (dict_t *dict, char *prefix) if (ret) goto out; - cli_out ("%-40s %14"PRIu64" %14"PRIu32" %9d", - gfid, nlookup, ref, ia_type); + switch (ia_type) { + case IA_IFREG: + inode_type = 'R'; + break; + case IA_IFDIR: + inode_type = 'D'; + break; + case IA_IFLNK: + inode_type = 'L'; + break; + case IA_IFBLK: + inode_type = 'B'; + break; + case IA_IFCHR: + inode_type = 'C'; + break; + case IA_IFIFO: + inode_type = 'F'; + break; + case IA_IFSOCK: + inode_type = 'S'; + break; + default: + inode_type = 'I'; + break; + } + + cli_out ("%-40s %14"PRIu64" %14"PRIu32" %9c", + gfid, nlookup, ref, inode_type); out: return; @@ -5346,7 +5374,7 @@ cmd_heal_volume_brick_out (dict_t *dict, int brick) ret = dict_get_str (dict, key, &path); if (ret) continue; - cli_out (path); + cli_out ("%s", path); } out: return; -- cgit