]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
bpftool: rename is_internal_mmapable_map into is_mmapable_map
authorAndrii Nakryiko <andrii@kernel.org>
Thu, 7 Mar 2024 03:12:27 +0000 (19:12 -0800)
committerMartin KaFai Lau <martin.lau@kernel.org>
Thu, 7 Mar 2024 22:58:48 +0000 (14:58 -0800)
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: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Acked-by: Quentin Monnet <quentin@isovalent.com>
Link: https://lore.kernel.org/r/20240307031228.42896-6-alexei.starovoitov@gmail.com
Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
tools/bpf/bpftool/gen.c

index 1f579eacd9d413786bca1f21014629cc57e6eb1c..a3d72be347b0cb73a505af6a28889df6ec236855 100644 (file)
@@ -248,7 +248,7 @@ static const struct btf_type *find_type_for_map(struct btf *btf, const char *map
        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))
                return false;
@@ -274,7 +274,7 @@ static int codegen_datasecs(struct bpf_object *obj, const char *obj_name)
 
        bpf_object__for_each_map(map, obj) {
                /* 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;
 
                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
 
        bpf_object__for_each_map(map, obj) {
                /* 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;
 
                sec = find_type_for_map(btf, map_ident);
@@ -504,7 +504,7 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
                ", obj_name);
 
        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;
 
                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
                const void *mmap_data = NULL;
                size_t mmap_size = 0;
 
-               if (!is_internal_mmapable_map(map, ident, sizeof(ident)))
+               if (!is_mmapable_map(map, ident, sizeof(ident)))
                        continue;
 
                codegen("\
@@ -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) {
                const char *mmap_flags;
 
-               if (!is_internal_mmapable_map(map, ident, sizeof(ident)))
+               if (!is_mmapable_map(map, ident, sizeof(ident)))
                        continue;
 
                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)
                        ",
                        i, bpf_map__name(map), i, ident);
                /* 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",
                                i, ident);
                }
@@ -1617,7 +1617,7 @@ static int do_subskeleton(int argc, char **argv)
                /* Also count all maps that have a name */
                map_cnt++;
 
-               if (!is_internal_mmapable_map(map, ident, sizeof(ident)))
+               if (!is_mmapable_map(map, ident, sizeof(ident)))
                        continue;
 
                map_type_id = bpf_map__btf_value_type_id(map);
@@ -1739,7 +1739,7 @@ static int do_subskeleton(int argc, char **argv)
 
        /* walk through each symbol and emit the runtime representation */
        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;
 
                map_type_id = bpf_map__btf_value_type_id(map);