diff options
author | Guillaume Cottenceau <gc@mandriva.com> | 2004-02-17 21:32:48 +0000 |
---|---|---|
committer | Guillaume Cottenceau <gc@mandriva.com> | 2004-02-17 21:32:48 +0000 |
commit | 5c8be581c94702bfeb3423e546dcec2750988c59 (patch) | |
tree | 522f7c058e19a2902523b9ee6a8d3a230e546d06 /mdk-stage1 | |
parent | 5293eed5427b1c78124963ac24b0ac43140bdfda (diff) | |
download | drakx-5c8be581c94702bfeb3423e546dcec2750988c59.tar drakx-5c8be581c94702bfeb3423e546dcec2750988c59.tar.gz drakx-5c8be581c94702bfeb3423e546dcec2750988c59.tar.bz2 drakx-5c8be581c94702bfeb3423e546dcec2750988c59.tar.xz drakx-5c8be581c94702bfeb3423e546dcec2750988c59.zip |
support 2.6 insmoding for expert third party modules and loading named modules
Diffstat (limited to 'mdk-stage1')
-rw-r--r-- | mdk-stage1/modules.c | 43 | ||||
-rw-r--r-- | mdk-stage1/modules.h | 1 | ||||
-rw-r--r-- | mdk-stage1/stage1.c | 2 |
3 files changed, 28 insertions, 18 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c index 201302603..9df49aa46 100644 --- a/mdk-stage1/modules.c +++ b/mdk-stage1/modules.c @@ -132,6 +132,29 @@ static enum return_type ensure_additional_modules_available(void) return RETURN_OK; } +int insmod_local_file(char * path, char * options) +{ + if (kernel_version() <= 4) { + return insmod_call(path, options); + } else { + void *file; + unsigned long len; + int rc; + + file = grab_file(path, &len); + + if (!file) { + log_perror(asprintf_("\terror reading %s", path)); + return -1; + } + + rc = init_module(file, len, options ? options : ""); + if (rc) + log_message("\terror: %s", moderror(errno)); + return rc; + } +} + /* unarchive and insmod given module * WARNING: module must not contain the trailing ".o" */ @@ -164,25 +187,11 @@ static enum insmod_return insmod_archived_file(const char * mod_name, char * opt return INSMOD_FAILED; strcat(final_name, module_name); - if (kernel_version() <= 4) { - rc = insmod_call(final_name, options); - } else { - void *file; - unsigned long len; - - file = grab_file(final_name, &len); - - if (!file) { - log_perror(asprintf_("\terror reading %s", final_name)); - return INSMOD_FAILED; - } - rc = init_module(file, len, options ? options : ""); - if (rc) - log_message("\terror %s", moderror(errno)); - } + rc = insmod_local_file(final_name, options); unlink(final_name); /* sucking no space left on device */ + if (rc) { log_message("\tfailed"); return INSMOD_FAILED; @@ -572,7 +581,7 @@ void update_modules(void) while (entry && *entry) { if (!strncmp(*entry, module, strlen(module)) && (*entry)[strlen(module)] == '.') { sprintf(final_name, "%s/%s", floppy_mount_location, *entry); - if (insmod_call(final_name, options)) { + if (insmod_local_file(final_name, options)) { log_message("\t%s (floppy): failed", *entry); stg1_error_message("Insmod %s (floppy) failed.", *entry); } diff --git a/mdk-stage1/modules.h b/mdk-stage1/modules.h index 15a07af64..d91a415b1 100644 --- a/mdk-stage1/modules.h +++ b/mdk-stage1/modules.h @@ -21,6 +21,7 @@ enum insmod_return { INSMOD_OK, INSMOD_FAILED, INSMOD_FAILED_FILE_NOT_FOUND }; void init_modules_insmoding(void); +int insmod_local_file(char * path, char * options); enum insmod_return my_insmod(const char * mod_name, enum driver_type type, char * options, int allow_modules_floppy); enum return_type ask_insmod(enum driver_type); void update_modules(void); diff --git a/mdk-stage1/stage1.c b/mdk-stage1/stage1.c index 95694308f..e1efc6348 100644 --- a/mdk-stage1/stage1.c +++ b/mdk-stage1/stage1.c @@ -257,7 +257,7 @@ static void expert_third_party_modules(void) return expert_third_party_modules(); } - rc = insmod_call(final_name, answers[0]); + rc = insmod_local_file(final_name, answers[0]); umount(floppy_mount_location); if (rc) { |