Commit 87948df5 authored by Jakub Kicinski's avatar Jakub Kicinski
Browse files

tools: ynl-gen: array-nest: support arrays of nests

TC needs arrays of nests, but just a put for now.
Fairly straightforward addition.

Link: https://patch.msgid.link/20250513222011.844106-1-kuba@kernel.org


Signed-off-by: default avatarJakub Kicinski <kuba@kernel.org>
parent 1119e551
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -825,6 +825,9 @@ class TypeArrayNest(Type):
        elif self.sub_type == 'binary' and 'exact-len' in self.checks:
            ri.cw.p(f'for (i = 0; i < {var}->_count.{self.c_name}; i++)')
            ri.cw.p(f"ynl_attr_put(nlh, i, {var}->{self.c_name}[i], {self.checks['exact-len']});")
        elif self.sub_type == 'nest':
            ri.cw.p(f'for (i = 0; i < {var}->_count.{self.c_name}; i++)')
            ri.cw.p(f"{self.nested_render_name}_put(nlh, i, &{var}->{self.c_name}[i]);")
        else:
            raise Exception(f"Put for ArrayNest sub-type {self.attr['sub-type']} not supported, yet")
        ri.cw.p('ynl_attr_nest_end(nlh, array);')