]> git.proxmox.com Git - mirror_iproute2.git/commit
rdma: Rewrite custom JSON and prints logic to use common API
authorIdo Kalir <idok@mellanox.com>
Mon, 18 Nov 2019 08:35:30 +0000 (10:35 +0200)
committerDavid Ahern <dsahern@gmail.com>
Wed, 20 Nov 2019 02:27:36 +0000 (02:27 +0000)
commitb0a688a542cdf503202c59e55c39c2067138a7bd
tree715aaa0ceecd58825bc613cb577265efcc1de258
parent738728cc6cded8d3f2f4ad7778d50d57db0f2d5a
rdma: Rewrite custom JSON and prints logic to use common API

Instead of doing open-coded solution to generate JSON and prints, let's
reuse existing infrastructure and APIs to do the same as ip/*.

Before this change:
 if (rd->json_output)
     jsonw_uint_field(rd->jw, "sm_lid", sm_lid);
 else
     pr_out("sm_lid %u ", sm_lid);

After this change:
 print_uint(PRINT_ANY, "sm_lid", "sm_lid %u ", sm_lid);

All the print functions are converted to support color but for now the
type of color is COLOR_NONE. This is done as a preparation to addition
of color enable option. Such change will require rewrite of command line
arguments parser which is out-of-scope for this patch.

Signed-off-by: Ido Kalir <idok@mellanox.com>
Signed-off-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: David Ahern <dsahern@gmail.com>
14 files changed:
rdma/dev.c
rdma/link.c
rdma/rdma.c
rdma/rdma.h
rdma/res-cmid.c
rdma/res-cq.c
rdma/res-mr.c
rdma/res-pd.c
rdma/res-qp.c
rdma/res.c
rdma/stat-mr.c
rdma/stat.c
rdma/sys.c
rdma/utils.c