diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-12-09 22:38:39 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-12-11 02:29:18 +0300 |
commit | 3fc5fdcca144badbaf29b62aacbf7877f2f39a74 (patch) | |
tree | b908e0ed713b9cbf8fe827d39d15038b80e0a2c5 /tools/testing/selftests/bpf/testing_helpers.c | |
parent | 57e889269af3dd0609933e2550c4baee7a7eb84c (diff) | |
download | linux-3fc5fdcca144badbaf29b62aacbf7877f2f39a74.tar.xz |
selftests/bpf: Remove the only use of deprecated bpf_object__load_xattr()
Switch from bpf_object__load_xattr() to bpf_object__load() and
kernel_log_level in bpf_object_open_opts.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211209193840.1248570-12-andrii@kernel.org
Diffstat (limited to 'tools/testing/selftests/bpf/testing_helpers.c')
-rw-r--r-- | tools/testing/selftests/bpf/testing_helpers.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/tools/testing/selftests/bpf/testing_helpers.c b/tools/testing/selftests/bpf/testing_helpers.c index 0f1c37ac6f2c..795b6798ccee 100644 --- a/tools/testing/selftests/bpf/testing_helpers.c +++ b/tools/testing/selftests/bpf/testing_helpers.c @@ -88,13 +88,15 @@ int extra_prog_load_log_flags = 0; int bpf_prog_test_load(const char *file, enum bpf_prog_type type, struct bpf_object **pobj, int *prog_fd) { - struct bpf_object_load_attr attr = {}; + LIBBPF_OPTS(bpf_object_open_opts, opts, + .kernel_log_level = extra_prog_load_log_flags, + ); struct bpf_object *obj; struct bpf_program *prog; __u32 flags; int err; - obj = bpf_object__open(file); + obj = bpf_object__open_file(file, &opts); if (!obj) return -errno; @@ -110,9 +112,7 @@ int bpf_prog_test_load(const char *file, enum bpf_prog_type type, 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; - err = bpf_object__load_xattr(&attr); + err = bpf_object__load(obj); if (err) goto err_out; |