@@ -580,7 +580,7 @@ static int do_dump(int argc, char **argv)
}
if (!btf) {
- err = btf__get_from_id(btf_id, &btf);
+ err = btf__load_from_kernel_by_id(btf_id, &btf);
if (err) {
p_err("get btf by id (%u): %s", btf_id, strerror(err));
goto done;
@@ -65,7 +65,7 @@ static int dump_prog_id_as_func_ptr(const struct btf_dumper *d,
info = &prog_info->info;
if (!info->btf_id || !info->nr_func_info ||
- btf__get_from_id(info->btf_id, &prog_btf))
+ btf__load_from_kernel_by_id(info->btf_id, &prog_btf))
goto print;
finfo = u64_to_ptr(info->func_info);
func_type = btf__type_by_id(prog_btf, finfo->type_id);
@@ -807,7 +807,7 @@ static struct btf *get_map_kv_btf(const struct bpf_map_info *info)
} else if (info->btf_value_type_id) {
int err;
- err = btf__get_from_id(info->btf_id, &btf);
+ err = btf__load_from_kernel_by_id(info->btf_id, &btf);
if (err || !btf) {
p_err("failed to get btf");
btf = err ? ERR_PTR(err) : ERR_PTR(-ESRCH);
@@ -1042,7 +1042,7 @@ static void print_key_value(struct bpf_map_info *info, void *key,
struct btf *btf = NULL;
int err;
- err = btf__get_from_id(info->btf_id, &btf);
+ err = btf__load_from_kernel_by_id(info->btf_id, &btf);
if (err) {
p_err("failed to get btf");
return;
@@ -263,7 +263,7 @@ static void show_prog_metadata(int fd, __u32 num_maps)
if (!value)
return;
- err = btf__get_from_id(map_info.btf_id, &btf);
+ err = btf__load_from_kernel_by_id(map_info.btf_id, &btf);
if (err || !btf)
goto out_free;
@@ -646,7 +646,7 @@ prog_dump(struct bpf_prog_info *info, enum dump_mode mode,
member_len = info->xlated_prog_len;
}
- if (info->btf_id && btf__get_from_id(info->btf_id, &btf)) {
+ if (info->btf_id && btf__load_from_kernel_by_id(info->btf_id, &btf)) {
p_err("failed to get btf");
return -1;
}
@@ -2013,7 +2013,7 @@ static char *profile_target_name(int tgt_fd)
}
if (info_linear->info.btf_id == 0 ||
- btf__get_from_id(info_linear->info.btf_id, &btf)) {
+ btf__load_from_kernel_by_id(info_linear->info.btf_id, &btf)) {
p_err("prog FD %d doesn't have valid btf", tgt_fd);
goto out;
}
@@ -223,7 +223,7 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session,
free(info_linear);
return -1;
}
- if (btf__get_from_id(info->btf_id, &btf)) {
+ if (btf__load_from_kernel_by_id(info->btf_id, &btf)) {
pr_debug("%s: failed to get BTF of id %u, aborting\n", __func__, info->btf_id);
err = -1;
btf = NULL;
@@ -478,7 +478,7 @@ static void perf_env__add_bpf_info(struct perf_env *env, u32 id)
if (btf_id == 0)
goto out;
- if (btf__get_from_id(btf_id, &btf)) {
+ if (btf__load_from_kernel_by_id(btf_id, &btf)) {
pr_debug("%s: failed to get BTF of id %u, aborting\n",
__func__, btf_id);
goto out;
@@ -85,7 +85,7 @@ static char *bpf_target_prog_name(int tgt_fd)
}
if (info_linear->info.btf_id == 0 ||
- btf__get_from_id(info_linear->info.btf_id, &btf)) {
+ btf__load_from_kernel_by_id(info_linear->info.btf_id, &btf)) {
pr_debug("prog FD %d doesn't have valid btf\n", tgt_fd);
goto out;
}
@@ -4350,7 +4350,7 @@ static void do_test_file(unsigned int test_num)
goto done;
}
- err = btf__get_from_id(info.btf_id, &btf);
+ err = btf__load_from_kernel_by_id(info.btf_id, &btf);
if (CHECK(err, "cannot get btf from kernel, err: %d", err))
goto done;
Replace the calls to deprecated function btf__get_from_id() with calls to btf__load_from_kernel_by_id() in tools/ (bpftool, perf, selftests). Signed-off-by: Quentin Monnet <quentin@isovalent.com> --- tools/bpf/bpftool/btf.c | 2 +- tools/bpf/bpftool/btf_dumper.c | 2 +- tools/bpf/bpftool/map.c | 4 ++-- tools/bpf/bpftool/prog.c | 6 +++--- tools/perf/util/bpf-event.c | 4 ++-- tools/perf/util/bpf_counter.c | 2 +- tools/testing/selftests/bpf/prog_tests/btf.c | 2 +- 7 files changed, 11 insertions(+), 11 deletions(-)