diff --git a/tools/lib/bpf/libbpf.c b/tools/lib/bpf/libbpf.c index 78de238f975a8adfd7e7a200835fa33d3d649c3f..af405c38aadc757427fcbb8594fc23186b907127 100644 --- a/tools/lib/bpf/libbpf.c +++ b/tools/lib/bpf/libbpf.c @@ -8315,12 +8315,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 003fdc5cf3a8d2ab93071e4f5a9d78f237bcce4e..d02139fec4acc9a6029f3698b5223b6c53342aa8 100644 --- a/tools/lib/bpf/libbpf.h +++ b/tools/lib/bpf/libbpf.h @@ -498,7 +498,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 bea6791272e567070c3f4bfdb327d1e3f75f0cb5..69bc069f0a683edf0dd9263e6fe8762d89572dff 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 52c2f24e0898b4013a1e18877b2c39e5191ef0e3..0f1c37ac6f2c30ca1eb9943e9126062fd4e1a8f4 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;