netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andrii Nakryiko <andriin@fb.com>
To: <alexei.starovoitov@gmail.com>, <andrii.nakryiko@gmail.com>,
	<songliubraving@fb.com>, <yhs@fb.com>, <ast@fb.com>,
	<kafai@fb.com>, <netdev@vger.kernel.org>, <kernel-team@fb.com>,
	<daniel@iogearbox.net>, <acme@kernel.org>
Cc: Andrii Nakryiko <andriin@fb.com>
Subject: [PATCH v4 bpf-next 0/4] tools/btf: extend libbpf APIs to work with btf w/o kernel
Date: Fri, 8 Feb 2019 11:19:35 -0800	[thread overview]
Message-ID: <20190208191939.3105592-1-andriin@fb.com> (raw)

This patchset introduces a set of new APIs that make it possible to work with BTF
more effectively (and without involving kernel) for applications like pahole that
need to manipulate .BTF and .BTF.ext data.

Patch #1 changes existing btf__new() API call to only load and initialize
struct btf, while exposing new btf__load() API to attempt to load and validate
BTF in kernel.

Patch #2 adds btf__get_raw_data() API allowing to get access to raw BTF data from
struct btf.

Patch #3 adds similar btf_ext__get_raw_data() API for working with struct btf_ext.

Patch #4 removes not-yet-stable btf__get_strings() API which was added to be able
to test contents of struct btf for btf__dedup(). It's now superseded by raw APIs.

v3->v4:
- formatting fixes
- renamed btf_ext functions/structs to use "setup" language instead of "copy"
- removed btf__get_strings from libbpf.map

v2->v3:
- const void* variants of btf__get_raw_data()
- added btf_ext__get_raw_data()
- removed btf__get_strings() and adapted test_btf.c to use btf__get_raw_data()

v1->v2:
- btf_load() returns just error, not fd
- fix ordering in libbpf.map

Andrii Nakryiko (4):
  btf: separate btf creation and loading
  btf: expose API to work with raw btf data
  btf: expose API to work with raw btf_ext data
  tools/bpf: remove btf__get_strings() superseded by raw data API

 tools/lib/bpf/btf.c                    | 163 +++++++++++++------------
 tools/lib/bpf/btf.h                    |   6 +-
 tools/lib/bpf/libbpf.c                 |   2 +-
 tools/lib/bpf/libbpf.map               |   4 +-
 tools/testing/selftests/bpf/test_btf.c |  39 ++++--
 5 files changed, 121 insertions(+), 93 deletions(-)

-- 
2.17.1


             reply	other threads:[~2019-02-08 19:19 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-08 19:19 Andrii Nakryiko [this message]
2019-02-08 19:19 ` [PATCH v4 bpf-next 1/4] btf: separate btf creation and loading Andrii Nakryiko
2019-02-08 19:19 ` [PATCH v4 bpf-next 2/4] btf: expose API to work with raw btf data Andrii Nakryiko
2019-02-08 19:19 ` [PATCH v4 bpf-next 3/4] btf: expose API to work with raw btf_ext data Andrii Nakryiko
2019-02-08 19:50   ` Yonghong Song
2019-02-08 19:19 ` [PATCH v4 bpf-next 4/4] tools/bpf: remove btf__get_strings() superseded by raw data API Andrii Nakryiko
2019-02-08 20:08 ` [PATCH v4 bpf-next 0/4] tools/btf: extend libbpf APIs to work with btf w/o kernel Alexei Starovoitov

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=20190208191939.3105592-1-andriin@fb.com \
    --to=andriin@fb.com \
    --cc=acme@kernel.org \
    --cc=alexei.starovoitov@gmail.com \
    --cc=andrii.nakryiko@gmail.com \
    --cc=ast@fb.com \
    --cc=daniel@iogearbox.net \
    --cc=kafai@fb.com \
    --cc=kernel-team@fb.com \
    --cc=netdev@vger.kernel.org \
    --cc=songliubraving@fb.com \
    --cc=yhs@fb.com \
    /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).