diff options
author | Andrii Nakryiko <andriin@fb.com> | 2019-11-01 15:28:07 -0700 |
---|---|---|
committer | Daniel Borkmann <daniel@iogearbox.net> | 2019-11-04 16:06:56 +0100 |
commit | ee26dade0e3bcd8a34ae7520e373fb69365fce7a (patch) | |
tree | f6dc7431bd618323bae052600920051748703fd8 /tools/lib/bpf/libbpf_internal.h | |
parent | 42765ede5c54ca915de5bfeab83be97207e46f68 (diff) | |
download | linux-ee26dade0e3bcd8a34ae7520e373fb69365fce7a.tar.gz linux-ee26dade0e3bcd8a34ae7520e373fb69365fce7a.tar.bz2 linux-ee26dade0e3bcd8a34ae7520e373fb69365fce7a.zip |
libbpf: Add support for relocatable bitfields
Add support for the new field relocation kinds, necessary to support
relocatable bitfield reads. Provide macro for abstracting necessary code doing
full relocatable bitfield extraction into u64 value. Two separate macros are
provided:
- BPF_CORE_READ_BITFIELD macro for direct memory read-enabled BPF programs
(e.g., typed raw tracepoints). It uses direct memory dereference to extract
bitfield backing integer value.
- BPF_CORE_READ_BITFIELD_PROBED macro for cases where bpf_probe_read() needs
to be used to extract same backing integer value.
Signed-off-by: Andrii Nakryiko <andriin@fb.com>
Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/bpf/20191101222810.1246166-3-andriin@fb.com
Diffstat (limited to 'tools/lib/bpf/libbpf_internal.h')
-rw-r--r-- | tools/lib/bpf/libbpf_internal.h | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf_internal.h b/tools/lib/bpf/libbpf_internal.h index bd6f48ea407b..97ac17a64a58 100644 --- a/tools/lib/bpf/libbpf_internal.h +++ b/tools/lib/bpf/libbpf_internal.h @@ -158,7 +158,11 @@ struct bpf_line_info_min { */ enum bpf_field_info_kind { BPF_FIELD_BYTE_OFFSET = 0, /* field byte offset */ + BPF_FIELD_BYTE_SIZE = 1, BPF_FIELD_EXISTS = 2, /* field existence in target kernel */ + BPF_FIELD_SIGNED = 3, + BPF_FIELD_LSHIFT_U64 = 4, + BPF_FIELD_RSHIFT_U64 = 5, }; /* The minimum bpf_field_reloc checked by the loader |