All of lore.kernel.org
 help / color / mirror / Atom feed
From: Matt Smith <alastorze@fb.com>
To: <bpf@vger.kernel.org>, <ast@kernel.org>, <andriin@kernel.org>,
	<daniel@iogearbox.net>, <kernel-team@fb.com>
Cc: Matt Smith <alastorze@fb.com>
Subject: [PATCH v2 bpf-next 1/3] libbpf: Change bpf_object_skelecton data field to const void*
Date: Wed, 1 Sep 2021 12:44:37 -0700	[thread overview]
Message-ID: <20210901194439.3853238-2-alastorze@fb.com> (raw)
In-Reply-To: <20210901194439.3853238-1-alastorze@fb.com>

This change was necessary to enforce the implied contract
that bpf_object_skeleton->data should not be mutated.  The data
will be cast to `void *` during assignment to handle the case
where a user is compiling with older libbpf headers to avoid
a compiler warning of `const void *` data being cast to `void *`

Signed-off-by: Matt Smith <alastorze@fb.com>
---
 tools/lib/bpf/libbpf.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index f177d897c5f7..2f6f0e15d1e7 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -854,7 +854,7 @@ struct bpf_object_skeleton {
 	size_t sz; /* size of this struct, for forward/backward compatibility */
 
 	const char *name;
-	void *data;
+	const void *data;
 	size_t data_sz;
 
 	struct bpf_object **obj;
-- 
2.30.2


  reply	other threads:[~2021-09-01 19:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-09-01 19:44 [PATCH v2 bpf-next 0/3] Bpf skeleton helper method Matt Smith
2021-09-01 19:44 ` Matt Smith [this message]
2021-09-01 19:44 ` [PATCH v2 bpf-next 2/3] bpftool: Provide a helper method for accessing bpf binary data Matt Smith
2021-09-01 19:44 ` [PATCH v2 bpf-next 3/3] selftests/bpf: Add checks for X__elf_bytes skeleton helper Matt Smith
2021-09-08  1:02 ` [PATCH v2 bpf-next 0/3] Bpf skeleton helper method Andrii Nakryiko

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=20210901194439.3853238-2-alastorze@fb.com \
    --to=alastorze@fb.com \
    --cc=andriin@kernel.org \
    --cc=ast@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=daniel@iogearbox.net \
    --cc=kernel-team@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.