summaryrefslogtreecommitdiff
path: root/tools/net/ynl/pyynl/ynl_gen_c.py
diff options
context:
space:
mode:
authorJakub Kicinski <kuba@kernel.org>2025-04-29 08:46:55 -0700
committerPaolo Abeni <pabeni@redhat.com>2025-05-02 12:41:02 +0200
commitd12a7be02524a6f4d8d5d57920001ea63a93f28d (patch)
treef88b7dcff40451509e6efa65753f959be4d25e68 /tools/net/ynl/pyynl/ynl_gen_c.py
parent2286905f1b33cafa25e508f20bfceb47e20e85d8 (diff)
tools: ynl-gen: fill in missing empty attr lists
The C codegen refers to op attribute lists all over the place, without checking if they are present, even tho attribute list is technically an optional property. Add them automatically at init if missing so that we don't have to make specs longer. Reviewed-by: Donald Hunter <donald.hunter@gmail.com> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com> Signed-off-by: Jakub Kicinski <kuba@kernel.org> Link: https://patch.msgid.link/20250429154704.2613851-4-kuba@kernel.org Signed-off-by: Paolo Abeni <pabeni@redhat.com>
Diffstat (limited to 'tools/net/ynl/pyynl/ynl_gen_c.py')
-rwxr-xr-xtools/net/ynl/pyynl/ynl_gen_c.py8
1 files changed, 8 insertions, 0 deletions
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py
index 90f7fe6b623b..898c41a7a81f 100755
--- a/tools/net/ynl/pyynl/ynl_gen_c.py
+++ b/tools/net/ynl/pyynl/ynl_gen_c.py
@@ -938,6 +938,14 @@ class AttrSet(SpecAttrSet):
class Operation(SpecOperation):
def __init__(self, family, yaml, req_value, rsp_value):
+ # Fill in missing operation properties (for fixed hdr-only msgs)
+ for mode in ['do', 'dump', 'event']:
+ for direction in ['request', 'reply']:
+ try:
+ yaml[mode][direction].setdefault('attributes', [])
+ except KeyError:
+ pass
+
super().__init__(family, yaml, req_value, rsp_value)
self.render_name = c_lower(family.ident_name + '_' + self.name)