To allow omitting some of the attributes in the final generated file.
Some of the definitions that seemingly belong to the spec
are defined in the ethtool.h. To minimize the amount of churn,
skip rendering a similar (and conflicting) definition from the spec.
Signed-off-by: Stanislav Fomichev <sdf@fomichev.me>
---
Documentation/netlink/genetlink-legacy.yaml | 5 +++++
tools/net/ynl/ynl-gen-c.py | 4 ++++
2 files changed, 9 insertions(+)
diff --git a/Documentation/netlink/genetlink-legacy.yaml b/Documentation/netlink/genetlink-legacy.yaml
index 83f874ae7198..cdda9e6f4062 100644
--- a/Documentation/netlink/genetlink-legacy.yaml
+++ b/Documentation/netlink/genetlink-legacy.yaml
@@ -83,6 +83,11 @@ additionalProperties: False
enum: [ const, enum, flags, struct ] # Trim
doc:
type: string
+ # Start genetlink-legacy
+ render:
+ description: Render this definition (true by default) or not.
+ type: boolean
+ # End genetlink-legacy
# For const
value:
description: For const - the value.
diff --git a/tools/net/ynl/ynl-gen-c.py b/tools/net/ynl/ynl-gen-c.py
index 210972b4796a..0de918c7f18d 100755
--- a/tools/net/ynl/ynl-gen-c.py
+++ b/tools/net/ynl/ynl-gen-c.py
@@ -798,6 +798,7 @@ from lib import SpecFamily, SpecAttrSet, SpecAttr, SpecOperation, SpecEnumSet, S
self.user_type = 'int'
self.value_pfx = yaml.get('name-prefix', f"{family.ident_name}-{yaml['name']}-")
+ self.render = yaml.get('render', True)
self.attr_cnt_name = yaml.get('attr-cnt-name', None)
super().__init__(family, yaml)
@@ -2437,6 +2438,9 @@ _C_KW = {
if const['type'] == 'enum' or const['type'] == 'flags':
enum = family.consts[const['name']]
+ if not enum.render:
+ continue
+
if enum.has_doc():
if enum.has_entry_doc():
cw.p('/**')
--
2.47.0