Skip to content

Commit 1576b07

Browse files
anakryikoMartin KaFai Lau
authored andcommitted
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: Andrii Nakryiko <[email protected]> Signed-off-by: Alexei Starovoitov <[email protected]> Acked-by: Quentin Monnet <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Martin KaFai Lau <[email protected]>
1 parent d147357 commit 1576b07

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

tools/bpf/bpftool/gen.c

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -248,7 +248,7 @@ static const struct btf_type *find_type_for_map(struct btf *btf, const char *map
248248
return NULL;
249249
}
250250

251-
static bool is_internal_mmapable_map(const struct bpf_map *map, char *buf, size_t sz)
251+
static bool is_mmapable_map(const struct bpf_map *map, char *buf, size_t sz)
252252
{
253253
if (!bpf_map__is_internal(map) || !(bpf_map__map_flags(map) & BPF_F_MMAPABLE))
254254
return false;
@@ -274,7 +274,7 @@ static int codegen_datasecs(struct bpf_object *obj, const char *obj_name)
274274

275275
bpf_object__for_each_map(map, obj) {
276276
/* only generate definitions for memory-mapped internal maps */
277-
if (!is_internal_mmapable_map(map, map_ident, sizeof(map_ident)))
277+
if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
278278
continue;
279279

280280
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
327327

328328
bpf_object__for_each_map(map, obj) {
329329
/* only generate definitions for memory-mapped internal maps */
330-
if (!is_internal_mmapable_map(map, map_ident, sizeof(map_ident)))
330+
if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
331331
continue;
332332

333333
sec = find_type_for_map(btf, map_ident);
@@ -504,7 +504,7 @@ static void codegen_asserts(struct bpf_object *obj, const char *obj_name)
504504
", obj_name);
505505

506506
bpf_object__for_each_map(map, obj) {
507-
if (!is_internal_mmapable_map(map, map_ident, sizeof(map_ident)))
507+
if (!is_mmapable_map(map, map_ident, sizeof(map_ident)))
508508
continue;
509509

510510
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
720720
const void *mmap_data = NULL;
721721
size_t mmap_size = 0;
722722

723-
if (!is_internal_mmapable_map(map, ident, sizeof(ident)))
723+
if (!is_mmapable_map(map, ident, sizeof(ident)))
724724
continue;
725725

726726
codegen("\
@@ -782,7 +782,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h
782782
bpf_object__for_each_map(map, obj) {
783783
const char *mmap_flags;
784784

785-
if (!is_internal_mmapable_map(map, ident, sizeof(ident)))
785+
if (!is_mmapable_map(map, ident, sizeof(ident)))
786786
continue;
787787

788788
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)
871871
",
872872
i, bpf_map__name(map), i, ident);
873873
/* memory-mapped internal maps */
874-
if (mmaped && is_internal_mmapable_map(map, ident, sizeof(ident))) {
874+
if (mmaped && is_mmapable_map(map, ident, sizeof(ident))) {
875875
printf("\ts->maps[%zu].mmaped = (void **)&obj->%s;\n",
876876
i, ident);
877877
}
@@ -1617,7 +1617,7 @@ static int do_subskeleton(int argc, char **argv)
16171617
/* Also count all maps that have a name */
16181618
map_cnt++;
16191619

1620-
if (!is_internal_mmapable_map(map, ident, sizeof(ident)))
1620+
if (!is_mmapable_map(map, ident, sizeof(ident)))
16211621
continue;
16221622

16231623
map_type_id = bpf_map__btf_value_type_id(map);
@@ -1739,7 +1739,7 @@ static int do_subskeleton(int argc, char **argv)
17391739

17401740
/* walk through each symbol and emit the runtime representation */
17411741
bpf_object__for_each_map(map, obj) {
1742-
if (!is_internal_mmapable_map(map, ident, sizeof(ident)))
1742+
if (!is_mmapable_map(map, ident, sizeof(ident)))
17431743
continue;
17441744

17451745
map_type_id = bpf_map__btf_value_type_id(map);

0 commit comments

Comments
 (0)