aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/scripts/generate_rust_analyzer.py
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-05-15 16:16:47 -0700
committerJakub Kicinski <kuba@kernel.org>2025-05-16 16:32:06 -0700
commitb9e03e263610a8d872c753bc882676d3cba1797b (patch)
tree288fe189eb630074a69d7cea7e63c290d584264f /scripts/generate_rust_analyzer.py
parenttools: ynl-gen: submsg: render the structs (diff)
downloadwireguard-linux-b9e03e263610a8d872c753bc882676d3cba1797b.tar.xz
wireguard-linux-b9e03e263610a8d872c753bc882676d3cba1797b.zip
tools: ynl-gen: submsg: support parsing and rendering sub-messages
Adjust parsing and rendering appropriately to make sub-messages work. Rendering is pretty trivial, as the submsg -> netlink conversion looks like rendering a nest in which only one attr was set. Only trick is that we use the enum value of the sub-message rather than the nest as the type, and effectively skip one layer of nesting. A real double nested struct would look like this: [SELECTOR] [SUBMSG] [NEST] [MSG1-ATTR] A submsg "is" the nest so by skipping I mean: [SELECTOR] [SUBMSG] [MSG1-ATTR] There is no extra validation in YNL if caller has set the selector matching the submsg type (e.g. link type = "macvlan" but the nest attrs are set to carry "veth"). Let the kernel handle that. Parsing side is a little more specialized as we need to render and insert a new kind of function which switches between what to parse based on the selector. But code isn't too complicated. Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250515231650.1325372-7-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'scripts/generate_rust_analyzer.py')
0 files changed, 0 insertions, 0 deletions