diff options
| author | Andrii Nakryiko <[email protected]> | 2024-01-30 21:20:22 +0000 |
|---|---|---|
| committer | Martin KaFai Lau <[email protected]> | 2024-01-30 23:55:50 +0000 |
| commit | 20d59ee55172fdf6072abf871fa62b2070d6383f (patch) | |
| tree | 943d0e21220a3f83781da27546c470cbd56f71cf /tools/testing/selftests/bpf/progs/sendmsg_unix_prog.c | |
| parent | Merge branch 'trusted-ptr_to_btf_id-arg-support-in-global-subprogs' (diff) | |
| download | kernel-20d59ee55172fdf6072abf871fa62b2070d6383f.tar.gz kernel-20d59ee55172fdf6072abf871fa62b2070d6383f.zip | |
libbpf: add bpf_core_cast() macro
Add bpf_core_cast() macro that wraps bpf_rdonly_cast() kfunc. It's more
ergonomic than kfunc, as it automatically extracts btf_id with
bpf_core_type_id_kernel(), and works with type names. It also casts result
to (T *) pointer. See the definition of the macro, it's self-explanatory.
libbpf declares bpf_rdonly_cast() extern as __weak __ksym and should be
safe to not conflict with other possible declarations in user code.
But we do have a conflict with current BPF selftests that declare their
externs with first argument as `void *obj`, while libbpf opts into more
permissive `const void *obj`. This causes conflict, so we fix up BPF
selftests uses in the same patch.
Acked-by: Eduard Zingerman <[email protected]>
Signed-off-by: Andrii Nakryiko <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Martin KaFai Lau <[email protected]>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/sendmsg_unix_prog.c')
0 files changed, 0 insertions, 0 deletions
