Netdev List
 help / color / mirror / Atom feed
From: Michael Mullin <masmullin@gmail.com>
To: Alexei Starovoitov <ast@kernel.org>,
	Daniel Borkmann <daniel@iogearbox.net>,
	Andrii Nakryiko <andrii@kernel.org>,
	Martin KaFai Lau <kafai@fb.com>, Song Liu <songliubraving@fb.com>,
	Yonghong Song <yhs@fb.com>,
	John Fastabend <john.fastabend@gmail.com>,
	KP Singh <kpsingh@kernel.org>,
	netdev@vger.kernel.org, bpf@vger.kernel.org,
	linux-kernel@vger.kernel.org
Subject: [PATCH] bpftool: mmaped fields missing map structure in generated skeletons
Date: Mon, 23 May 2022 16:26:49 -0400	[thread overview]
Message-ID: <20220523202649.6iiz4h2wf5ryx3w2@jup> (raw)

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


             reply	other threads:[~2022-05-23 20:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-23 20:26 Michael Mullin [this message]
2022-05-23 22:02 ` [PATCH] bpftool: mmaped fields missing map structure in generated skeletons Andrii Nakryiko
2022-05-23 22:19   ` Michael Mullin
2022-05-23 22:38     ` Andrii Nakryiko
2022-05-23 23:08       ` Michael Mullin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220523202649.6iiz4h2wf5ryx3w2@jup \
    --to=masmullin@gmail.com \
    --cc=andrii@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=john.fastabend@gmail.com \
    --cc=kafai@fb.com \
    --cc=kpsingh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox