diff options
author | Stephen Hemminger <stephen@networkplumber.org> | 2024-01-02 09:20:41 -0800 |
---|---|---|
committer | Stephen Hemminger <stephen@networkplumber.org> | 2024-01-03 16:48:33 -0800 |
commit | f962b24a5a33d2f15c2674fb0aa8c464263498c3 (patch) | |
tree | 45bd80df77a9ef735b3db782e1a4aac2c30fed33 | |
parent | 22edc0cf37cdb14fa0b4709f698e03234ca1571a (diff) | |
download | iproute2-f962b24a5a33d2f15c2674fb0aa8c464263498c3.tar.gz |
rdma: make pretty behave like other commands
For tc, ip, etc the -pretty flag only has meaning if json
is used.
Signed-off-by: Stephen Hemminger <stephen@networkplumber.org>
-rw-r--r-- | rdma/rdma.c | 3 | ||||
-rw-r--r-- | rdma/rdma.h | 1 | ||||
-rw-r--r-- | rdma/stat.c | 6 | ||||
-rw-r--r-- | rdma/utils.c | 6 |
4 files changed, 5 insertions, 11 deletions
diff --git a/rdma/rdma.c b/rdma/rdma.c index 60ba8c0e5..bee1985f9 100644 --- a/rdma/rdma.c +++ b/rdma/rdma.c @@ -115,7 +115,7 @@ int main(int argc, char **argv) filename, version); return EXIT_SUCCESS; case 'p': - pretty = 1; + ++pretty; break; case 'd': if (show_details) @@ -153,7 +153,6 @@ int main(int argc, char **argv) rd.show_details = show_details; rd.show_driver_details = show_driver_details; - rd.pretty_output = pretty; rd.show_raw = show_raw; err = rd_init(&rd, filename); diff --git a/rdma/rdma.h b/rdma/rdma.h index f6830c851..f9308dbcf 100644 --- a/rdma/rdma.h +++ b/rdma/rdma.h @@ -68,7 +68,6 @@ struct rd { struct nlmsghdr *nlh; char *buff; json_writer_t *jw; - int pretty_output; bool suppress_errors; struct list_head filter_list; char *link_name; diff --git a/rdma/stat.c b/rdma/stat.c index 6a3f8ca44..b428a62ac 100644 --- a/rdma/stat.c +++ b/rdma/stat.c @@ -208,8 +208,7 @@ int res_get_hwcounters(struct rd *rd, struct nlattr *hwc_table, bool print) nm = mnl_attr_get_str(hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]); v = mnl_attr_get_u64(hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_VALUE]); - if (rd->pretty_output) - newline_indent(rd); + newline_indent(rd); res_print_u64(rd, nm, v, hw_line[RDMA_NLDEV_ATTR_STAT_HWCOUNTER_ENTRY_NAME]); } @@ -802,8 +801,7 @@ static int do_stat_mode_parse_cb(const struct nlmsghdr *nlh, void *data, } else { print_string(PRINT_FP, NULL, ",", NULL); } - if (rd->pretty_output) - newline_indent(rd); + newline_indent(rd); print_string(PRINT_ANY, NULL, "%s", name); } diff --git a/rdma/utils.c b/rdma/utils.c index 32e12a641..f332b2602 100644 --- a/rdma/utils.c +++ b/rdma/utils.c @@ -920,8 +920,7 @@ void print_driver_table(struct rd *rd, struct nlattr *tb) if (!rd->show_driver_details || !tb) return; - if (rd->pretty_output) - newline_indent(rd); + newline_indent(rd); /* * Driver attrs are tuples of {key, [print-type], value}. @@ -933,8 +932,7 @@ void print_driver_table(struct rd *rd, struct nlattr *tb) mnl_attr_for_each_nested(tb_entry, tb) { if (cc > MAX_LINE_LENGTH) { - if (rd->pretty_output) - newline_indent(rd); + newline_indent(rd); cc = 0; } if (rd_attr_check(tb_entry, &type) != MNL_CB_OK) |