diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2024-01-03 17:38:41 -0800 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2024-01-03 21:22:49 -0800 |
commit | f08c18e083adfef92946ae1d44b07bb81e727e08 (patch) | |
tree | 7b16972d9d1a08dfd503e61129548f672cce1846 /tools/perf/scripts/python/export-to-sqlite.py | |
parent | fa98b54bff39f51c46fc96d3385c6292391c277b (diff) |
libbpf: don't rely on map->fd as an indicator of map being created
With the upcoming switch to preallocated placeholder FDs for maps,
switch various getters/setter away from checking map->fd. Use
map_is_created() helper that detect whether BPF map can be modified based
on map->obj->loaded state, with special provision for maps set up with
bpf_map__reuse_fd().
For backwards compatibility, we take map_is_created() into account in
bpf_map__fd() getter as well. This way before bpf_object__load() phase
bpf_map__fd() will always return -1, just as before the changes in
subsequent patches adding stable map->fd placeholders.
We also get rid of all internal uses of bpf_map__fd() getter, as it's
more oriented for uses external to libbpf. The above map_is_created()
check actually interferes with some of the internal uses, if map FD is
fetched through bpf_map__fd().
Acked-by: Jiri Olsa <jolsa@kernel.org>
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Link: https://lore.kernel.org/r/20240104013847.3875810-4-andrii@kernel.org
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/perf/scripts/python/export-to-sqlite.py')
0 files changed, 0 insertions, 0 deletions