Skip to content

bpf.vmlinux: document a __le member's byte order - #56

Open
lneto wants to merge 1 commit into
masterfrom
vmlinux-le-doc
Open

lneto wants to merge 1 commit into
masterfrom
vmlinux-le-doc

Conversation

@lneto

@lneto lneto commented Nov 26, 2026

Copy link
Copy Markdown
Contributor

On a big-endian kernel, a kernel struct's member typed __le16, __le32 or __le64 reads byte-swapped, and the documentation of bpf.vmlinux.layout does not say so.

The layout marks bigendian only the members typed __be16, __be32 or __be64, so a __le member carries no mark and reads in the kernel's byte order, which is its own only on a little-endian kernel. The documentation of bpf.vmlinux.layout now says so in a paragraph of its own. Nothing a script calls changes.

luaebpf#8 asks for a littleendian mark that reads such a member right on either kernel, and waits in the backlog until a program on a big-endian kernel needs it. This one answers luaebpf#8, which it does not close.

The layout marks only the big-endian typedefs, so a member typed __le16,
__le32 or __le64 reads byte-swapped on a big-endian kernel. luaebpf#8
asks for the mark that reads it right, and waits in the backlog until a
program on such a kernel needs it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@lneto lneto added the complexity: small One line or one file, with a trivial or existing test label Nov 26, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

complexity: small One line or one file, with a trivial or existing test

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant