@@ -536,7 +536,7 @@ static bool btf_is_kernel_module(__u32 btf_id)
__u32 len;
int err;
- btf_fd = bpf_btf_get_fd_by_id(btf_id);
+ btf_fd = bpf_btf_get_fd_by_id_opts(btf_id, NULL);
if (btf_fd < 0) {
p_err("can't get BTF object by id (%u): %s", btf_id, strerror(errno));
return false;
@@ -779,10 +779,10 @@ build_btf_type_table(struct hashmap *tab, enum bpf_obj_type type,
switch (type) {
case BPF_OBJ_PROG:
- fd = bpf_prog_get_fd_by_id(id);
+ fd = bpf_prog_get_fd_by_id_opts(id, NULL);
break;
case BPF_OBJ_MAP:
- fd = bpf_map_get_fd_by_id(id);
+ fd = bpf_map_get_fd_by_id_opts(id, NULL);
break;
default:
err = -1;
@@ -1037,7 +1037,7 @@ static int do_show(int argc, char **argv)
break;
}
- fd = bpf_btf_get_fd_by_id(id);
+ fd = bpf_btf_get_fd_by_id_opts(id, NULL);
if (fd < 0) {
if (errno == ENOENT)
continue;
@@ -53,7 +53,7 @@ static int dump_prog_id_as_func_ptr(const struct btf_dumper *d,
goto print;
/* Get the bpf_prog's name. Obtain from func_info. */
- prog_fd = bpf_prog_get_fd_by_id(prog_id);
+ prog_fd = bpf_prog_get_fd_by_id_opts(prog_id, NULL);
if (prog_fd < 0)
goto print;
@@ -78,7 +78,7 @@ static void guess_vmlinux_btf_id(__u32 attach_btf_obj_id)
btf_info.name = ptr_to_u64(name);
btf_info.name_len = sizeof(name);
- fd = bpf_btf_get_fd_by_id(attach_btf_obj_id);
+ fd = bpf_btf_get_fd_by_id_opts(attach_btf_obj_id, NULL);
if (fd < 0)
return;
@@ -104,7 +104,7 @@ static int show_bpf_prog(int id, enum bpf_attach_type attach_type,
__u32 info_len = sizeof(info);
int prog_fd;
- prog_fd = bpf_prog_get_fd_by_id(id);
+ prog_fd = bpf_prog_get_fd_by_id_opts(id, NULL);
if (prog_fd < 0)
return -1;
@@ -99,7 +99,7 @@ static int get_prog_info(int prog_id, struct bpf_prog_info *info)
__u32 len = sizeof(*info);
int err, prog_fd;
- prog_fd = bpf_prog_get_fd_by_id(prog_id);
+ prog_fd = bpf_prog_get_fd_by_id_opts(prog_id, NULL);
if (prog_fd < 0)
return prog_fd;
@@ -343,7 +343,7 @@ static int do_show(int argc, char **argv)
break;
}
- fd = bpf_link_get_fd_by_id(id);
+ fd = bpf_link_get_fd_by_id_opts(id, NULL);
if (fd < 0) {
if (errno == ENOENT)
continue;
@@ -702,7 +702,7 @@ static int do_show(int argc, char **argv)
break;
}
- fd = bpf_map_get_fd_by_id(id);
+ fd = bpf_map_get_fd_by_id_opts(id, NULL);
if (fd < 0) {
if (errno == ENOENT)
continue;
@@ -251,7 +251,7 @@ static void *find_metadata(int prog_fd, struct bpf_map_info *map_info)
goto free_map_ids;
for (i = 0; i < prog_info.nr_map_ids; i++) {
- map_fd = bpf_map_get_fd_by_id(map_ids[i]);
+ map_fd = bpf_map_get_fd_by_id_opts(map_ids[i], NULL);
if (map_fd < 0)
goto free_map_ids;
@@ -666,7 +666,7 @@ static int do_show(int argc, char **argv)
break;
}
- fd = bpf_prog_get_fd_by_id(id);
+ fd = bpf_prog_get_fd_by_id_opts(id, NULL);
if (fd < 0) {
if (errno == ENOENT)
continue;
Complete the switch to the new functions bpf_*_get_fd_by_id_opts(), accepting the additional opts parameter. The value passed to these functions is always NULL, so that there is no variation in the behavior. Signed-off-by: Roberto Sassu <roberto.sassu@huawei.com> --- tools/bpf/bpftool/btf.c | 8 ++++---- tools/bpf/bpftool/btf_dumper.c | 2 +- tools/bpf/bpftool/cgroup.c | 4 ++-- tools/bpf/bpftool/link.c | 4 ++-- tools/bpf/bpftool/map.c | 2 +- tools/bpf/bpftool/prog.c | 4 ++-- 6 files changed, 12 insertions(+), 12 deletions(-)