]> www.infradead.org Git - users/jedix/linux-maple.git/commit
tools: ynl: submsg: reverse parse / error reporting
authorJakub Kicinski <kuba@kernel.org>
Thu, 15 May 2025 23:16:48 +0000 (16:16 -0700)
committerJakub Kicinski <kuba@kernel.org>
Fri, 16 May 2025 23:32:06 +0000 (16:32 -0700)
commit0939a418b3b092aa8a97a59752084896e4a7c813
tree2857d5de4c531837c244a7000903e5d3472d2bd4
parentb9e03e263610a8d872c753bc882676d3cba1797b
tools: ynl: submsg: reverse parse / error reporting

Reverse parsing lets YNL convert bad and missing attr pointers
from extack into a string like "missing attribute nest1.nest2.attr_name".
It's a feature that's unique to YNL C AFAIU (even the Python YNL
can't do nested reverse parsing). Add support for reverse-parsing
of sub-messages.

To simplify the logic and the code annotate the type policies
with extra metadata. Mark the selectors and the messages with
the information we need. We assume that key / selector always
precedes the sub-message while parsing (and also if there are
multiple sub-messages like in rt-link they are interleaved
selector 1 ... submsg 1 ... selector 2 .. submsg 2, not
selector 1 ... selector 2 ... submsg 1 ... submsg 2).

The rt-link sample in a subsequent changes shows reverse parsing
of sub-messages in action.

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20250515231650.1325372-8-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/lib/ynl-priv.h
tools/net/ynl/lib/ynl.c
tools/net/ynl/pyynl/ynl_gen_c.py