From: Jon Maloy <jon.maloy@ericsson.com>
To: <davem@davemloft.net>, <netdev@vger.kernel.org>
Cc: tipc-discussion@lists.sourceforge.net,
mohan.krishna.ghanta.krishnamurthy@ericsson.com
Subject: [iproute2-next 2/2] tipc: change node address printout formats
Date: Wed, 28 Mar 2018 18:52:14 +0200 [thread overview]
Message-ID: <1522255934-497-3-git-send-email-jon.maloy@ericsson.com> (raw)
In-Reply-To: <1522255934-497-1-git-send-email-jon.maloy@ericsson.com>
Since a node address now per definition is only an unstructured 32-bit
integer it makes no sense print it out as a structured string.
In this commit, we replace all occurrences of "<Z.C.N>" printouts with
just an "%x".
Acked-by: GhantaKrishnamurthy MohanKrishna <mohan.krishna.ghanta.krishnamurthy@ericsson.com>
Signed-off-by: Jon Maloy <jon.maloy@ericsson.com>
---
tipc/link.c | 3 +--
tipc/nametable.c | 16 +++++-----------
tipc/node.c | 11 ++---------
tipc/socket.c | 3 +--
4 files changed, 9 insertions(+), 24 deletions(-)
diff --git a/tipc/link.c b/tipc/link.c
index 4ae1c91..02f14aa 100644
--- a/tipc/link.c
+++ b/tipc/link.c
@@ -616,8 +616,7 @@ static void link_mon_print_non_applied(uint16_t applied, uint16_t member_cnt,
if (i != applied)
printf(",");
- sprintf(addr_str, "%u.%u.%u:", tipc_zone(members[i]),
- tipc_cluster(members[i]), tipc_node(members[i]));
+ sprintf(addr_str, "%x:", members[i]);
state = map_get(up_map, i) ? 'U' : 'D';
printf("%s%c", addr_str, state);
}
diff --git a/tipc/nametable.c b/tipc/nametable.c
index 770a644..2578940 100644
--- a/tipc/nametable.c
+++ b/tipc/nametable.c
@@ -26,7 +26,6 @@
static int nametable_show_cb(const struct nlmsghdr *nlh, void *data)
{
int *iteration = data;
- char port_id[PORTID_STR_LEN];
struct genlmsghdr *genl = mnl_nlmsg_get_payload(nlh);
struct nlattr *info[TIPC_NLA_MAX + 1] = {};
struct nlattr *attrs[TIPC_NLA_NAME_TABLE_MAX + 1] = {};
@@ -46,22 +45,17 @@ static int nametable_show_cb(const struct nlmsghdr *nlh, void *data)
return MNL_CB_ERROR;
if (!*iteration)
- printf("%-10s %-10s %-10s %-26s %-10s\n",
- "Type", "Lower", "Upper", "Port Identity",
+ printf("%-10s %-10s %-10s %-10s %-10s %-10s\n",
+ "Type", "Lower", "Upper", "Node", "Port",
"Publication Scope");
(*iteration)++;
- snprintf(port_id, sizeof(port_id), "<%u.%u.%u:%u>",
- tipc_zone(mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE])),
- tipc_cluster(mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE])),
- tipc_node(mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE])),
- mnl_attr_get_u32(publ[TIPC_NLA_PUBL_REF]));
-
- printf("%-10u %-10u %-10u %-26s %-12u",
+ printf("%-10u %-10u %-10u %-10x %-10u %-12u",
mnl_attr_get_u32(publ[TIPC_NLA_PUBL_TYPE]),
mnl_attr_get_u32(publ[TIPC_NLA_PUBL_LOWER]),
mnl_attr_get_u32(publ[TIPC_NLA_PUBL_UPPER]),
- port_id,
+ mnl_attr_get_u32(publ[TIPC_NLA_PUBL_NODE]),
+ mnl_attr_get_u32(publ[TIPC_NLA_PUBL_REF]),
mnl_attr_get_u32(publ[TIPC_NLA_PUBL_KEY]));
printf("%s\n", scope[mnl_attr_get_u32(publ[TIPC_NLA_PUBL_SCOPE])]);
diff --git a/tipc/node.c b/tipc/node.c
index 3ebbe0b..b73b644 100644
--- a/tipc/node.c
+++ b/tipc/node.c
@@ -40,10 +40,7 @@ static int node_list_cb(const struct nlmsghdr *nlh, void *data)
return MNL_CB_ERROR;
addr = mnl_attr_get_u32(attrs[TIPC_NLA_NODE_ADDR]);
- printf("<%u.%u.%u>: ",
- tipc_zone(addr),
- tipc_cluster(addr),
- tipc_node(addr));
+ printf("%x: ", addr);
if (attrs[TIPC_NLA_NODE_UP])
printf("up\n");
@@ -123,11 +120,7 @@ static int cmd_node_get_addr(struct nlmsghdr *nlh, const struct cmd *cmd,
}
close(sk);
- printf("<%u.%u.%u>\n",
- tipc_zone(addr.addr.id.node),
- tipc_cluster(addr.addr.id.node),
- tipc_node(addr.addr.id.node));
-
+ printf("%x\n", addr.addr.id.node);
return 0;
}
diff --git a/tipc/socket.c b/tipc/socket.c
index 48ba821..852984e 100644
--- a/tipc/socket.c
+++ b/tipc/socket.c
@@ -84,8 +84,7 @@ static int sock_list_cb(const struct nlmsghdr *nlh, void *data)
mnl_attr_parse_nested(attrs[TIPC_NLA_SOCK_CON], parse_attrs, con);
node = mnl_attr_get_u32(con[TIPC_NLA_CON_NODE]);
- printf(" connected to <%u.%u.%u:%u>", tipc_zone(node),
- tipc_cluster(node), tipc_node(node),
+ printf(" connected to %x:%u", node,
mnl_attr_get_u32(con[TIPC_NLA_CON_SOCK]));
if (con[TIPC_NLA_CON_FLAG])
--
2.1.4
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
next prev parent reply other threads:[~2018-03-28 16:52 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-03-28 16:52 [iproute2-next 0/2] tipc: changes to addressing structure Jon Maloy
2018-03-28 16:52 ` [iproute2-next 1/2] tipc: introduce command for handling a new 128-bit node identity Jon Maloy
2018-03-28 16:52 ` Jon Maloy [this message]
2018-03-29 17:52 ` [iproute2-next 0/2] tipc: changes to addressing structure David Ahern
2018-03-29 17:58 ` David Ahern
2018-03-29 22:49 ` Jon Maloy
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=1522255934-497-3-git-send-email-jon.maloy@ericsson.com \
--to=jon.maloy@ericsson.com \
--cc=davem@davemloft.net \
--cc=mohan.krishna.ghanta.krishnamurthy@ericsson.com \
--cc=netdev@vger.kernel.org \
--cc=tipc-discussion@lists.sourceforge.net \
/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).