Question: __u32 or u32 in BPF code

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

 



Hi,

Should BPF code be using UAPI types such as __u32 or is it considered
acceptable to use kernel types such as u32? I ask because the helper
definitions that come from libbpf use the UAPI __u32 style types, but
the bpf-helpers(7) man page refers to the kernel u32 style types.

As I understand it, u32 et al are kernel internal type definitions that
should not leak into userspace which I believe extends to BPF
code. In order to use a kernel internal type, the BPF programmer would
need to define it themselves, or use a BTF generated vmlinux.h? Please
correct me if I am wrong, or oversimplifying things.

I think it would be useful to include a statement about UAPI types and
usage in BPF code somewhere in the documentation. Once I have an answer
to the question above, I am happy to work on a contribution to the
documentation.

A follow-on question is how to make things consistent across the UAPI
header files and the bpf-helpers(7) documentation. 



[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