[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241113181023.2030098-3-sdf@fomichev.me>
Date: Wed, 13 Nov 2024 10:10:18 -0800
From: Stanislav Fomichev <sdf@...ichev.me>
To: netdev@...r.kernel.org
Cc: davem@...emloft.net,
edumazet@...gle.com,
kuba@...nel.org,
pabeni@...hat.com,
linux-kernel@...r.kernel.org,
horms@...nel.org,
donald.hunter@...il.com,
andrew+netdev@...n.ch,
kory.maincent@...tlin.com,
sdf@...ichev.me,
nicolas.dichtel@...nd.com
Subject: [PATCH net-next 2/7] ynl: support render attribute in legacy definitions
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@...ichev.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
Powered by blists - more mailing lists