tools: ynl: use display hints for formatting of scalar attrs
Subsystems (3)
Jakub Kicinski
maintainerPATCH 1/1 tools: ynl: use display hints for formatting of scalar attrs
Use display hints for formatting scalar attrs. This is specifically useful for formatting IPv4 addresses carried typically as u32.
---
CC: [email protected]
CC: [email protected]
--- tools/net/ynl/lib/ynl.py | 2 ++ 1 file changed, 2 insertions(+)
tools/net/ynl/lib/ynl.py +2 -0
@@ -743,6 +743,8 @@ genl_family_name_to_id = None decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order) if 'enum' in attr_spec: decoded = self._decode_enum(decoded, attr_spec) + elif attr_spec.display_hint: + decoded = self._formatted_string(decoded, attr_spec.display_hint) elif attr_spec["type"] == 'indexed-array': decoded = self._decode_array_attr(attr, attr_spec) elif attr_spec["type"] == 'bitfield32':
Signature · 1 line
2.45.2
Quoted 4 lines · Jakub Kicinski
Use display hints for formatting scalar attrs. This is specifically useful for formatting IPv4 addresses carried typically as u32.
Signed-off-by Jakub Kicinski <[email protected]>
I don't know how scalars got missed out :shrug:
Thanks!
Quoted 20 lines
---
CC: [email protected]
CC: [email protected]--- tools/net/ynl/lib/ynl.py | 2 ++ 1 file changed, 2 insertions(+)tools/net/ynl/lib/ynl.py +2
-0@@ -743,6 +743,8 @@ genl_family_name_to_id = None decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order) if 'enum' in attr_spec: decoded = self._decode_enum(decoded, attr_spec) + elif attr_spec.display_hint: + decoded = self._formatted_string(decoded, attr_spec.display_hint) elif attr_spec["type"] == 'indexed-array': decoded = self._decode_array_attr(attr, attr_spec) elif attr_spec["type"] == 'bitfield32':
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Hello:
This patch was applied to netdev/net-next.git (main) by Jakub Kicinski <[email protected]>:
Quoted 9 lines · On Wed, 26 Jun 2024 13:12:34 -0700 you wrote:
Use display hints for formatting scalar attrs. This is specifically useful for formatting IPv4 addresses carried typically as u32.
Signed-off-by Jakub Kicinski <[email protected]>---
CC: [email protected]
CC: [email protected][...]
Here is the summary with links:
- [net-next] tools: ynl: use display hints for formatting of scalar attrs
https://git.kernel.org/netdev/net-next/c/2a901623f005
You are awesome, thank you!
Signature · 2 lines
Deet-doot-dot, I am a bot. https://korg.docs.kernel.org/patchwork/pwbot.html