From: Andrii Nakryiko <andrii@kernel.org>
Date: Wed, 3 Nov 2021 15:08:38 -0700
Subject: libbpf: Stop using to-be-deprecated APIs
Patch-mainline: v5.17-rc1
Git-commit: bcc40fc0021d4b7c016f8bcf62bd4e21251fdee8
References: jsc#PED-1377
Remove all the internal uses of libbpf APIs that are slated to be
deprecated in v0.7.
Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211103220845.2676888-6-andrii@kernel.org
Acked-by: Shung-Hsi Yu <shung-hsi.yu@suse.com>
---
tools/lib/bpf/libbpf.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
--- a/tools/lib/bpf/libbpf.c
+++ b/tools/lib/bpf/libbpf.c
@@ -7707,7 +7707,7 @@ int bpf_object__pin_maps(struct bpf_obje
return 0;
err_unpin_maps:
- while ((map = bpf_map__prev(map, obj))) {
+ while ((map = bpf_object__prev_map(obj, map))) {
if (!map->pin_path)
continue;
@@ -7787,7 +7787,7 @@ int bpf_object__pin_programs(struct bpf_
return 0;
err_unpin_programs:
- while ((prog = bpf_program__prev(prog, obj))) {
+ while ((prog = bpf_object__prev_program(obj, prog))) {
char buf[PATH_MAX];
int len;
@@ -8128,9 +8128,11 @@ int bpf_program__set_autoload(struct bpf
return 0;
}
+static int bpf_program_nth_fd(const struct bpf_program *prog, int n);
+
int bpf_program__fd(const struct bpf_program *prog)
{
- return bpf_program__nth_fd(prog, 0);
+ return bpf_program_nth_fd(prog, 0);
}
size_t bpf_program__size(const struct bpf_program *prog)
@@ -8176,7 +8178,10 @@ int bpf_program__set_prep(struct bpf_pro
return 0;
}
-int bpf_program__nth_fd(const struct bpf_program *prog, int n)
+__attribute__((alias("bpf_program_nth_fd")))
+int bpf_program__nth_fd(const struct bpf_program *prog, int n);
+
+static int bpf_program_nth_fd(const struct bpf_program *prog, int n)
{
int fd;