All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH bpf] tools: bpftool: don't use hex numbers in JSON output
@ 2018-03-24  2:45 Jakub Kicinski
  2018-03-24 17:40 ` Alexei Starovoitov
  0 siblings, 1 reply; 2+ messages in thread
From: Jakub Kicinski @ 2018-03-24  2:45 UTC (permalink / raw)
  To: alexei.starovoitov, daniel; +Cc: oss-drivers, netdev, Jakub Kicinski

JSON does not accept hex numbers with 0x prefix.  Simply print
as decimal numbers, JSON should be primarily machine-readable.

Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
Fixes: 831a0aafe5c3 ("tools: bpftool: add JSON output for `bpftool map *` commands")
---
 tools/bpf/bpftool/map.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index f95fa67bb498..f509c86faede 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -428,7 +428,7 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
 		jsonw_string_field(json_wtr, "name", info->name);
 
 	jsonw_name(json_wtr, "flags");
-	jsonw_printf(json_wtr, "%#x", info->map_flags);
+	jsonw_printf(json_wtr, "%d", info->map_flags);
 
 	print_dev_json(info->ifindex, info->netns_dev, info->netns_ino);
 
-- 
2.16.2

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [PATCH bpf] tools: bpftool: don't use hex numbers in JSON output
  2018-03-24  2:45 [PATCH bpf] tools: bpftool: don't use hex numbers in JSON output Jakub Kicinski
@ 2018-03-24 17:40 ` Alexei Starovoitov
  0 siblings, 0 replies; 2+ messages in thread
From: Alexei Starovoitov @ 2018-03-24 17:40 UTC (permalink / raw)
  To: Jakub Kicinski; +Cc: daniel, oss-drivers, netdev

On Fri, Mar 23, 2018 at 07:45:12PM -0700, Jakub Kicinski wrote:
> JSON does not accept hex numbers with 0x prefix.  Simply print
> as decimal numbers, JSON should be primarily machine-readable.
> 
> Signed-off-by: Jakub Kicinski <jakub.kicinski@netronome.com>
> Reviewed-by: Quentin Monnet <quentin.monnet@netronome.com>
> Fixes: 831a0aafe5c3 ("tools: bpftool: add JSON output for `bpftool map *` commands")

Applied to bpf tree, thanks Jakub.

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-03-24 17:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-24  2:45 [PATCH bpf] tools: bpftool: don't use hex numbers in JSON output Jakub Kicinski
2018-03-24 17:40 ` Alexei Starovoitov

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.