diff options
author | Andrey Ignatov <rdna@fb.com> | 2018-09-27 01:24:53 +0300 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2018-09-27 22:14:59 +0300 |
commit | 956b620fcf0b64de403cd26a56bc41e6e4826ea6 (patch) | |
tree | 49a7679ff3ad2a83ed6a07fb3ca4498da0789452 /tools/lib/traceevent | |
parent | 100811936f89fd455eda1984810c09003550555b (diff) | |
download | linux-956b620fcf0b64de403cd26a56bc41e6e4826ea6.tar.xz |
libbpf: Introduce libbpf_attach_type_by_name
There is a common use-case when ELF object contains multiple BPF
programs and every program has its own section name. If it's cgroup-bpf
then programs have to be 1) loaded and 2) attached to a cgroup.
It's convenient to have information necessary to load BPF program
together with program itself. This is where section name works fine in
conjunction with libbpf_prog_type_by_name that identifies prog_type and
expected_attach_type and these can be used with BPF_PROG_LOAD.
But there is currently no way to identify attach_type by section name
and it leads to messy code in user space that reinvents guessing logic
every time it has to identify attach type to use with BPF_PROG_ATTACH.
The patch introduces libbpf_attach_type_by_name that guesses attach type
by section name if a program can be attached.
The difference between expected_attach_type provided by
libbpf_prog_type_by_name and attach_type provided by
libbpf_attach_type_by_name is the former is used at BPF_PROG_LOAD time
and can be zero if a program of prog_type X has only one corresponding
attach type Y whether the latter provides specific attach type to use
with BPF_PROG_ATTACH.
No new section names were added to section_names array. Only existing
ones were reorganized and attach_type was added where appropriate.
Signed-off-by: Andrey Ignatov <rdna@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Diffstat (limited to 'tools/lib/traceevent')
0 files changed, 0 insertions, 0 deletions