* [patch iproute2c] devlink: fix json binary printout of arrays
@ 2019-10-09 8:32 Jiri Pirko
2019-10-10 8:54 ` Jiri Pirko
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Pirko @ 2019-10-09 8:32 UTC (permalink / raw)
To: netdev; +Cc: dsahern, stephen, ayal, mlxsw
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
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [patch iproute2c] devlink: fix json binary printout of arrays
2019-10-09 8:32 [patch iproute2c] devlink: fix json binary printout of arrays Jiri Pirko
@ 2019-10-10 8:54 ` Jiri Pirko
0 siblings, 0 replies; 2+ messages in thread
From: Jiri Pirko @ 2019-10-10 8:54 UTC (permalink / raw)
To: netdev; +Cc: dsahern, stephen, ayal, mlxsw
Wed, Oct 09, 2019 at 10:32:32AM CEST, jiri@resnulli.us wrote:
>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>
Please scratch this patch.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-10-10 8:54 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-10-09 8:32 [patch iproute2c] devlink: fix json binary printout of arrays Jiri Pirko
2019-10-10 8:54 ` Jiri Pirko
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).