Netdev List
 help / color / mirror / Atom feed
* [PATCH] bpftool: mmaped fields missing map structure in generated skeletons
@ 2022-05-23 20:26 Michael Mullin
  2022-05-23 22:02 ` Andrii Nakryiko
  0 siblings, 1 reply; 5+ messages in thread
From: Michael Mullin @ 2022-05-23 20:26 UTC (permalink / raw)
  To: Alexei Starovoitov, Daniel Borkmann, Andrii Nakryiko,
	Martin KaFai Lau, Song Liu, Yonghong Song, John Fastabend,
	KP Singh, netdev, bpf, linux-kernel

When generating a skeleton which has an mmaped map field, bpftool's
output is missing the map structure.  This causes a compile break when
the generated skeleton is compiled as the field belongs to the internal
struct maps, not directly to the obj.

Signed-off-by: Michael Mullin <masmullin@gmail.com>
---
 tools/bpf/bpftool/gen.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c
index f158dc1c2149..b49293795ba0 100644
--- a/tools/bpf/bpftool/gen.c
+++ b/tools/bpf/bpftool/gen.c
@@ -853,7 +853,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))) {
-			printf("\ts->maps[%zu].mmaped = (void **)&obj->%s;\n",
+			printf("\ts->maps[%zu].mmaped = (void **)&obj->maps.%s;\n",
 				i, ident);
 		}
 		i++;
-- 
2.36.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-05-23 23:09 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-05-23 20:26 [PATCH] bpftool: mmaped fields missing map structure in generated skeletons Michael Mullin
2022-05-23 22:02 ` Andrii Nakryiko
2022-05-23 22:19   ` Michael Mullin
2022-05-23 22:38     ` Andrii Nakryiko
2022-05-23 23:08       ` Michael Mullin

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox