diff options
| author | Andrii Nakryiko <[email protected]> | 2022-05-09 00:41:42 +0000 |
|---|---|---|
| committer | Daniel Borkmann <[email protected]> | 2022-05-09 15:15:28 +0000 |
| commit | 73d0280f6b79c936770698250549ba9f62682a45 (patch) | |
| tree | 0b3c7c9d504dd815a680296af39eec24cd801cd4 /tools/lib/bpf/bpf_helpers.h | |
| parent | libbpf: Make __kptr and __kptr_ref unconditionally use btf_type_tag() attr (diff) | |
| download | kernel-73d0280f6b79c936770698250549ba9f62682a45.tar.gz kernel-73d0280f6b79c936770698250549ba9f62682a45.zip | |
libbpf: Improve usability of field-based CO-RE helpers
Allow to specify field reference in two ways:
- if user has variable of necessary type, they can use variable-based
reference (my_var.my_field or my_var_ptr->my_field). This was the
only supported syntax up till now.
- now, bpf_core_field_exists() and bpf_core_field_size() support also
specifying field in a fashion similar to offsetof() macro, by
specifying type of the containing struct/union separately and field
name separately: bpf_core_field_exists(struct my_type, my_field).
This forms is quite often more convenient in practice and it matches
type-based CO-RE helpers that support specifying type by its name
without requiring any variables.
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Daniel Borkmann <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/lib/bpf/bpf_helpers.h')
0 files changed, 0 insertions, 0 deletions
