Commit c2de5814 authored by Allan Stephens's avatar Allan Stephens Committed by David S. Miller

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: default avatarAllan Stephens <allan.stephens@windriver.com>
Signed-off-by: default avatarPaul Gortmaker <paul.gortmaker@windriver.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 76ae0d71
...@@ -877,7 +877,7 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth, ...@@ -877,7 +877,7 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
u32 index) u32 index)
{ {
char portIdStr[27]; char portIdStr[27];
char *scopeStr; const char *scope_str[] = {"", " zone", " cluster", " node"};
struct publication *publ = sseq->zone_list; struct publication *publ = sseq->zone_list;
tipc_printf(buf, "%-10u %-10u ", sseq->lower, sseq->upper); 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,15 +893,8 @@ static void subseq_list(struct sub_seq *sseq, struct print_buf *buf, u32 depth,
tipc_node(publ->node), publ->ref); tipc_node(publ->node), publ->ref);
tipc_printf(buf, "%-26s ", portIdStr); tipc_printf(buf, "%-26s ", portIdStr);
if (depth > 3) { if (depth > 3) {
if (publ->node != tipc_own_addr) tipc_printf(buf, "%-10u %s", publ->key,
scopeStr = ""; scope_str[publ->scope]);
else if (publ->scope == TIPC_NODE_SCOPE)
scopeStr = "node";
else if (publ->scope == TIPC_CLUSTER_SCOPE)
scopeStr = "cluster";
else
scopeStr = "zone";
tipc_printf(buf, "%-10u %s", publ->key, scopeStr);
} }
publ = publ->zone_list_next; publ = publ->zone_list_next;
...@@ -951,24 +944,19 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth, ...@@ -951,24 +944,19 @@ static void nameseq_list(struct name_seq *seq, struct print_buf *buf, u32 depth,
static void nametbl_header(struct print_buf *buf, u32 depth) static void nametbl_header(struct print_buf *buf, u32 depth)
{ {
tipc_printf(buf, "Type "); const char *header[] = {
"Type ",
if (depth > 1) "Lower Upper ",
tipc_printf(buf, "Lower Upper "); "Port Identity ",
if (depth > 2) "Publication Scope"
tipc_printf(buf, "Port Identity "); };
if (depth > 3)
tipc_printf(buf, "Publication"); int i;
tipc_printf(buf, "\n-----------"); if (depth > 4)
depth = 4;
if (depth > 1) for (i = 0; i < depth; i++)
tipc_printf(buf, "--------------------- "); tipc_printf(buf, header[i]);
if (depth > 2)
tipc_printf(buf, "-------------------------- ");
if (depth > 3)
tipc_printf(buf, "------------------");
tipc_printf(buf, "\n"); tipc_printf(buf, "\n");
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment