aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPrashant Bhole <[email protected]>2019-04-17 09:22:59 +0900
committerAlexei Starovoitov <[email protected]>2019-04-16 19:48:26 -0700
commitd1b7725dfea3e6c1aff2ee94baf3658aba450fbe (patch)
tree8af00b98facbc59b1a388f8cc248cf5f61ff3e18
parentd459b59ee0f5ed2fa96e77bbd919e095b1aeceb0 (diff)
tools/bpftool: show btf_id in map listing
Let's print btf id of map similar to the way we are printing it for programs. Sample output: user@test# bpftool map -f 61: lpm_trie flags 0x1 key 20B value 8B max_entries 1 memlock 4096B 133: array name test_btf_id flags 0x0 key 4B value 4B max_entries 4 memlock 4096B pinned /sys/fs/bpf/test100 btf_id 174 170: array name test_btf_id flags 0x0 key 4B value 4B max_entries 4 memlock 4096B btf_id 240 Signed-off-by: Prashant Bhole <[email protected]> Reviewed-by: Quentin Monnet <[email protected]> Reviewed-by: Jakub Kicinski <[email protected]> Acked-by: Song Liu <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]>
-rw-r--r--tools/bpf/bpftool/map.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/tools/bpf/bpftool/map.c b/tools/bpf/bpftool/map.c
index 846d2e5c64b4..10b6c9d3e525 100644
--- a/tools/bpf/bpftool/map.c
+++ b/tools/bpf/bpftool/map.c
@@ -531,6 +531,9 @@ static int show_map_close_json(int fd, struct bpf_map_info *info)
}
close(fd);
+ if (info->btf_id)
+ jsonw_int_field(json_wtr, "btf_id", info->btf_id);
+
if (!hash_empty(map_table.table)) {
struct pinned_obj *obj;
@@ -606,6 +609,9 @@ static int show_map_close_plain(int fd, struct bpf_map_info *info)
}
}
+ if (info->btf_id)
+ printf("\n\tbtf_id %d", info->btf_id);
+
printf("\n");
return 0;
}