mbox series

[bpf-next,0/2] libbpf: add bpf_core_cast() helper

Message ID 20240130212023.183765-1-andrii@kernel.org (mailing list archive)
Headers show
Series libbpf: add bpf_core_cast() helper | expand

Message

Andrii Nakryiko Jan. 30, 2024, 9:20 p.m. UTC
Add bpf_core_cast(<ptr>, <type>) macro wrapper around bpf_rdonly_cast() kfunc
to make it easier to use this functionality in BPF code. See patch #2 for
BPF selftests conversions demonstrating improvements in code succinctness.

Andrii Nakryiko (2):
  libbpf: add bpf_core_cast() macro
  selftests/bpf: convert bpf_rdonly_cast() uses to bpf_core_cast() macro

 tools/lib/bpf/bpf_core_read.h                       | 13 +++++++++++++
 tools/testing/selftests/bpf/bpf_kfuncs.h            |  2 +-
 .../testing/selftests/bpf/progs/connect_unix_prog.c |  3 +--
 .../selftests/bpf/progs/getpeername_unix_prog.c     |  3 +--
 .../selftests/bpf/progs/getsockname_unix_prog.c     |  3 +--
 .../testing/selftests/bpf/progs/recvmsg_unix_prog.c |  3 +--
 .../testing/selftests/bpf/progs/sendmsg_unix_prog.c |  3 +--
 .../selftests/bpf/progs/sk_storage_omem_uncharge.c  |  4 +---
 tools/testing/selftests/bpf/progs/sock_iter_batch.c |  4 ++--
 tools/testing/selftests/bpf/progs/type_cast.c       | 13 +++++--------
 10 files changed, 27 insertions(+), 24 deletions(-)

Comments

patchwork-bot+netdevbpf@kernel.org Jan. 31, 2024, 1:10 a.m. UTC | #1
Hello:

This series was applied to bpf/bpf-next.git (master)
by Martin KaFai Lau <martin.lau@kernel.org>:

On Tue, 30 Jan 2024 13:20:21 -0800 you wrote:
> Add bpf_core_cast(<ptr>, <type>) macro wrapper around bpf_rdonly_cast() kfunc
> to make it easier to use this functionality in BPF code. See patch #2 for
> BPF selftests conversions demonstrating improvements in code succinctness.
> 
> Andrii Nakryiko (2):
>   libbpf: add bpf_core_cast() macro
>   selftests/bpf: convert bpf_rdonly_cast() uses to bpf_core_cast() macro
> 
> [...]

Here is the summary with links:
  - [bpf-next,1/2] libbpf: add bpf_core_cast() macro
    https://git.kernel.org/bpf/bpf-next/c/20d59ee55172
  - [bpf-next,2/2] selftests/bpf: convert bpf_rdonly_cast() uses to bpf_core_cast() macro
    https://git.kernel.org/bpf/bpf-next/c/ea9d561686fb

You are awesome, thank you!