diff mbox series

[bpf-next] libbpf: Change bpf_program__set_extra_flags to bpf_program__set_flags

Message ID 20211119180035.1396139-1-revest@chromium.org (mailing list archive)
State Accepted
Commit 8cccee9e91e19207671b94af40bacf7c1d2e74ef
Delegated to: BPF
Headers show
Series [bpf-next] libbpf: Change bpf_program__set_extra_flags to bpf_program__set_flags | expand

Checks

Context Check Description
netdev/tree_selection success Clearly marked for bpf-next
netdev/fixes_present success Fixes tag not required for -next series
netdev/subject_prefix success Link
netdev/cover_letter success Single patches do not need cover letters
netdev/patch_count success Link
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers warning 9 maintainers not CCed: kafai@fb.com songliubraving@fb.com shuah@kernel.org john.fastabend@gmail.com yhs@fb.com daniel@iogearbox.net ast@kernel.org linux-kselftest@vger.kernel.org netdev@vger.kernel.org
netdev/build_clang success Errors and warnings before: 0 this patch: 0
netdev/module_param success Was 0 now: 0
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 0 this patch: 0
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 46 lines checked
netdev/kdoc success Errors and warnings before: 16 this patch: 16
netdev/source_inline success Was 0 now: 0
bpf/vmtest-bpf-next fail VM_Test
bpf/vmtest-bpf-next-PR fail PR summary

Commit Message

Florent Revest Nov. 19, 2021, 6 p.m. UTC
bpf_program__set_extra_flags has just been introduced so we can still
change it without breaking users.

This new interface is a bit more flexible (for example if someone wants
to clear a flag).

Signed-off-by: Florent Revest <revest@chromium.org>
---
 tools/lib/bpf/libbpf.c                        | 4 ++--
 tools/lib/bpf/libbpf.h                        | 2 +-
 tools/lib/bpf/libbpf.map                      | 2 +-
 tools/testing/selftests/bpf/testing_helpers.c | 4 +++-
 4 files changed, 7 insertions(+), 5 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Nov. 19, 2021, 10:40 p.m. UTC | #1
Hello:

This patch was applied to bpf/bpf-next.git (master)
by Andrii Nakryiko <andrii@kernel.org>:

On Fri, 19 Nov 2021 19:00:35 +0100 you wrote:
> bpf_program__set_extra_flags has just been introduced so we can still
> change it without breaking users.
> 
> This new interface is a bit more flexible (for example if someone wants
> to clear a flag).
> 
> Signed-off-by: Florent Revest <revest@chromium.org>
> 
> [...]

Here is the summary with links:
  - [bpf-next] libbpf: Change bpf_program__set_extra_flags to bpf_program__set_flags
    https://git.kernel.org/bpf/bpf-next/c/8cccee9e91e1

You are awesome, thank you!
diff mbox series

Patch

diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c
index de7e09a6b5ec..fa164cdbf3c9 100644
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -8296,12 +8296,12 @@  __u32 bpf_program__flags(const struct bpf_program *prog)
 	return prog->prog_flags;
 }
 
-int bpf_program__set_extra_flags(struct bpf_program *prog, __u32 extra_flags)
+int bpf_program__set_flags(struct bpf_program *prog, __u32 flags)
 {
 	if (prog->obj->loaded)
 		return libbpf_err(-EBUSY);
 
-	prog->prog_flags |= extra_flags;
+	prog->prog_flags = flags;
 	return 0;
 }
 
diff --git a/tools/lib/bpf/libbpf.h b/tools/lib/bpf/libbpf.h
index 4ec69f224342..b9900d9680d6 100644
--- a/tools/lib/bpf/libbpf.h
+++ b/tools/lib/bpf/libbpf.h
@@ -494,7 +494,7 @@  bpf_program__set_expected_attach_type(struct bpf_program *prog,
 				      enum bpf_attach_type type);
 
 LIBBPF_API __u32 bpf_program__flags(const struct bpf_program *prog);
-LIBBPF_API int bpf_program__set_extra_flags(struct bpf_program *prog, __u32 extra_flags);
+LIBBPF_API int bpf_program__set_flags(struct bpf_program *prog, __u32 flags);
 
 LIBBPF_API int
 bpf_program__set_attach_target(struct bpf_program *prog, int attach_prog_fd,
diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map
index 6a59514a48cf..61ae2e0ab345 100644
--- a/tools/lib/bpf/libbpf.map
+++ b/tools/lib/bpf/libbpf.map
@@ -400,7 +400,7 @@  LIBBPF_0.6.0 {
 		bpf_program__flags;
 		bpf_program__insn_cnt;
 		bpf_program__insns;
-		bpf_program__set_extra_flags;
+		bpf_program__set_flags;
 		btf__add_btf;
 		btf__add_decl_tag;
 		btf__add_type_tag;
diff --git a/tools/testing/selftests/bpf/testing_helpers.c b/tools/testing/selftests/bpf/testing_helpers.c
index 52c2f24e0898..0f1c37ac6f2c 100644
--- a/tools/testing/selftests/bpf/testing_helpers.c
+++ b/tools/testing/selftests/bpf/testing_helpers.c
@@ -91,6 +91,7 @@  int bpf_prog_test_load(const char *file, enum bpf_prog_type type,
 	struct bpf_object_load_attr attr = {};
 	struct bpf_object *obj;
 	struct bpf_program *prog;
+	__u32 flags;
 	int err;
 
 	obj = bpf_object__open(file);
@@ -106,7 +107,8 @@  int bpf_prog_test_load(const char *file, enum bpf_prog_type type,
 	if (type != BPF_PROG_TYPE_UNSPEC)
 		bpf_program__set_type(prog, type);
 
-	bpf_program__set_extra_flags(prog, BPF_F_TEST_RND_HI32);
+	flags = bpf_program__flags(prog) | BPF_F_TEST_RND_HI32;
+	bpf_program__set_flags(prog, flags);
 
 	attr.obj = obj;
 	attr.log_level = extra_prog_load_log_flags;