Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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.

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Link: https://patch.msgid.link/20240626201234.2572964-1-kuba@kernel.org
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+2
+2
tools/net/ynl/lib/ynl.py
··· 743 743 decoded = attr.as_scalar(attr_spec['type'], attr_spec.byte_order) 744 744 if 'enum' in attr_spec: 745 745 decoded = self._decode_enum(decoded, attr_spec) 746 + elif attr_spec.display_hint: 747 + decoded = self._formatted_string(decoded, attr_spec.display_hint) 746 748 elif attr_spec["type"] == 'indexed-array': 747 749 decoded = self._decode_array_attr(attr, attr_spec) 748 750 elif attr_spec["type"] == 'bitfield32':