From: Vladyslav Tarasiuk Date: Sun, 19 Jul 2020 13:36:01 +0000 (+0300) Subject: devlink: Add a possibility to print arrays of devlink port handles X-Git-Tag: v5.9.0~29^2~2 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=e533faa72e91ba7d42f7bfd921380d0540f369e8;p=thirdparty%2Fiproute2.git devlink: Add a possibility to print arrays of devlink port handles Add a capability of printing port handles for arrays in non-JSON format in devlink-health manner. Signed-off-by: Vladyslav Tarasiuk Reviewed-by: Jiri Pirko Signed-off-by: David Ahern --- diff --git a/devlink/devlink.c b/devlink/devlink.c index 67681492f..bb4588e22 100644 --- a/devlink/devlink.c +++ b/devlink/devlink.c @@ -2112,7 +2112,19 @@ static void __pr_out_port_handle_start(struct dl *dl, const char *bus_name, open_json_object(buf); } } else { - pr_out("%s:", buf); + if (array) { + if (should_arr_last_port_handle_end(dl, bus_name, dev_name, port_index)) + __pr_out_indent_dec(); + if (should_arr_last_port_handle_start(dl, bus_name, + dev_name, port_index)) { + pr_out("%s:", buf); + __pr_out_newline(); + __pr_out_indent_inc(); + arr_last_port_handle_set(dl, bus_name, dev_name, port_index); + } + } else { + pr_out("%s:", buf); + } } }