projects
/
linux-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
2151003
)
tools/net/ynl: support decoding indexed arrays as enums
author
Donald Hunter
<donald.hunter@gmail.com>
Tue, 11 Feb 2025 12:01:19 +0000
(12:01 +0000)
committer
Jakub Kicinski
<kuba@kernel.org>
Thu, 13 Feb 2025 03:32:03 +0000
(19:32 -0800)
When decoding an indexed-array with a scalar subtype, it is currently
only possible to add a display-hint. Add support for decoding each value
as an enum.
Signed-off-by: Donald Hunter <donald.hunter@gmail.com>
Link:
https://patch.msgid.link/20250211120127.84858-3-donald.hunter@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/pyynl/lib/ynl.py
patch
|
blob
|
blame
|
history
diff --git
a/tools/net/ynl/pyynl/lib/ynl.py
b/tools/net/ynl/pyynl/lib/ynl.py
index 8b39d8b1eaa8a07680158bd2f75d21d982fa02f9..b73e07f1f60cd2b6e57c12cc3410327a2122b2f6 100644
(file)
--- a/
tools/net/ynl/pyynl/lib/ynl.py
+++ b/
tools/net/ynl/pyynl/lib/ynl.py
@@
-650,7
+650,9
@@
class YnlFamily(SpecFamily):
decoded.append(subattr)
elif attr_spec["sub-type"] in NlAttr.type_formats:
subattr = item.as_scalar(attr_spec['sub-type'], attr_spec.byte_order)
- if attr_spec.display_hint:
+ if 'enum' in attr_spec:
+ subattr = self._decode_enum(subattr, attr_spec)
+ elif attr_spec.display_hint:
subattr = self._formatted_string(subattr, attr_spec.display_hint)
decoded.append(subattr)
else: