aboutsummaryrefslogtreecommitdiff
path: root/tools/testing/selftests/bpf/progs/getpeername_unix_prog.c
diff options
context:
space:
mode:
authorAndrii Nakryiko <andrii@kernel.org>2024-01-30 13:20:22 -0800
committerMartin KaFai Lau <martin.lau@kernel.org>2024-01-30 15:55:50 -0800
commit20d59ee55172fdf6072abf871fa62b2070d6383f (patch)
tree943d0e21220a3f83781da27546c470cbd56f71cf /tools/testing/selftests/bpf/progs/getpeername_unix_prog.c
parent4d8ebe1304e99cf6e08e432c23041638d6d1de56 (diff)
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 <eddyz87@gmail.com> Signed-off-by: Andrii Nakryiko <andrii@kernel.org> Link: https://lore.kernel.org/r/20240130212023.183765-2-andrii@kernel.org Signed-off-by: Martin KaFai Lau <martin.lau@kernel.org>
Diffstat (limited to 'tools/testing/selftests/bpf/progs/getpeername_unix_prog.c')
0 files changed, 0 insertions, 0 deletions