OSDN Git Service

libbpf: Deprecate multi-instance bpf_program APIs
authorAndrii Nakryiko <andrii@kernel.org>
Mon, 25 Oct 2021 22:45:30 +0000 (15:45 -0700)
committerAlexei Starovoitov <ast@kernel.org>
Tue, 26 Oct 2021 01:37:21 +0000 (18:37 -0700)
commite21d585cb3db65a207cd338c74b9886090ef1ceb
tree10e678ce6136b3ee40a53d44c6972b977f4e2dea
parent65a7fa2e4e5381d205d3b0098da0fc8471fbbfb6
libbpf: Deprecate multi-instance bpf_program APIs

Schedule deprecation of a set of APIs that are related to multi-instance
bpf_programs:
  - bpf_program__set_prep() ([0]);
  - bpf_program__{set,unset}_instance() ([1]);
  - bpf_program__nth_fd().

These APIs are obscure, very niche, and don't seem to be used much in
practice. bpf_program__set_prep() is pretty useless for anything but the
simplest BPF programs, as it doesn't allow to adjust BPF program load
attributes, among other things. In short, it already bitrotted and will
bitrot some more if not removed.

With bpf_program__insns() API, which gives access to post-processed BPF
program instructions of any given entry-point BPF program, it's now
possible to do whatever necessary adjustments were possible with
set_prep() API before, but also more. Given any such use case is
automatically an advanced use case, requiring users to stick to
low-level bpf_prog_load() APIs and managing their own prog FDs is
reasonable.

  [0] Closes: https://github.com/libbpf/libbpf/issues/299
  [1] Closes: https://github.com/libbpf/libbpf/issues/300

Signed-off-by: Andrii Nakryiko <andrii@kernel.org>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Link: https://lore.kernel.org/bpf/20211025224531.1088894-4-andrii@kernel.org
tools/lib/bpf/libbpf.c
tools/lib/bpf/libbpf.h