tools: ynl-gen: don't override pure nested struct
authorJakub Kicinski <kuba@kernel.org>
Fri, 2 Jun 2023 02:35:41 +0000 (19:35 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 3 Jun 2023 05:10:46 +0000 (22:10 -0700)
For pure structs (parsed nested attributes) we track what
forms of the struct exist in request and reply directions.
Make sure we don't overwrite the recorded struct each time,
otherwise the information is lost.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/ynl-gen-c.py

index 11dcbfc21ecc5bea438a8b7b35fe3c4e993dbb3b..40f7c47407c83a2e8ebf4ee0154a5af3e90b7b1c 100755 (executable)
@@ -825,7 +825,8 @@ class Family(SpecFamily):
                     inherit = set()
                     nested = spec['nested-attributes']
                     if nested not in self.root_sets:
-                        self.pure_nested_structs[nested] = Struct(self, nested, inherited=inherit)
+                        if nested not in self.pure_nested_structs:
+                            self.pure_nested_structs[nested] = Struct(self, nested, inherited=inherit)
                     if attr in rs_members['request']:
                         self.pure_nested_structs[nested].request = True
                     if attr in rs_members['reply']: