projects
/
linux-2.6-block.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
51cf49f
)
ynl: support hex display_hint for integer
author
Hangbin Liu
<liuhangbin@gmail.com>
Wed, 27 Mar 2024 12:31:28 +0000
(20:31 +0800)
committer
Jakub Kicinski
<kuba@kernel.org>
Fri, 29 Mar 2024 01:07:08 +0000
(18:07 -0700)
Some times it would be convenient to read the integer as hex, like
mask values.
Suggested-by: Donald Hunter <donald.hunter@gmail.com>
Reviewed-by: Donald Hunter <donald.hunter@gmail.com>
Signed-off-by: Hangbin Liu <liuhangbin@gmail.com>
Link:
https://lore.kernel.org/r/20240327123130.1322921-2-liuhangbin@gmail.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
tools/net/ynl/lib/ynl.py
patch
|
blob
|
blame
|
history
diff --git
a/tools/net/ynl/lib/ynl.py
b/tools/net/ynl/lib/ynl.py
index 5fa7957f6e0f56646249c278b7434f300754df77..e73b027c5624f01ab496e70edefce83722c9bc78 100644
(file)
--- a/
tools/net/ynl/lib/ynl.py
+++ b/
tools/net/ynl/lib/ynl.py
@@
-819,7
+819,10
@@
class YnlFamily(SpecFamily):
if display_hint == 'mac':
formatted = ':'.join('%02x' % b for b in raw)
elif display_hint == 'hex':
- formatted = bytes.hex(raw, ' ')
+ if isinstance(raw, int):
+ formatted = hex(raw)
+ else:
+ formatted = bytes.hex(raw, ' ')
elif display_hint in [ 'ipv4', 'ipv6' ]:
formatted = format(ipaddress.ip_address(raw))
elif display_hint == 'uuid':