[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200816230256.13839-1-stephen@networkplumber.org>
Date: Sun, 16 Aug 2020 16:02:55 -0700
From: Stephen Hemminger <stephen@...workplumber.org>
To: leon@...nel.org
Cc: netdev@...r.kernel.org,
Stephen Hemminger <stephen@...workplumber.org>
Subject: [PATCH iproute2 v1 1/2] rdma: colorize interface names
Use the standard color outputs for interface names
Signed-off-by: Stephen Hemminger <stephen@...workplumber.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
Powered by blists - more mailing lists