netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Stephen Hemminger <stephen@networkplumber.org>
To: leon@kernel.org
Cc: netdev@vger.kernel.org, Stephen Hemminger <stephen@networkplumber.org>
Subject: [PATCH iproute2 v1 1/2] rdma: colorize interface names
Date: Sun, 16 Aug 2020 16:02:55 -0700	[thread overview]
Message-ID: <20200816230256.13839-1-stephen@networkplumber.org> (raw)

Use the standard color outputs for interface names

Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
---
 rdma/dev.c  | 2 +-
 rdma/link.c | 2 +-
 rdma/res.c  | 6 +++---
 rdma/stat.c | 2 +-
 4 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/rdma/dev.c b/rdma/dev.c
index a11081b82170..fd4c2376550c 100644
--- a/rdma/dev.c
+++ b/rdma/dev.c
@@ -203,7 +203,7 @@ static int dev_parse_cb(const struct nlmsghdr *nlh, void *data)
 	idx =  mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_DEV_INDEX]);
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
 	print_color_uint(PRINT_ANY, COLOR_NONE, "ifindex", "%u: ", idx);
-	print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "%s: ", name);
+	print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", "%s: ", name);
 
 	dev_print_node_type(rd, tb);
 	dev_print_fw(rd, tb);
diff --git a/rdma/link.c b/rdma/link.c
index bf24b849a1e0..4b68eb28ec36 100644
--- a/rdma/link.c
+++ b/rdma/link.c
@@ -244,7 +244,7 @@ static int link_parse_cb(const struct nlmsghdr *nlh, void *data)
 
 	open_json_object(NULL);
 	print_color_uint(PRINT_JSON, COLOR_NONE, "ifindex", NULL, idx);
-	print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "link %s/", name);
+	print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", "link %s/", name);
 	print_color_uint(PRINT_ANY, COLOR_NONE, "port", "%u ", port);
 	link_print_subnet_prefix(rd, tb);
 	link_print_lid(rd, tb);
diff --git a/rdma/res.c b/rdma/res.c
index dc12bbe4bffe..4661dda4c303 100644
--- a/rdma/res.c
+++ b/rdma/res.c
@@ -76,7 +76,7 @@ static int res_no_args_parse_cb(const struct nlmsghdr *nlh, void *data)
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
 	open_json_object(NULL);
 	print_color_uint(PRINT_ANY, COLOR_NONE, "ifindex", "%u: ", idx);
-	print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "%s: ", name);
+	print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", "%s: ", name);
 	res_print_summary(rd, tb);
 	newline(rd);
 	return MNL_CB_OK;
@@ -167,7 +167,7 @@ void print_comm(struct rd *rd, const char *str, struct nlattr **nla_line)
 void print_dev(struct rd *rd, uint32_t idx, const char *name)
 {
 	print_color_int(PRINT_ANY, COLOR_NONE, "ifindex", NULL, idx);
-	print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "dev %s ", name);
+	print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", "dev %s ", name);
 }
 
 void print_link(struct rd *rd, uint32_t idx, const char *name, uint32_t port,
@@ -176,7 +176,7 @@ void print_link(struct rd *rd, uint32_t idx, const char *name, uint32_t port,
 	char tmp[64] = {};
 
 	print_color_uint(PRINT_JSON, COLOR_NONE, "ifindex", NULL, idx);
-	print_color_string(PRINT_ANY, COLOR_NONE, "ifname", NULL, name);
+	print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", NULL, name);
 	if (nla_line[RDMA_NLDEV_ATTR_PORT_INDEX]) {
 		print_color_uint(PRINT_ANY, COLOR_NONE, "port", NULL, port);
 		snprintf(tmp, sizeof(tmp), "%s/%d", name, port);
diff --git a/rdma/stat.c b/rdma/stat.c
index a2b5da1c7797..274e4aca5172 100644
--- a/rdma/stat.c
+++ b/rdma/stat.c
@@ -711,7 +711,7 @@ static int stat_show_parse_cb(const struct nlmsghdr *nlh, void *data)
 	name = mnl_attr_get_str(tb[RDMA_NLDEV_ATTR_DEV_NAME]);
 	port = mnl_attr_get_u32(tb[RDMA_NLDEV_ATTR_PORT_INDEX]);
 	open_json_object(NULL);
-	print_color_string(PRINT_ANY, COLOR_NONE, "ifname", "link %s/", name);
+	print_color_string(PRINT_ANY, COLOR_IFNAME, "ifname", "link %s/", name);
 	print_color_uint(PRINT_ANY, COLOR_NONE, "port", "%u ", port);
 	ret = res_get_hwcounters(rd, tb[RDMA_NLDEV_ATTR_STAT_HWCOUNTERS], true);
 
-- 
2.27.0


             reply	other threads:[~2020-08-16 23:03 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-16 23:02 Stephen Hemminger [this message]
2020-08-16 23:02 ` [PATCH iproute2 v1 2/2] rdma: use print_type() rather than print_color_type(xx, COLOR_NONE) Stephen Hemminger
2020-08-17  7:45   ` Leon Romanovsky
2020-08-17  7:46 ` [PATCH iproute2 v1 1/2] rdma: colorize interface names Leon Romanovsky

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=20200816230256.13839-1-stephen@networkplumber.org \
    --to=stephen@networkplumber.org \
    --cc=leon@kernel.org \
    --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).