diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-10-04 15:40:35 -0700 |
---|---|---|
committer | Alexei Starovoitov <ast@kernel.org> | 2019-10-05 18:09:47 -0700 |
commit | 2ce8450ef5a381e5ffeb4682c0093a3ab5d07008 (patch) | |
tree | be97146a8e0eac4a465259ed2b11393685c09622 /tools/lib/bpf/libbpf.map | |
parent | 5e61f27070292d4ad3af51dc68eebab6c1df69d3 (diff) | |
download | linux-stable-2ce8450ef5a381e5ffeb4682c0093a3ab5d07008.tar.gz linux-stable-2ce8450ef5a381e5ffeb4682c0093a3ab5d07008.tar.bz2 linux-stable-2ce8450ef5a381e5ffeb4682c0093a3ab5d07008.zip |
libbpf: add bpf_object__open_{file, mem} w/ extensible opts
Add new set of bpf_object__open APIs using new approach to optional
parameters extensibility allowing simpler ABI compatibility approach.
This patch demonstrates an approach to implementing libbpf APIs that
makes it easy to extend existing APIs with extra optional parameters in
such a way, that ABI compatibility is preserved without having to do
symbol versioning and generating lots of boilerplate code to handle it.
To facilitate succinct code for working with options, add OPTS_VALID,
OPTS_HAS, and OPTS_GET macros that hide all the NULL, size, and zero
checks.
Additionally, newly added libbpf APIs are encouraged to follow similar
pattern of having all mandatory parameters as formal function parameters
and always have optional (NULL-able) xxx_opts struct, which should
always have real struct size as a first field and the rest would be
optional parameters added over time, which tune the behavior of existing
API, if specified by user.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Diffstat (limited to 'tools/lib/bpf/libbpf.map')
-rw-r--r-- | tools/lib/bpf/libbpf.map | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf.map b/tools/lib/bpf/libbpf.map index 8d10ca03d78d..4d241fd92dd4 100644 --- a/tools/lib/bpf/libbpf.map +++ b/tools/lib/bpf/libbpf.map @@ -192,4 +192,7 @@ LIBBPF_0.0.5 { } LIBBPF_0.0.4; LIBBPF_0.0.6 { + global: + bpf_object__open_file; + bpf_object__open_mem; } LIBBPF_0.0.5; |