summaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/testing_helpers.c
diff options
context:
space:
mode:
authorFlorent Revest <revest@chromium.org>2021-11-19 21:00:35 +0300
committerAndrii Nakryiko <andrii@kernel.org>2021-11-20 01:21:37 +0300
commit8cccee9e91e19207671b94af40bacf7c1d2e74ef (patch)
tree77bf1280f8f583f88b09586ef42dd70ded58b99b /tools/testing/selftests/bpf/testing_helpers.c
parent9a49afe6f5a516eb33bec24be0f81cb35ca79445 (diff)
downloadlinux-8cccee9e91e19207671b94af40bacf7c1d2e74ef.tar.xz
libbpf: Change bpf_program__set_extra_flags to bpf_program__set_flags
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> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/bpf/20211119180035.1396139-1-revest@chromium.org
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.c')
-rw-r--r--tools/testing/selftests/bpf/testing_helpers.c4
1 files changed, 3 insertions, 1 deletions
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;