summaryrefslogtreecommitdiffstats
path: root/mdk-stage1
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2007-08-27 12:15:11 +0000
committerOlivier Blin <oblin@mandriva.com>2007-08-27 12:15:11 +0000
commit3507fefc0bee2f3c1bd97fb8dd22efa12911f594 (patch)
tree30354c184a765e2dcd5d46f0ca817c2c9652bb24 /mdk-stage1
parent71164e5326401fb4152398479f3ca0c4db5e4956 (diff)
downloaddrakx-backup-do-not-use-3507fefc0bee2f3c1bd97fb8dd22efa12911f594.tar
drakx-backup-do-not-use-3507fefc0bee2f3c1bd97fb8dd22efa12911f594.tar.gz
drakx-backup-do-not-use-3507fefc0bee2f3c1bd97fb8dd22efa12911f594.tar.bz2
drakx-backup-do-not-use-3507fefc0bee2f3c1bd97fb8dd22efa12911f594.tar.xz
drakx-backup-do-not-use-3507fefc0bee2f3c1bd97fb8dd22efa12911f594.zip
ask loading modules from /modules if needed
Diffstat (limited to 'mdk-stage1')
-rw-r--r--mdk-stage1/NEWS2
-rw-r--r--mdk-stage1/modules.c22
2 files changed, 17 insertions, 7 deletions
diff --git a/mdk-stage1/NEWS b/mdk-stage1/NEWS
index 4edd38b80..ba4ae7f49 100644
--- a/mdk-stage1/NEWS
+++ b/mdk-stage1/NEWS
@@ -1,3 +1,5 @@
+- ask loading modules from /modules if needed
+
1.14:
- fix segfault in USB detection code (when no module match, #32624)
diff --git a/mdk-stage1/modules.c b/mdk-stage1/modules.c
index 8b5a6cc86..428b12460 100644
--- a/mdk-stage1/modules.c
+++ b/mdk-stage1/modules.c
@@ -371,21 +371,30 @@ enum return_type ask_insmod(enum driver_type type)
snprintf(msg, sizeof(msg), "Which driver should I try to gain %s access?", mytype);
{
- char ** modules = NULL;
- char ** descrs = malloc(sizeof(char *) * string_array_length(modules));
+ char ** dlist = list_directory("/modules");
+ char ** modules = malloc(sizeof(char *) * string_array_length(dlist) + 1);
+ char ** descrs = malloc(sizeof(char *) * string_array_length(dlist) + 1);
+ char ** p_dlist = dlist;
char ** p_modules = modules;
char ** p_descrs = descrs;
- while (p_modules && *p_modules) {
+ while (p_dlist && *p_dlist) {
int i;
- *p_descrs = NULL;
+ if (!strstr(*p_dlist, kernel_module_extension())) {
+ p_dlist++;
+ continue;
+ }
+ *p_modules = *p_dlist;
+ (*p_modules)[strlen(*p_modules)-strlen(kernel_module_extension())] = '\0'; /* remove trailing .ko.gz */
for (i = 0 ; i < modules_descriptions_num ; i++) {
- if (!strncmp(*p_modules, modules_descriptions[i].module, strlen(modules_descriptions[i].module))
- && (*p_modules)[strlen(modules_descriptions[i].module)] == '.') /* one contains '.ko.gz' not the other */
+ if (!strcmp(*p_modules, modules_descriptions[i].module))
*p_descrs = modules_descriptions[i].descr;
}
+ p_dlist++;
p_modules++;
p_descrs++;
}
+ *p_modules = NULL;
+ *p_descrs = NULL;
if (modules && *modules)
results = ask_from_list_comments(msg, modules, descrs, &choice);
else
@@ -393,7 +402,6 @@ enum return_type ask_insmod(enum driver_type type)
}
if (results == RETURN_OK) {
- choice[strlen(choice)-strlen(kernel_module_extension())] = '\0'; /* remove trailing .ko.gz */
return insmod_with_options(choice, type);
} else
return results;