Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

libbpf: Stop using to-be-deprecated APIs

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

authored by

Andrii Nakryiko and committed by
Alexei Starovoitov
bcc40fc0 e32660ac

+9 -4
+9 -4
tools/lib/bpf/libbpf.c
··· 7709 7709 return 0; 7710 7710 7711 7711 err_unpin_maps: 7712 - while ((map = bpf_map__prev(map, obj))) { 7712 + while ((map = bpf_object__prev_map(obj, map))) { 7713 7713 if (!map->pin_path) 7714 7714 continue; 7715 7715 ··· 7789 7789 return 0; 7790 7790 7791 7791 err_unpin_programs: 7792 - while ((prog = bpf_program__prev(prog, obj))) { 7792 + while ((prog = bpf_object__prev_program(obj, prog))) { 7793 7793 char buf[PATH_MAX]; 7794 7794 int len; 7795 7795 ··· 8130 8130 return 0; 8131 8131 } 8132 8132 8133 + static int bpf_program_nth_fd(const struct bpf_program *prog, int n); 8134 + 8133 8135 int bpf_program__fd(const struct bpf_program *prog) 8134 8136 { 8135 - return bpf_program__nth_fd(prog, 0); 8137 + return bpf_program_nth_fd(prog, 0); 8136 8138 } 8137 8139 8138 8140 size_t bpf_program__size(const struct bpf_program *prog) ··· 8180 8178 return 0; 8181 8179 } 8182 8180 8183 - int bpf_program__nth_fd(const struct bpf_program *prog, int n) 8181 + __attribute__((alias("bpf_program_nth_fd"))) 8182 + int bpf_program__nth_fd(const struct bpf_program *prog, int n); 8183 + 8184 + static int bpf_program_nth_fd(const struct bpf_program *prog, int n) 8184 8185 { 8185 8186 int fd; 8186 8187