summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorGuillaume Cottenceau <gc@mandriva.com>2001-01-02 23:40:00 +0000
committerGuillaume Cottenceau <gc@mandriva.com>2001-01-02 23:40:00 +0000
commitb6f5856600d9d6cbdde2189872a6b6dce69fe407 (patch)
tree3155ef0abe623075c2baa4547246d42251f25519 /mdk-stage1
parent9302affdabc003d034c338a6ed3ef266df93ade5 (diff)
downloaddrakx-b6f5856600d9d6cbdde2189872a6b6dce69fe407.tar
drakx-b6f5856600d9d6cbdde2189872a6b6dce69fe407.tar.gz
drakx-b6f5856600d9d6cbdde2189872a6b6dce69fe407.tar.bz2
drakx-b6f5856600d9d6cbdde2189872a6b6dce69fe407.tar.xz
drakx-b6f5856600d9d6cbdde2189872a6b6dce69fe407.zip
support load of modules with parameters when insmod failed without parameter and user asks for it
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/log.c8
-rw-r--r--mdk-stage1/log.h1
-rw-r--r--mdk-stage1/modules.c40
3 files changed, 32 insertions, 17 deletions
diff --git a/mdk-stage1/log.c b/mdk-stage1/log.c
index d4a1c71c7..5379c96dd 100644
--- a/mdk-stage1/log.c
+++ b/mdk-stage1/log.c
@@ -33,15 +33,11 @@
static FILE * logfile = NULL;
-void vlog_message_nobs(const char * s, va_list args)
-{
- fprintf(logfile, "* ");
- vfprintf(logfile, s, args);
-}
void vlog_message(const char * s, va_list args)
{
- vlog_message_nobs(s, args);
+ fprintf(logfile, "* ");
+ vfprintf(logfile, s, args);
fprintf(logfile, "\n");
fflush(logfile);
}
diff --git a/mdk-stage1/log.h b/mdk-stage1/log.h
index 65e0a2416..fcc641ad9 100644
--- a/mdk-stage1/log.h
+++ b/mdk-stage1/log.h
@@ -27,7 +27,6 @@
void log_message(const char * s, ...);
void vlog_message(const char * s, va_list args);
-void vlog_message_nobs(const char * s, va_list args);
void log_perror(char *msg);
void open_log(void);
void close_log(void);
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 14069d9dc..76d364d76 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -49,7 +49,7 @@ static int ensure_archive_opened(void)
/* unarchive and insmod given module
* WARNING: module must not contain the trailing ".o"
*/
-static int insmod_archived_file(const char * mod_name)
+static int insmod_archived_file(const char * mod_name, char * params)
{
char module_name[50];
char final_name[50] = "/tmp/";
@@ -59,7 +59,7 @@ static int insmod_archived_file(const char * mod_name)
return -1;
strncpy(module_name, mod_name, sizeof(module_name));
- strncat(module_name, ".o", sizeof(module_name));
+ strcat(module_name, ".o");
i = mar_extract_file(&s, module_name, "/tmp/");
if (i == 1) {
log_message("file-not-found-in-archive %s", module_name);
@@ -68,10 +68,10 @@ static int insmod_archived_file(const char * mod_name)
if (i != 0)
return -1;
- strncat(final_name, mod_name, sizeof(final_name));
- strncat(final_name, ".o", sizeof(final_name));
+ strcat(final_name, mod_name);
+ strcat(final_name, ".o");
- rc = insmod_call(final_name);
+ rc = insmod_call(final_name, params);
if (rc)
log_message("\tfailed.");
unlink(final_name); /* sucking no space left on device */
@@ -186,7 +186,7 @@ static int insmod_with_deps(const char * mod_name)
}
log_message("needs %s", mod_name);
- return insmod_archived_file(mod_name);
+ return insmod_archived_file(mod_name, NULL);
}
@@ -205,6 +205,23 @@ int my_insmod(const char * mod_name)
}
+enum return_type insmod_with_params(char * mod)
+{
+ char * questions[] = { "Options", NULL };
+ char ** answers;
+ enum return_type results;
+
+ results = ask_from_entries("Please enter the parameters to give to the kernel:", questions, &answers, 24);
+ if (results != RETURN_OK)
+ return results;
+
+ if (insmod_archived_file(mod, answers[0])) {
+ error_message("Insmod failed.");
+ return RETURN_ERROR;
+ }
+
+ return RETURN_OK;
+}
enum return_type ask_insmod(enum driver_type type)
{
@@ -230,11 +247,14 @@ enum return_type ask_insmod(enum driver_type type)
results = ask_from_list(msg, mar_list_contents(&s), &choice);
if (results == RETURN_OK) {
- int rc;
choice[strlen(choice)-2] = '\0'; /* remove trailing .o */
- rc = my_insmod(choice);
- if (rc) {
- error_message("Insmod failed.");
+ if (my_insmod(choice)) {
+ enum return_type results;
+ unset_param(MODE_AUTOMATIC); /* we are in a fallback mode */
+
+ results = ask_yes_no("Insmod failed.\nTry with parameters?");
+ if (results == RETURN_OK)
+ return insmod_with_params(choice);
return RETURN_ERROR;
} else
return RETURN_OK;