diff options
author | Olivier Blin <oblin@mandriva.com> | 2007-08-21 16:54:43 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2007-08-21 16:54:43 +0000 |
commit | f13e32bce80454d24179e358adaf8d864fbc9462 (patch) | |
tree | f3172ba900660ddc4c76a3fd1437f99226519107 /mdk-stage1 | |
parent | 5730fc5d4a8f6ba45ef3f631723c75116933f6a5 (diff) | |
download | drakx-f13e32bce80454d24179e358adaf8d864fbc9462.tar drakx-f13e32bce80454d24179e358adaf8d864fbc9462.tar.gz drakx-f13e32bce80454d24179e358adaf8d864fbc9462.tar.bz2 drakx-f13e32bce80454d24179e358adaf8d864fbc9462.tar.xz drakx-f13e32bce80454d24179e358adaf8d864fbc9462.zip |
convert module name to filename before loading it (using modules.dep to get filename)
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/modules.c | 21 | ||||
-rw-r--r-- | mdk-stage1/modules.h | 1 |
2 files changed, 20 insertions, 2 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index ad2ae6954..26fcde5ff 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -122,6 +122,7 @@ static int load_modules_dependencies(void) line = 0; while (start < (buf+s.st_size) && *start) { char * tmp_deps[50]; + char * modp; end = strchr(start, '\n'); *end = '\0'; @@ -141,7 +142,15 @@ static int load_modules_dependencies(void) } /* sort of a good line */ + modules_deps[line].filename = strdup(start); + modules_deps[line].modname = strdup(start); + modp = modules_deps[line].modname; + while (modp && *modp) { + if (*modp == '-') + *modp = '_'; + modp++; + } start = ptr; i = 0; @@ -224,6 +233,7 @@ int module_already_present(const char * name) static enum insmod_return insmod_with_deps(const char * mod_name, char * options, int allow_modules_floppy) { struct module_deps_elem * dep; + const char * filename; dep = modules_deps; while (dep && dep->modname && strcmp(dep->modname, mod_name)) dep++; @@ -238,13 +248,20 @@ static enum insmod_return insmod_with_deps(const char * mod_name, char * options one_dep++; } } + + if (dep && dep->filename) { + filename = dep->filename; + } else { + log_message("warning: unable to get module filename for %s", mod_name); + filename = mod_name; + } if (module_already_present(mod_name)) return INSMOD_OK; - log_message("needs %s", mod_name); + log_message("needs %s", filename); { - char *file = asprintf_("/modules/%s%s", mod_name, kernel_module_extension()); + char *file = asprintf_("/modules/%s%s", filename, kernel_module_extension()); return insmod_local_file(file, options); } } diff --git a/mdk-stage1/modules.h b/mdk-stage1/modules.h index 3cd11e49e..10c9ebf4b 100644 --- a/mdk-stage1/modules.h +++ b/mdk-stage1/modules.h @@ -28,6 +28,7 @@ int module_already_present(const char * name); struct module_deps_elem { char * modname; + char * filename; char ** deps; }; |