Commit 3fc5fdcc authored by Andrii Nakryiko's avatar Andrii Nakryiko

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: default avatarAndrii Nakryiko <andrii@kernel.org>
Signed-off-by: default avatarAlexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211209193840.1248570-12-andrii@kernel.org
parent 57e88926
...@@ -88,13 +88,15 @@ int extra_prog_load_log_flags = 0; ...@@ -88,13 +88,15 @@ int extra_prog_load_log_flags = 0;
int bpf_prog_test_load(const char *file, enum bpf_prog_type type, int bpf_prog_test_load(const char *file, enum bpf_prog_type type,
struct bpf_object **pobj, int *prog_fd) 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_object *obj;
struct bpf_program *prog; struct bpf_program *prog;
__u32 flags; __u32 flags;
int err; int err;
obj = bpf_object__open(file); obj = bpf_object__open_file(file, &opts);
if (!obj) if (!obj)
return -errno; return -errno;
...@@ -110,9 +112,7 @@ int bpf_prog_test_load(const char *file, enum bpf_prog_type type, ...@@ -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; flags = bpf_program__flags(prog) | BPF_F_TEST_RND_HI32;
bpf_program__set_flags(prog, flags); bpf_program__set_flags(prog, flags);
attr.obj = obj; err = bpf_object__load(obj);
attr.log_level = extra_prog_load_log_flags;
err = bpf_object__load_xattr(&attr);
if (err) if (err)
goto err_out; goto err_out;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment