diff options
| author | Jakub Kicinski <[email protected]> | 2025-05-15 23:16:45 +0000 |
|---|---|---|
| committer | Jakub Kicinski <[email protected]> | 2025-05-16 23:32:05 +0000 |
| commit | 3186a8e55ae3428ec1e06af09075e20885376e4e (patch) | |
| tree | f44590a3df955e71627d31249b790680ef6029b2 /tools/net/ynl/pyynl/ynl_gen_c.py | |
| parent | tools: ynl-gen: prepare for submsg structs (diff) | |
| download | kernel-3186a8e55ae3428ec1e06af09075e20885376e4e.tar.gz kernel-3186a8e55ae3428ec1e06af09075e20885376e4e.zip | |
tools: ynl-gen: submsg: plumb thru an empty type
Hook in handling of sub-messages, for now treat them as ignored attrs.
Reviewed-by: Donald Hunter <[email protected]>
Link: https://patch.msgid.link/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'tools/net/ynl/pyynl/ynl_gen_c.py')
| -rwxr-xr-x | tools/net/ynl/pyynl/ynl_gen_c.py | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tools/net/ynl/pyynl/ynl_gen_c.py b/tools/net/ynl/pyynl/ynl_gen_c.py index c8b2a2ab2e5d..2292bbb68836 100755 --- a/tools/net/ynl/pyynl/ynl_gen_c.py +++ b/tools/net/ynl/pyynl/ynl_gen_c.py @@ -14,6 +14,7 @@ import yaml sys.path.append(pathlib.Path(__file__).resolve().parent.as_posix()) from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, SpecEnumEntry +from lib import SpecSubMessage, SpecSubMessageFormat def c_upper(name): @@ -872,6 +873,10 @@ class TypeNestTypeValue(Type): return get_lines, init_lines, local_vars +class TypeSubMessage(TypeUnused): + pass + + class Struct: def __init__(self, family, space_name, type_list=None, inherited=None): self.family = family @@ -1052,6 +1057,8 @@ class AttrSet(SpecAttrSet): raise Exception(f'new_attr: unsupported sub-type {elem["sub-type"]}') elif elem['type'] == 'nest-type-value': t = TypeNestTypeValue(self.family, self, elem, value) + elif elem['type'] == 'sub-message': + t = TypeSubMessage(self.family, self, elem, value) else: raise Exception(f"No typed class for type {elem['type']}") @@ -1096,6 +1103,16 @@ class Operation(SpecOperation): self.has_ntf = True +class SubMessage(SpecSubMessage): + def __init__(self, family, yaml): + super().__init__(family, yaml) + + self.render_name = c_lower(family.ident_name + '-' + yaml['name']) + + def resolve(self): + self.resolve_up(super()) + + class Family(SpecFamily): def __init__(self, file_name, exclude_ops): # Added by resolve: @@ -1178,6 +1195,9 @@ class Family(SpecFamily): def new_operation(self, elem, req_value, rsp_value): return Operation(self, elem, req_value, rsp_value) + def new_sub_message(self, elem): + return SubMessage(self, elem) + def is_classic(self): return self.proto == 'netlink-raw' |
