diff options
author | Andrii Nakryiko <andrii@kernel.org> | 2021-12-09 22:38:40 +0300 |
---|---|---|
committer | Andrii Nakryiko <andrii@kernel.org> | 2021-12-11 02:29:18 +0300 |
commit | b59e4ce8bcaab6445f4a0d37a96ca8953caaf5cf (patch) | |
tree | 0e92aea9d74a32c822d7232e3293fb51a1cc4e87 /tools/bpf/bpftool/gen.c | |
parent | 3fc5fdcca144badbaf29b62aacbf7877f2f39a74 (diff) | |
download | linux-b59e4ce8bcaab6445f4a0d37a96ca8953caaf5cf.tar.xz |
bpftool: Switch bpf_object__load_xattr() to bpf_object__load()
Switch all the uses of to-be-deprecated bpf_object__load_xattr() into
a simple bpf_object__load() calls with optional log_level passed through
open_opts.kernel_log_level, if -d option is specified.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211209193840.1248570-13-andrii@kernel.org
Diffstat (limited to 'tools/bpf/bpftool/gen.c')
-rw-r--r-- | tools/bpf/bpftool/gen.c | 11 |
1 files changed, 4 insertions, 7 deletions
diff --git a/tools/bpf/bpftool/gen.c b/tools/bpf/bpftool/gen.c index 997a2865e04a..b4695df2ea3d 100644 --- a/tools/bpf/bpftool/gen.c +++ b/tools/bpf/bpftool/gen.c @@ -486,7 +486,6 @@ static void codegen_destroy(struct bpf_object *obj, const char *obj_name) static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *header_guard) { - struct bpf_object_load_attr load_attr = {}; DECLARE_LIBBPF_OPTS(gen_loader_opts, opts); struct bpf_map *map; char ident[256]; @@ -496,12 +495,7 @@ static int gen_trace(struct bpf_object *obj, const char *obj_name, const char *h if (err) return err; - load_attr.obj = obj; - if (verifier_logs) - /* log_level1 + log_level2 + stats, but not stable UAPI */ - load_attr.log_level = 1 + 2 + 4; - - err = bpf_object__load_xattr(&load_attr); + err = bpf_object__load(obj); if (err) { p_err("failed to load object file"); goto out; @@ -719,6 +713,9 @@ static int do_skeleton(int argc, char **argv) if (obj_name[0] == '\0') get_obj_name(obj_name, file); opts.object_name = obj_name; + if (verifier_logs) + /* log_level1 + log_level2 + stats, but not stable UAPI */ + opts.kernel_log_level = 1 + 2 + 4; obj = bpf_object__open_mem(obj_data, file_sz, &opts); err = libbpf_get_error(obj); if (err) { |