Commit 1576b079 authored by Andrii Nakryiko's avatar Andrii Nakryiko Committed by Martin KaFai Lau

bpftool: rename is_internal_mmapable_map into is_mmapable_map

It's not restricted to working with "internal" maps, it cares about any
map that can be mmap'ed. Reflect that in more succinct and generic name.
Signed-off-by: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Acked-by: default avatarQuentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20240307031228.42896-6-alexei.starovoitov@gmail.comSigned-off-by: default avatarMartin KaFai Lau <martin.lau@kernel.org>
parent d147357e
...@@ -248,7 +248,7 @@ static const struct btf_type *find_type_for_map(struct btf *btf, const char *map ...@@ -248,7 +248,7 @@ static const struct btf_type *find_type_for_map(struct btf *btf, const char *map
return NULL; return NULL;
} }
static bool is_internal_mmapable_map(const struct bpf_map *map, char *buf, size_t sz) static bool is_mmapable_map(const struct bpf_map *map, char *buf, size_t sz)
{ {
if (!bpf_map__is_internal(map) || !(bpf_map__map_flags(map) & BPF_F_MMAPABLE)) if (!bpf_map__is_internal(map) || !(bpf_map__map_flags(map) & BPF_F_MMAPABLE))
return false; return false;
...@@ -274,7 +274,7 @@ static int codegen_datasecs(struct bpf_object *obj, const char *obj_name) ...@@ -274,7 +274,7 @@ static int codegen_datasecs(struct bpf_object *obj, const char *obj_name)
bpf_object__for_each_map(map, obj) { bpf_object__for_each_map(map, obj) {
/* only generate definitions for memory-mapped internal maps */ /* only generate definitions for memory-mapped internal maps */
if (!is_internal_mmapable_map(map, map_ident, sizeof(map_ident))) if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
continue; continue;
sec = find_type_for_map(btf, map_ident); sec = find_type_for_map(btf, map_ident);
...@@ -327,7 +327,7 @@ static int codegen_subskel_datasecs(struct bpf_object *obj, const char *obj_name ...@@ -327,7 +327,7 @@ static int codegen_subskel_datasecs(struct bpf_object *obj, const char *obj_name
bpf_object__for_each_map(map, obj) { bpf_object__for_each_map(map, obj) {
/* only generate definitions for memory-mapped internal maps */ /* only generate definitions for memory-mapped internal maps */
if (!is_internal_mmapable_map(map, map_ident, sizeof(map_ident))) if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
continue; continue;
sec = find_type_for_map(btf, map_ident); sec = find_type_for_map(btf, map_ident);
...@@ -504,7 +504,7 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name) ...@@ -504,7 +504,7 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
", obj_name); ", obj_name);
bpf_object__for_each_map(map, obj) { bpf_object__for_each_map(map, obj) {
if (!is_internal_mmapable_map(map, map_ident, sizeof(map_ident))) if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
continue; continue;
sec = find_type_for_map(btf, map_ident); sec = find_type_for_map(btf, map_ident);
...@@ -720,7 +720,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h ...@@ -720,7 +720,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h
const void *mmap_data = NULL; const void *mmap_data = NULL;
size_t mmap_size = 0; size_t mmap_size = 0;
if (!is_internal_mmapable_map(map, ident, sizeof(ident))) if (!is_mmapable_map(map, ident, sizeof(ident)))
continue; continue;
codegen("\ codegen("\
...@@ -782,7 +782,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h ...@@ -782,7 +782,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h
bpf_object__for_each_map(map, obj) { bpf_object__for_each_map(map, obj) {
const char *mmap_flags; const char *mmap_flags;
if (!is_internal_mmapable_map(map, ident, sizeof(ident))) if (!is_mmapable_map(map, ident, sizeof(ident)))
continue; continue;
if (bpf_map__map_flags(map) & BPF_F_RDONLY_PROG) if (bpf_map__map_flags(map) & BPF_F_RDONLY_PROG)
...@@ -871,7 +871,7 @@ codegen_maps_skeleton(struct bpf_object *obj, size_t map_cnt, bool mmaped) ...@@ -871,7 +871,7 @@ codegen_maps_skeleton(struct bpf_object *obj, size_t map_cnt, bool mmaped)
", ",
i, bpf_map__name(map), i, ident); i, bpf_map__name(map), i, ident);
/* memory-mapped internal maps */ /* memory-mapped internal maps */
if (mmaped && is_internal_mmapable_map(map, ident, sizeof(ident))) { if (mmaped && is_mmapable_map(map, ident, sizeof(ident))) {
printf("\ts->maps[%zu].mmaped = (void **)&obj->%s;\n", printf("\ts->maps[%zu].mmaped = (void **)&obj->%s;\n",
i, ident); i, ident);
} }
...@@ -1617,7 +1617,7 @@ static int do_subskeleton(int argc, char **argv) ...@@ -1617,7 +1617,7 @@ static int do_subskeleton(int argc, char **argv)
/* Also count all maps that have a name */ /* Also count all maps that have a name */
map_cnt++; map_cnt++;
if (!is_internal_mmapable_map(map, ident, sizeof(ident))) if (!is_mmapable_map(map, ident, sizeof(ident)))
continue; continue;
map_type_id = bpf_map__btf_value_type_id(map); map_type_id = bpf_map__btf_value_type_id(map);
...@@ -1739,7 +1739,7 @@ static int do_subskeleton(int argc, char **argv) ...@@ -1739,7 +1739,7 @@ static int do_subskeleton(int argc, char **argv)
/* walk through each symbol and emit the runtime representation */ /* walk through each symbol and emit the runtime representation */
bpf_object__for_each_map(map, obj) { bpf_object__for_each_map(map, obj) {
if (!is_internal_mmapable_map(map, ident, sizeof(ident))) if (!is_mmapable_map(map, ident, sizeof(ident)))
continue; continue;
map_type_id = bpf_map__btf_value_type_id(map); map_type_id = bpf_map__btf_value_type_id(map);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment