diff options
author | Allan Stephens <allan.stephens@windriver.com> | 2010-08-17 07:00:14 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2010-08-17 20:31:58 -0400 |
commit | c2de58140a380172610b6a0f07f975abb2fbb311 (patch) | |
tree | 1eb8d0c85ed3558dbd7fe4d2e1a5fb45c04f8e0e /net/tipc | |
parent | 76ae0d71d839b365faa7fdca0eec85a6d1a20d95 (diff) |
tipc: Minor enhancements to name table display format
Eliminate printing of dashes after name table column headers
(to adhere more closely to the standard format used in tipc-config),
and simplify name table display logic using array lookups rather
than if-then-else logic.
Signed-off-by: Allan Stephens <allan.stephens@windriver.com>
Signed-off-by: Paul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/tipc')
-rw-r--r-- | net/tipc/name_table.c | 44 |
1 files changed, 16 insertions, 28 deletions
diff --git a/net/tipc/name_table.c b/net/tipc/name_table.c index 8ba79620db3f..d504e490fd02 100644 --- a/net/tipc/name_table.c +++ b/net/tipc/name_table.c | |||
@@ -877,7 +877,7 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth, | |||
877 | u32 index) | 877 | u32 index) |
878 | { | 878 | { |
879 | char portIdStr[27]; | 879 | char portIdStr[27]; |
880 | char *scopeStr; | 880 | const char *scope_str[] = {"", " zone", " cluster", " node"}; |
881 | struct publication *publ = sseq->zone_list; | 881 | struct publication *publ = sseq->zone_list; |
882 | 882 | ||
883 | tipc_printf(buf, "%-10u %-10u ", sseq->lower, sseq->upper); | 883 | tipc_printf(buf, "%-10u %-10u ", sseq->lower, sseq->upper); |
@@ -893,15 +893,8 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth, | |||
893 | tipc_node(publ->node), publ->ref); | 893 | tipc_node(publ->node), publ->ref); |
894 | tipc_printf(buf, "%-26s ", portIdStr); | 894 | tipc_printf(buf, "%-26s ", portIdStr); |
895 | if (depth > 3) { | 895 | if (depth > 3) { |
896 | if (publ->node != tipc_own_addr) | 896 | tipc_printf(buf, "%-10u %s", publ->key, |
897 | scopeStr = ""; | 897 | scope_str[publ->scope]); |
898 | else if (publ->scope == TIPC_NODE_SCOPE) | ||
899 | scopeStr = "node"; | ||
900 | else if (publ->scope == TIPC_CLUSTER_SCOPE) | ||
901 | scopeStr = "cluster"; | ||
902 | else | ||
903 | scopeStr = "zone"; | ||
904 | tipc_printf(buf, "%-10u %s", publ->key, scopeStr); | ||
905 | } | 898 | } |
906 | 899 | ||
907 | publ = publ->zone_list_next; | 900 | publ = publ->zone_list_next; |
@@ -951,24 +944,19 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth, | |||
951 | 944 | ||
952 | static void nametbl_header(struct print_buf *buf, u32 depth) | 945 | static void nametbl_header(struct print_buf *buf, u32 depth) |
953 | { | 946 | { |
954 | tipc_printf(buf, "Type "); | 947 | const char *header[] = { |
955 | 948 | "Type ", | |
956 | if (depth > 1) | 949 | "Lower Upper ", |
957 | tipc_printf(buf, "Lower Upper "); | 950 | "Port Identity ", |
958 | if (depth > 2) | 951 | "Publication Scope" |
959 | tipc_printf(buf, "Port Identity "); | 952 | }; |
960 | if (depth > 3) | 953 | |
961 | tipc_printf(buf, "Publication"); | 954 | int i; |
962 | 955 | ||
963 | tipc_printf(buf, "\n-----------"); | 956 | if (depth > 4) |
964 | 957 | depth = 4; | |
965 | if (depth > 1) | 958 | for (i = 0; i < depth; i++) |
966 | tipc_printf(buf, "--------------------- "); | 959 | tipc_printf(buf, header[i]); |
967 | if (depth > 2) | ||
968 | tipc_printf(buf, "-------------------------- "); | ||
969 | if (depth > 3) | ||
970 | tipc_printf(buf, "------------------"); | ||
971 | |||
972 | tipc_printf(buf, "\n"); | 960 | tipc_printf(buf, "\n"); |
973 | } | 961 | } |
974 | 962 | ||