Skip to content

Add generic and raw BTF parsing APIs to libbpf

Andrii Nakryiko bpf netdev 1 version Applied

Status from this message: Applied, thanks!

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest3 patches 4 repliesApplied

Patches in v1 Applied

#Subject and filesSizeRepliesApplied
1/3libbpf: add btf__parse_raw() and generic btf__parse() APIstools/lib/bpf/btf.c tools/lib/bpf/btf.h tools/lib/bpf/libbpf.map+83 -380 replies
2/3tools/bpftool: use libbpf's btf__parse() API for parsing BTF from filetools/bpf/bpftool/btf.c+1 -530 replies
3/3tools/resolve_btfids: use libbpf's btf__parse() APItools/bpf/resolve_btfids/.gitignore tools/bpf/resolve_btfids/main.c+5 -570 replies

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v1 yet.

Read the v1 thread

Cover letter [PATCH bpf-next 0/3] Add generic and raw BTF parsing APIs to libbpf

It's pretty common for applications to want to parse raw (binary) BTF data from file, as opposed to parsing it from ELF sections. It's also pretty common for tools to not care whether given file is ELF or raw BTF format. This patch series exposes internal raw BTF parsing API and adds generic variant of BTF parsing, which will efficiently determine the format of a given fail and will parse BTF appropriately.

Patches #2 and #3 removes re-implementations of such APIs from bpftool and resolve_btfids tools.

Andrii Nakryiko (3):
libbpf: add btf__parse_raw() and generic btf__parse() APIs tools/bpftool: use libbpf's btf__parse() API for parsing BTF from file tools/resolve_btfids: use libbpf's btf__parse() API

 tools/bpf/bpftool/btf.c             |  54 +------------
 tools/bpf/resolve_btfids/.gitignore |   4 +
 tools/bpf/resolve_btfids/main.c     |  58 +-------------
 tools/lib/bpf/btf.c                 | 114 +++++++++++++++++++---------
 tools/lib/bpf/btf.h                 |   5 +-
 tools/lib/bpf/libbpf.map            |   2 +
 6 files changed, 89 insertions(+), 148 deletions(-)
 create mode 100644 tools/bpf/resolve_btfids/.gitignore
Signature · 1 line
2.24.1