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

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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(-)

-- 
2.34.1





[Index of Archives]     [Linux Samsung SoC]     [Linux Rockchip SoC]     [Linux Actions SoC]     [Linux for Synopsys ARC Processors]     [Linux NFS]     [Linux NILFS]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]


  Powered by Linux