diff mbox series

[net-next] tools: ynl: use display hints for formatting of scalar attrs

Message ID 20240626201234.2572964-1-kuba@kernel.org (mailing list archive)
State Accepted
Commit 2a901623f0056ccdb64dbfd3d98f9072f704f065
Delegated to: Netdev Maintainers
Headers show
Series [net-next] tools: ynl: use display hints for formatting of scalar attrs | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 8 this patch: 8
netdev/build_tools success Errors and warnings before: 0 this patch: 0
netdev/cc_maintainers success CCed 5 of 5 maintainers
netdev/build_clang success Errors and warnings before: 8 this patch: 8
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 8 this patch: 8
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 8 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-06-27--03-00 (tests: 665)

Commit Message

Jakub Kicinski June 26, 2024, 8:12 p.m. UTC
Use display hints for formatting scalar attrs. This is specifically
useful for formatting IPv4 addresses carried typically as u32.

Signed-off-by: Jakub Kicinski <kuba@kernel.org>
---
CC: donald.hunter@gmail.com
CC: jiri@resnulli.us
---
 tools/net/ynl/lib/ynl.py | 2 ++
 1 file changed, 2 insertions(+)

Comments

Donald Hunter June 27, 2024, 9:22 a.m. UTC | #1
Jakub Kicinski <kuba@kernel.org> writes:

> Use display hints for formatting scalar attrs. This is specifically
> useful for formatting IPv4 addresses carried typically as u32.
>
> Signed-off-by: Jakub Kicinski <kuba@kernel.org>

I don't know how scalars got missed out :shrug:

Reviewed-by: Donald Hunter <donald.hunter@gmail.com>

Thanks!

> ---
> CC: donald.hunter@gmail.com
> CC: jiri@resnulli.us
> ---
>  tools/net/ynl/lib/ynl.py | 2 ++
>  1 file changed, 2 insertions(+)
>
> diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
> index 35e666928119..d42c1d605969 100644
> --- a/tools/net/ynl/lib/ynl.py
> +++ b/tools/net/ynl/lib/ynl.py
> @@ -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':
patchwork-bot+netdevbpf@kernel.org June 27, 2024, 9:30 p.m. UTC | #2
Hello:

This patch was applied to netdev/net-next.git (main)
by Jakub Kicinski <kuba@kernel.org>:

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 <kuba@kernel.org>
> ---
> CC: donald.hunter@gmail.com
> CC: jiri@resnulli.us
> 
> [...]

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!
diff mbox series

Patch

diff --git a/tools/net/ynl/lib/ynl.py b/tools/net/ynl/lib/ynl.py
index 35e666928119..d42c1d605969 100644
--- a/tools/net/ynl/lib/ynl.py
+++ b/tools/net/ynl/lib/ynl.py
@@ -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':