From 1133b2fd318ec75019cfc2820a761e9f52f4f609 Mon Sep 17 00:00:00 2001 From: Martin Liska Date: Mon, 27 Feb 2023 09:47:22 +0100 Subject: [PATCH] Fix output for of lsmod.py Unify it with what lsmod(8) does. Signed-off-by: Martin Liska --- contrib/lsmod.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/contrib/lsmod.py b/contrib/lsmod.py index 61a4b7761..87c40b83c 100755 --- a/contrib/lsmod.py +++ b/contrib/lsmod.py @@ -12,7 +12,7 @@ name = mod.name.string_().decode() size = (mod.init_layout.size + mod.core_layout.size).value_() if config_module_unload: - refcnt = mod.refcnt.counter.value_() + refcnt = mod.refcnt.counter.value_() - 1 used_by = [ use.source.name.string_().decode() for use in list_for_each_entry( @@ -22,4 +22,8 @@ else: refcnt = "-" used_by = [] - print(f"{name:19} {size:>8} {refcnt} {','.join(used_by)}") + + used = ",".join(used_by) + if used: + used = " " + used + print(f"{name:19} {size:>8} {refcnt}{used}")