]> git.ipfire.org Git - thirdparty/kernel/linux.git/commit
tools: ynl: add scope qualifier for definitions
authorJakub Kicinski <kuba@kernel.org>
Sun, 10 May 2026 19:29:01 +0000 (12:29 -0700)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 12 May 2026 14:15:00 +0000 (16:15 +0200)
commitfbf5df34a4dbcd09d433dd4f0916bf9b2ddb16de
tree05448b9bfdbf6b791f4ae39231ee7ebbac290ca2
parent0f9a857e34d0f8c018a3e4435c6f0e92e8d2f38c
tools: ynl: add scope qualifier for definitions

Using definitions in kernel policies is awkward right now.
On one hand we want defines for max values and such.
On the other we don't have a way of adding kernel-only defines.
Adding unnecessary defines to uAPI is a bad idea, we won't
be able to delete them. And when it comes to policy user
space should just query it via the policy dump, not use
hard coded defines.

Add a "scope" property to definitions, which will let us tell
the codegen that a definition is for kernel use only. Support
following values:
  - uapi: render into the uAPI header (default, today's behavior)
  - kernel: render to kernel header only
  - user: same as kernel but for the user-side generated header

Definitions may have a header property (definition is "external",
provided by existing header). Extend the scope to headers, too.
If definition has both scope and header properties we will only
generate the includes in the right scope.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Link: https://patch.msgid.link/20260510192904.3987113-8-kuba@kernel.org
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Documentation/netlink/genetlink-c.yaml
Documentation/netlink/genetlink-legacy.yaml
Documentation/netlink/genetlink.yaml
Documentation/netlink/netlink-raw.yaml
tools/net/ynl/pyynl/ynl_gen_c.py