mirror of
https://github.com/torvalds/linux.git
synced 2026-05-30 10:04:04 +02:00
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 <donald.hunter@gmail.com> Link: https://patch.msgid.link/20250515231650.1325372-5-kuba@kernel.org Signed-off-by: Jakub Kicinski <kuba@kernel.org>
This commit is contained in:
parent
99b76908a7
commit
3186a8e55a
|
|
@ -1,8 +1,9 @@
|
|||
# SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause
|
||||
|
||||
from .nlspec import SpecAttr, SpecAttrSet, SpecEnumEntry, SpecEnumSet, \
|
||||
SpecFamily, SpecOperation
|
||||
SpecFamily, SpecOperation, SpecSubMessage, SpecSubMessageFormat
|
||||
from .ynl import YnlFamily, Netlink, NlError
|
||||
|
||||
__all__ = ["SpecAttr", "SpecAttrSet", "SpecEnumEntry", "SpecEnumSet",
|
||||
"SpecFamily", "SpecOperation", "YnlFamily", "Netlink", "NlError"]
|
||||
"SpecFamily", "SpecOperation", "SpecSubMessage", "SpecSubMessageFormat",
|
||||
"YnlFamily", "Netlink", "NlError"]
|
||||
|
|
|
|||
|
|
@ -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'
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user