netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Moshe Shemesh <moshe@mellanox.com>
To: Stephen Hemminger <stephen@networkplumber.org>,
	David Ahern <dsahern@gmail.com>
Cc: Jiri Pirko <jiri@mellanox.com>,
	netdev@vger.kernel.org, Moshe Shemesh <moshe@mellanox.com>,
	Vladyslav Tarasiuk <vladyslavt@mellanox.com>
Subject: [PATCH iproute2-next 1/3] devlink: Add a possibility to print arrays of devlink port handles
Date: Sun, 19 Jul 2020 16:36:01 +0300	[thread overview]
Message-ID: <1595165763-13657-2-git-send-email-moshe@mellanox.com> (raw)
In-Reply-To: <1595165763-13657-1-git-send-email-moshe@mellanox.com>

From: Vladyslav Tarasiuk <vladyslavt@mellanox.com>

Add a capability of printing port handles for arrays in non-JSON format
in devlink-health manner.

Signed-off-by: Vladyslav Tarasiuk <vladyslavt@mellanox.com>
Reviewed-by: Jiri Pirko <jiri@mellanox.com>
---
 devlink/devlink.c |   14 +++++++++++++-
 1 files changed, 13 insertions(+), 1 deletions(-)

diff --git a/devlink/devlink.c b/devlink/devlink.c
index 6768149..bb4588e 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);
+		}
 	}
 }
 
-- 
1.7.1


  reply	other threads:[~2020-07-19 13:36 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-19 13:36 [PATCH iproute2-next 0/3] devlink: Add devlink port health command Moshe Shemesh
2020-07-19 13:36 ` Moshe Shemesh [this message]
2020-07-20 16:44   ` [PATCH iproute2-next 1/3] devlink: Add a possibility to print arrays of devlink port handles David Ahern
2020-07-20 16:58     ` David Ahern
2020-07-19 13:36 ` [PATCH iproute2-next 2/3] devlink: Add devlink port health command Moshe Shemesh
2020-07-19 13:36 ` [PATCH iproute2-next 3/3] devlink: Update devlink-health and devlink-port manpages Moshe Shemesh
2020-07-23  0:35 ` [PATCH iproute2-next 0/3] devlink: Add devlink port health command David Ahern

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=1595165763-13657-2-git-send-email-moshe@mellanox.com \
    --to=moshe@mellanox.com \
    --cc=dsahern@gmail.com \
    --cc=jiri@mellanox.com \
    --cc=netdev@vger.kernel.org \
    --cc=stephen@networkplumber.org \
    --cc=vladyslavt@mellanox.com \
    /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).