summaryrefslogtreecommitdiff
path: root/tools/bpf/bpftool/link.c
diff options
context:
space:
mode:
authorQuentin Monnet <quentin@isovalent.com>2021-10-23 23:51:54 +0300
committerAndrii Nakryiko <andrii@kernel.org>2021-10-26 03:31:39 +0300
commitd6699f8e0f834b40db35466f704705ae757be11a (patch)
tree3e31240e3364c28bc0a4cdd1840b0c78018be12d /tools/bpf/bpftool/link.c
parent2828d0d75b738c9cd98080c530b7b7ea90b279dd (diff)
downloadlinux-d6699f8e0f834b40db35466f704705ae757be11a.tar.xz
bpftool: Switch to libbpf's hashmap for PIDs/names references
In order to show PIDs and names for processes holding references to BPF programs, maps, links, or BTF objects, bpftool creates hash maps to store all relevant information. This commit is part of a set that transitions from the kernel's hash map implementation to the one coming with libbpf. The motivation is to make bpftool less dependent of kernel headers, to ease the path to a potential out-of-tree mirror, like libbpf has. This is the third and final step of the transition, in which we convert the hash maps used for storing the information about the processes holding references to BPF objects (programs, maps, links, BTF), and at last we drop the inclusion of tools/include/linux/hashtable.h. Note: Checkpatch complains about the use of __weak declarations, and the missing empty lines after the bunch of empty function declarations when compiling without the BPF skeletons (none of these were introduced in this patch). We want to keep things as they are, and the reports should be safe to ignore. Signed-off-by: Quentin Monnet <quentin@isovalent.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211023205154.6710-6-quentin@isovalent.com
Diffstat (limited to 'tools/bpf/bpftool/link.c')
-rw-r--r--tools/bpf/bpftool/link.c6
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/bpf/bpftool/link.c b/tools/bpf/bpftool/link.c
index 404cc5459c6b..2c258db0d352 100644
--- a/tools/bpf/bpftool/link.c
+++ b/tools/bpf/bpftool/link.c
@@ -170,7 +170,7 @@ static int show_link_close_json(int fd, struct bpf_link_info *info)
jsonw_end_array(json_wtr);
}
- emit_obj_refs_json(&refs_table, info->id, json_wtr);
+ emit_obj_refs_json(refs_table, info->id, json_wtr);
jsonw_end_object(json_wtr);
@@ -253,7 +253,7 @@ static int show_link_close_plain(int fd, struct bpf_link_info *info)
u32_as_hash_field(info->id))
printf("\n\tpinned %s", (char *)entry->value);
}
- emit_obj_refs_plain(&refs_table, info->id, "\n\tpids ");
+ emit_obj_refs_plain(refs_table, info->id, "\n\tpids ");
printf("\n");
@@ -352,7 +352,7 @@ static int do_show(int argc, char **argv)
if (json_output)
jsonw_end_array(json_wtr);
- delete_obj_refs_table(&refs_table);
+ delete_obj_refs_table(refs_table);
if (show_pinned)
delete_pinned_obj_table(link_table);