From: Paul Gortmaker <paul.gortmaker@windriver.com>
To: davem@davemloft.net
Cc: netdev@vger.kernel.org, allan.stephens@windriver.com
Subject: [PATCH net-next 12/14] tipc: Minor enhancements to name table display format
Date: Tue, 17 Aug 2010 17:00:14 -0400 [thread overview]
Message-ID: <1282078816-11844-13-git-send-email-paul.gortmaker@windriver.com> (raw)
In-Reply-To: <1282078816-11844-1-git-send-email-paul.gortmaker@windriver.com>
From: Allan Stephens <allan.stephens@windriver.com>
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>
---
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 8ba7962..d504e49 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,
u32 index)
{
char portIdStr[27];
- char *scopeStr;
+ const char *scope_str[] = {"", " zone", " cluster", " node"};
struct publication *publ = sseq->zone_list;
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,
tipc_node(publ->node), publ->ref);
tipc_printf(buf, "%-26s ", portIdStr);
if (depth > 3) {
- if (publ->node != tipc_own_addr)
- scopeStr = "";
- 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);
+ tipc_printf(buf, "%-10u %s", publ->key,
+ scope_str[publ->scope]);
}
publ = publ->zone_list_next;
@@ -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)
{
- tipc_printf(buf, "Type ");
-
- if (depth > 1)
- tipc_printf(buf, "Lower Upper ");
- if (depth > 2)
- tipc_printf(buf, "Port Identity ");
- if (depth > 3)
- tipc_printf(buf, "Publication");
-
- tipc_printf(buf, "\n-----------");
-
- if (depth > 1)
- tipc_printf(buf, "--------------------- ");
- if (depth > 2)
- tipc_printf(buf, "-------------------------- ");
- if (depth > 3)
- tipc_printf(buf, "------------------");
-
+ const char *header[] = {
+ "Type ",
+ "Lower Upper ",
+ "Port Identity ",
+ "Publication Scope"
+ };
+
+ int i;
+
+ if (depth > 4)
+ depth = 4;
+ for (i = 0; i < depth; i++)
+ tipc_printf(buf, header[i]);
tipc_printf(buf, "\n");
}
--
1.7.2.1
next prev parent reply other threads:[~2010-08-17 21:00 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-08-17 21:00 [PATCH 0/14 net-next] more TIPC fixes and updates Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 01/14] tipc: Fix log buffer memory leak if initialization fails Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 02/14] tipc: add SO_RCVLOWAT support to stream socket receive path Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 03/14] tipc: Provide correct error code for unsupported connect() operation Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 04/14] tipc: correct problems with misleading flags returned using poll() Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 05/14] tipc: Check for disabled bearer when processing incoming messages Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 06/14] tipc: Prevent crash when broadcast link cannot send to all nodes Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 07/14] tipc: Fix premature broadcast advertisement by sending node Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 08/14] tipc: Fix bug in broadcast link transmit statistics computation Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 09/14] tipc: Remove per-connection sequence number logic Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 10/14] tipc: Optimize tipc_node_has_active_links() Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 11/14] tipc: Eliminate useless linked list initialization Paul Gortmaker
2010-08-18 0:29 ` David Miller
2010-08-18 13:28 ` Paul Gortmaker
2010-08-17 21:00 ` Paul Gortmaker [this message]
2010-08-17 21:00 ` [PATCH net-next 13/14] tipc: Allow connect() to wait indefinitely Paul Gortmaker
2010-08-17 21:00 ` [PATCH net-next 14/14] tipc: Prevent missing name table entries when link flip-flops rapidly Paul Gortmaker
2010-08-18 0:33 ` [PATCH 0/14 net-next] more TIPC fixes and updates David Miller
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1282078816-11844-13-git-send-email-paul.gortmaker@windriver.com \
--to=paul.gortmaker@windriver.com \
--cc=allan.stephens@windriver.com \
--cc=davem@davemloft.net \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).