From: "Xaver Hörl" <hoe.dom@gmx.de>
To: linux-modules@vger.kernel.org
Subject: [PATCH] modinfo: dont print module name when --field is given
Date: Sun, 23 Aug 2020 23:54:33 +0200 [thread overview]
Message-ID: <20200823215433.j5gc5rnsmahpf43v@blumerang> (raw)
I hope I found the right mailing list for this issue, which
came up here: https://github.com/NixOS/nixpkgs/pull/96008
The man page for modinfo claims that with the -F / --field option only
the specified field gets printed. Currently this is not true as for builtin modules, the name is always printed.
Try something like "modinfo -F firmware unix" for example.
It will print: "name: unix"
So either the man page needs to be updated or the behaviour changed.
The following patch should fix this:
---
tools/modinfo.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/tools/modinfo.c b/tools/modinfo.c
index 0231bb0..7b2259e 100644
--- a/tools/modinfo.c
+++ b/tools/modinfo.c
@@ -178,7 +178,10 @@ static int modinfo_do(struct kmod_module *mod)
is_builtin = (filename == NULL);
if (is_builtin) {
- printf("%-16s%s%c", "name:", kmod_module_get_name(mod), separator);
+ if (field == NULL || field != NULL && streq(field, "name")){
+ printf("%-16s%s%c", "name:",
+ kmod_module_get_name(mod), separator);
+ }
filename = "(builtin)";
}
--
2.28.0
next reply other threads:[~2020-08-23 21:54 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-08-23 21:54 Xaver Hörl [this message]
2020-08-25 17:27 ` [PATCH] modinfo: dont print module name when --field is given Lucas De Marchi
2020-08-26 9:36 ` Xaver Hörl
2020-08-26 10:12 ` Lucas De Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200823215433.j5gc5rnsmahpf43v@blumerang \
--to=hoe.dom@gmx.de \
--cc=linux-modules@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).