From: Jiri Pirko <jiri@resnulli.us>
To: netdev@vger.kernel.org
Cc: dsahern@gmail.com, stephen@networkplumber.org, ayal@mellanox.com,
mlxsw@mellanox.com
Subject: [patch iproute2c] devlink: fix json binary printout of arrays
Date: Wed, 9 Oct 2019 10:32:32 +0200 [thread overview]
Message-ID: <20191009083232.21147-1-jiri@resnulli.us> (raw)
From: Jiri Pirko <jiri@mellanox.com>
The binary is printed out into json as an array of byte values.
Add missing (removed) start and end array json calls.
Fixes: f359942a25d3 ("devlink: Remove enclosing array brackets binary print with json format")
Signed-off-by: Jiri Pirko <jiri@mellanox.com>
---
devlink/devlink.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/devlink/devlink.c b/devlink/devlink.c
index 51aba6e200cd..8fc1f3b8b35a 100644
--- a/devlink/devlink.c
+++ b/devlink/devlink.c
@@ -1930,6 +1930,8 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)
{
int i = 0;
+ if (dl->json_output)
+ jsonw_start_array(dl->jw);
while (i < len) {
if (dl->json_output)
jsonw_printf(dl->jw, "%d", data[i]);
@@ -1941,6 +1943,8 @@ static void pr_out_binary_value(struct dl *dl, uint8_t *data, uint32_t len)
}
if (!dl->json_output && !is_binary_eol(i))
__pr_out_newline();
+ if (dl->json_output)
+ jsonw_end_array(dl->jw);
}
static void pr_out_str_value(struct dl *dl, const char *value)
--
2.21.0
next reply other threads:[~2019-10-09 8:32 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-09 8:32 Jiri Pirko [this message]
2019-10-10 8:54 ` [patch iproute2c] devlink: fix json binary printout of arrays Jiri Pirko
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=20191009083232.21147-1-jiri@resnulli.us \
--to=jiri@resnulli.us \
--cc=ayal@mellanox.com \
--cc=dsahern@gmail.com \
--cc=mlxsw@mellanox.com \
--cc=netdev@vger.kernel.org \
--cc=stephen@networkplumber.org \
/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).