The module .ko file might be called differently than the name used
by the kernel internally, e.g. "nls_iso8859-1.ko" is called
"nls_iso8859_1" in lsmmod. The print_modinfo() procedure expects the
filename spelling in order to successfully resolve the full module path.
After this change, "modinfo" supports printing module info even if the
user gives the kernel internal spelling instead of the file name one,
so that e.g. "modinfo "nls_iso8859_1" and "modinfo nls_iso8859-1.ko" will
both succeed.
static int main_modinfo(int argc, char **argv)
{
- char *module;
+ struct module *m;
+ char *name;
if (argc != 2)
return print_usage("modinfo");
- module = get_module_path(argv[1]);
- if (!module) {
+ if (scan_module_folder())
+ return -1;
+
+ name = get_module_name(argv[1]);
+ m = find_module(name);
+ if (!m) {
LOG("cannot find module - %s\n", argv[1]);
return -1;
}
- print_modinfo(module);
+ name = get_module_path(m->name);
+ if (!name) {
+ LOG("cannot find path of module - %s\n", m->name);
+ return -1;
+ }
+
+ print_modinfo(name);
return 0;
}