Breakup boot_setup() bootorder code into its own function.
authorKevin O'Connor <kevin@koconnor.net>
Fri, 24 Dec 2010 16:17:03 +0000 (11:17 -0500)
committerKevin O'Connor <kevin@koconnor.net>
Fri, 24 Dec 2010 16:17:03 +0000 (11:17 -0500)
src/boot.c

index 4fb73ac9261dbf6bfb70e07527ed6645631fcb8b..5137345a418b7e5ff80e520e03ab4e64af72ef52 100644 (file)
@@ -18,9 +18,44 @@ struct ipl_s IPL;
 
 
 /****************************************************************
- * IPL and BCV handlers
+ * Boot setup
  ****************************************************************/
 
+static void
+loadBootOrder(void)
+{
+    char *f = romfile_loadfile("bootorder", NULL);
+    if (!f)
+        return;
+
+    int i;
+    IPL.fw_bootorder_count = 1;
+    while (f[i]) {
+        if (f[i] == '\n')
+            IPL.fw_bootorder_count++;
+        i++;
+    }
+    IPL.fw_bootorder = malloc_tmphigh(IPL.fw_bootorder_count*sizeof(char*));
+    if (!IPL.fw_bootorder) {
+        warn_noalloc();
+        free(f);
+        return;
+    }
+
+    dprintf(3, "boot order:\n");
+    i = 0;
+    do {
+        IPL.fw_bootorder[i] = f;
+        f = strchr(f, '\n');
+        if (f) {
+            *f = '\0';
+            f++;
+            dprintf(3, "%d: %s\n", i, IPL.fw_bootorder[i]);
+            i++;
+        }
+    } while(f);
+}
+
 void
 boot_setup(void)
 {
@@ -68,37 +103,13 @@ boot_setup(void)
             IPL.checkfloppysig = 1;
     }
 
-    char *f = romfile_loadfile("bootorder", NULL);
-    if (!f)
-        return;
+    loadBootOrder();
+}
 
-    int i;
-    IPL.fw_bootorder_count = 1;
-    while(f[i]) {
-        if (f[i] == '\n')
-            IPL.fw_bootorder_count++;
-        i++;
-    }
-    IPL.fw_bootorder = malloc_tmphigh(IPL.fw_bootorder_count*sizeof(char*));
-    if (!IPL.fw_bootorder) {
-        warn_noalloc();
-        free(f);
-        return;
-    }
 
-    dprintf(3, "boot order:\n");
-    i = 0;
-    do {
-        IPL.fw_bootorder[i] = f;
-        f = strchr(f, '\n');
-        if (f) {
-            *f = '\0';
-            f++;
-            dprintf(3, "%d: %s\n", i, IPL.fw_bootorder[i]);
-            i++;
-        }
-    } while(f);
-}
+/****************************************************************
+ * IPL and BCV handlers
+ ****************************************************************/
 
 // Add a BEV vector for a given pnp compatible option rom.
 void