summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/modules.c26
-rw-r--r--mdk-stage1/modules.h4
-rw-r--r--mdk-stage1/probing.c13
3 files changed, 23 insertions, 20 deletions
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 51e2b6902..37f251685 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -43,7 +43,7 @@ static int disable_modules = 0;
/* unarchive and insmod given module
* WARNING: module must not contain the trailing ".o"
*/
-static int insmod_archived_file(const char * mod_name, char * options)
+static enum insmod_return insmod_archived_file(const char * mod_name, char * options)
{
char module_name[50];
char final_name[50] = "/tmp/";
@@ -54,19 +54,21 @@ static int insmod_archived_file(const char * mod_name, char * options)
i = mar_extract_file(archive_name, module_name, "/tmp/");
if (i == 1) {
log_message("file-not-found-in-archive %s", module_name);
- return -2;
+ return INSMOD_FAILED_FILE_NOT_FOUND;
}
if (i != 0)
- return -1;
+ return INSMOD_FAILED;
strcat(final_name, mod_name);
strcat(final_name, ".o");
rc = insmod_call(final_name, options);
- if (rc)
- log_message("\tfailed");
unlink(final_name); /* sucking no space left on device */
- return rc;
+ if (rc) {
+ log_message("\tfailed");
+ return INSMOD_FAILED;
+ }
+ return INSMOD_OK;
}
@@ -209,7 +211,7 @@ static int module_already_present(const char * name)
}
-static int insmod_with_deps(const char * mod_name, char * options)
+static enum insmod_return insmod_with_deps(const char * mod_name, char * options)
{
struct module_deps_elem * dep;
@@ -228,14 +230,14 @@ static int insmod_with_deps(const char * mod_name, char * options)
}
if (module_already_present(mod_name))
- return 0;
+ return INSMOD_OK;
log_message("needs %s", mod_name);
return insmod_archived_file(mod_name, options);
}
-int my_insmod(const char * mod_name, enum driver_type type, char * options)
+enum insmod_return my_insmod(const char * mod_name, enum driver_type type, char * options)
{
char alias[500];
int i;
@@ -250,7 +252,7 @@ int my_insmod(const char * mod_name, enum driver_type type, char * options)
if (disable_modules) {
log_message("\tdisabled");
- return 0;
+ return INSMOD_OK;
}
#ifndef DISABLE_NETWORK
@@ -259,7 +261,7 @@ int my_insmod(const char * mod_name, enum driver_type type, char * options)
#endif
if (IS_TESTING)
- return 0;
+ return INSMOD_OK;
i = insmod_with_deps(mod_name, options);
if (i == 0) {
@@ -316,7 +318,7 @@ static enum return_type insmod_with_options(char * mod, enum driver_type type)
strcat(options, " ");
strcat(options, answers[0]); // because my_insmod will eventually modify the string
- if (my_insmod(mod, type, answers[0])) {
+ if (my_insmod(mod, type, answers[0]) != INSMOD_OK) {
error_message("Insmod failed.");
return RETURN_ERROR;
}
diff --git a/mdk-stage1/modules.h b/mdk-stage1/modules.h
index b1c921b01..9ed992033 100644
--- a/mdk-stage1/modules.h
+++ b/mdk-stage1/modules.h
@@ -18,8 +18,10 @@
#include "stage1.h"
#include "probing.h"
+enum insmod_return { INSMOD_OK, INSMOD_FAILED, INSMOD_FAILED_FILE_NOT_FOUND };
+
void init_modules_insmoding(void);
-int my_insmod(const char * mod_name, enum driver_type type, char * options);
+enum insmod_return my_insmod(const char * mod_name, enum driver_type type, char * options);
enum return_type ask_insmod(enum driver_type);
struct module_deps_elem {
diff --git a/mdk-stage1/probing.c b/mdk-stage1/probing.c
index d0ea315a1..ba7572831 100644
--- a/mdk-stage1/probing.c
+++ b/mdk-stage1/probing.c
@@ -59,9 +59,11 @@ struct media_info {
};
-static void warning_insmod_failed(void)
+static void warning_insmod_failed(enum insmod_return r)
{
- error_message("Warning, installation of driver failed. (please include msg from <Alt-F3> for bugreports)");
+ if (r != INSMOD_OK
+ && !(IS_AUTOMATIC && r == INSMOD_FAILED_FILE_NOT_FOUND))
+ error_message("Warning, installation of driver failed. (please include msg from <Alt-F3> for bugreports)");
}
#ifndef DISABLE_NETWORK
@@ -165,8 +167,7 @@ static void probe_that_type(enum driver_type type)
wait_message("Installing %s", pcidb[i].name);
garb = my_insmod(pcidb[i].module, SCSI_ADAPTERS, NULL);
remove_wait_message();
- if (garb && !(IS_AUTOMATIC && garb == -2))
- warning_insmod_failed();
+ warning_insmod_failed(garb);
}
#endif
#ifndef DISABLE_NETWORK
@@ -174,9 +175,7 @@ static void probe_that_type(enum driver_type type)
/* insmod is quick, let's use the info message */
info_message("Found %s", pcidb[i].name);
prepare_intf_descr(pcidb[i].name);
- garb = my_insmod(pcidb[i].module, NETWORK_DEVICES, NULL);
- if (garb && !(IS_AUTOMATIC && garb == -2))
- warning_insmod_failed();
+ warning_insmod_failed(my_insmod(pcidb[i].module, NETWORK_DEVICES, NULL));
if (intf_descr_for_discover) /* for modules providing more than one net intf */
net_discovered_interface(NULL);
}