dloader - Allow foo_name for modules
authorAlex Hornung <ahornung@gmail.com>
Wed, 15 Sep 2010 11:07:11 +0000 (13:07 +0200)
committerAlex Hornung <ahornung@gmail.com>
Wed, 15 Sep 2010 11:44:30 +0000 (13:44 +0200)
* Allow a foo_name apart from foo_load and foo_type to specify the
  actual file name (module name) to load.

* This fixes the acpi dsdt overrides.

Reported-by: Sascha Wildner (swildner@)
sys/boot/dloader/cmds.c

index 0124a44..4e8eebf 100644 (file)
@@ -195,6 +195,7 @@ command_loadall(int ac, char **av)
 {
        char *argv[4];
        char *mod_name;
+       char *mod_fname;
        char *mod_type;
        char *tmp_str;
        dvar_t dvar, dvar2;
@@ -236,6 +237,7 @@ command_loadall(int ac, char **av)
                mod_name = strdup(dvar->name);
                mod_name[len - 5] = 0;
                mod_type = NULL;
+               mod_fname = NULL;
 
                /* Check if there's a matching foo_type */
                for (dvar2 = dvar_first();
@@ -252,6 +254,24 @@ command_loadall(int ac, char **av)
                        free(tmp_str);
                }
 
+               /* Check if there's a matching foo_name */
+               for (dvar2 = dvar_first();
+                    dvar2 && (mod_fname == NULL);
+                    dvar2 = dvar_next(dvar2)) {
+                       len = strlen(dvar2->name);
+                       if (len <= 5 || strcmp(dvar2->name + len - 5, "_name"))
+                               continue;
+                       tmp_str = strdup(dvar2->name);
+                       tmp_str[len - 5] = 0;
+                       if (strcmp(tmp_str, mod_name) == 0) {
+                               mod_fname = dvar2->data[0];
+                               free(mod_name);
+                               mod_name = strdup(mod_fname);
+                       }
+
+                       free(tmp_str);
+               }
+
                argv[0] = "load";
                if (mod_type) {
                        argc = 4;