From: Andrii Nakryiko <andrii.nakryiko@gmail.com>
To: Andrii Nakryiko <andriin@fb.com>
Cc: bpf <bpf@vger.kernel.org>, Networking <netdev@vger.kernel.org>,
Alexei Starovoitov <ast@fb.com>,
Daniel Borkmann <daniel@iogearbox.net>,
Kernel Team <kernel-team@fb.com>
Subject: Re: [PATCH bpf-next 0/3] Add new-style bpf_object__open APIs
Date: Thu, 3 Oct 2019 22:33:34 -0700 [thread overview]
Message-ID: <CAEf4BzZFGv_2gvckoVMO1i5h7BBx74ZqC4qDKyQkyELj5_Kvbw@mail.gmail.com> (raw)
In-Reply-To: <20191004052922.2701794-1-andriin@fb.com>
On Thu, Oct 3, 2019 at 10:29 PM Andrii Nakryiko <andriin@fb.com> wrote:
>
> Add bpf_object__open_file() and bpf_object__open_mem() APIs that use a new
> approach to providing future-proof non-ABI-breaking API changes. It relies on
> APIs accepting optional self-describing "opts" struct, containing its own
> size, filled out and provided by potentially outdated (as well as
> newer-than-libbpf) user application. A set of internal helper macros
> (OPTS_VALID, OPTS_HAS, and OPTS_GET) streamline and simplify a graceful
> handling forward and backward compatibility for user applications dynamically
> linked against different versions of libbpf shared library.
>
> Users of libbpf are provided with convenience macro LIBBPF_OPTS that takes
> care of populating correct structure size and zero-initializes options struct,
> which helps avoid obscure issues of unitialized padding. Uninitialized padding
> in a struct might turn into garbage-populated new fields understood by future
> versions of libbpf.
>
> Patch #3 switches two of test_progs' tests to use new APIs as a validation
> that they work as expected.
>
> v1->v2:
> - use better approach for tracking last field in opts struct;
> - convert few tests to new APIs for validation;
> - fix bug with using offsetof(last_field) instead of offsetofend(last_field).
>
> Andrii Nakryiko (3):
> libbpf: stop enforcing kern_version, populate it for users
> libbpf: add bpf_object__open_{file,mem} w/ extensible opts
> selftests/bpf: switch tests to new bpf_object__open_{file,mem}() APIs
>
> tools/lib/bpf/libbpf.c | 128 +++++++++---------
> tools/lib/bpf/libbpf.h | 38 +++++-
> tools/lib/bpf/libbpf.map | 3 +
> tools/lib/bpf/libbpf_internal.h | 32 +++++
> tools/testing/selftests/bpf/Makefile | 2 +-
> .../selftests/bpf/prog_tests/attach_probe.c | 42 +++++-
> .../bpf/prog_tests/reference_tracking.c | 7 +-
> .../selftests/bpf/progs/test_attach_probe.c | 1 -
> .../bpf/progs/test_get_stack_rawtp.c | 1 -
> .../selftests/bpf/progs/test_perf_buffer.c | 1 -
> .../selftests/bpf/progs/test_stacktrace_map.c | 1 -
> 11 files changed, 176 insertions(+), 80 deletions(-)
>
> --
> 2.17.1
>
Sorry for the spam! Forgot to bump to v2 in subject prefix, re-sending
v2 with correct prefix.
prev parent reply other threads:[~2019-10-04 5:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-04 5:29 [PATCH bpf-next 0/3] Add new-style bpf_object__open APIs Andrii Nakryiko
2019-10-04 5:29 ` [PATCH bpf-next 1/3] libbpf: stop enforcing kern_version, populate it for users Andrii Nakryiko
2019-10-04 5:29 ` [PATCH bpf-next 2/3] libbpf: add bpf_object__open_{file,mem} w/ extensible opts Andrii Nakryiko
2019-10-04 5:29 ` [PATCH bpf-next 3/3] selftests/bpf: switch tests to new bpf_object__open_{file,mem}() APIs Andrii Nakryiko
2019-10-04 5:33 ` Andrii Nakryiko [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAEf4BzZFGv_2gvckoVMO1i5h7BBx74ZqC4qDKyQkyELj5_Kvbw@mail.gmail.com \
--to=andrii.nakryiko@gmail.com \
--cc=andriin@fb.com \
--cc=ast@fb.com \
--cc=bpf@vger.kernel.org \
--cc=daniel@iogearbox.net \
--cc=kernel-team@fb.com \
--cc=netdev@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).