All of lore.kernel.org
 help / color / mirror / Atom feed
From: Donald Hunter <donald.hunter@gmail.com>
To: bpf@vger.kernel.org
Subject: Question: __u32 or u32 in BPF code
Date: Thu, 03 Nov 2022 12:12:31 +0000	[thread overview]
Message-ID: <m24jvgtexc.fsf@gmail.com> (raw)

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. 

             reply	other threads:[~2022-11-03 12:12 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-03 12:12 Donald Hunter [this message]
2022-11-04 22:06 ` Question: __u32 or u32 in BPF code Andrii Nakryiko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m24jvgtexc.fsf@gmail.com \
    --to=donald.hunter@gmail.com \
    --cc=bpf@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.