summaryrefslogtreecommitdiff
path: root/kmodloader.c
diff options
context:
space:
mode:
authorJo-Philipp Wich <jow@openwrt.org>2013-09-28 16:32:29 +0000
committerJo-Philipp Wich <jow@openwrt.org>2013-09-28 16:37:25 +0000
commit887256e92838ef94eeea8d7ba06ff078c7e05296 (patch)
tree0fdd0f31b8ca68fb6bd327dac77dccf741c2ddaf /kmodloader.c
parent187013f7ce107791c0ea891e63188d699727224a (diff)
downloadubox-887256e92838ef94eeea8d7ba06ff078c7e05296.tar.gz
kmodloader: use the name of the found module struct for modinfo
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.
Diffstat (limited to 'kmodloader.c')
-rw-r--r--kmodloader.c19
1 files changed, 15 insertions, 4 deletions
diff --git a/kmodloader.c b/kmodloader.c
index 417d121..623a169 100644
--- a/kmodloader.c
+++ b/kmodloader.c
@@ -583,18 +583,29 @@ static int main_lsmod(int argc, char **argv)
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;
}