]> git.ipfire.org Git - thirdparty/kmod.git/commitdiff
Fix "modinfo -F always shows name for built-ins"
authorMarco d'Itri <md@linux.it>
Fri, 8 Jan 2021 04:17:48 +0000 (20:17 -0800)
committerLucas De Marchi <lucas.demarchi@intel.com>
Fri, 8 Jan 2021 04:17:48 +0000 (20:17 -0800)
Bug reported by Ben Hutchings <ben@decadent.org.uk>:
https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=970871

Now that the kernel provides module information for potentially
modular code that's actually built-in, it's possible to query these
built-ins with "modinfo -F".  However, this doesn't work quite right:

$ modinfo -Flicense e1000e
GPL v2
$ modinfo -Flicense bitrev
name:           bitrev
GPL

tools/modinfo.c

index 0231bb03e3dba5607af040a205af9e82929e2271..f6a971fa40f74dc26bf2eae74dc472cf7928e854 100644 (file)
@@ -178,7 +178,11 @@ 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)
+                       printf("%-16s%s%c", "name:",
+                              kmod_module_get_name(mod), separator);
+               else if (field != NULL && streq(field, "name"))
+                       printf("%s%c", kmod_module_get_name(mod), separator);
                filename = "(builtin)";
        }