]> git.ozlabs.org Git - yaboot.git/commitdiff
User-specified config file on Yaboot's prompt
authorPaul Nasrat <pnasrat@redhat.com>
Tue, 15 May 2007 13:14:43 +0000 (14:14 +0100)
committerPaul Nasrat <pauln@enki.eridu>
Tue, 15 May 2007 13:14:43 +0000 (14:14 +0100)
This patch clears out the kernel image list before loading a new config file.
Leonardo Rangel lrangel at linux.vnet.ibm.com

second/cfg.c

index 56b058af5ecde651e6ccf265d00a8802e264e94d..d7f4084abb6b8e0d2e716873fda7510760f82ed2 100644 (file)
@@ -422,6 +422,30 @@ cfg_set_redo:
      return 0;
 }
 
      return 0;
 }
 
+static int cfg_reset ()
+{
+    CONFIG *walk;
+#if DEBUG
+    prom_printf("Resetting image table\n");
+#endif
+    line_num = 0;
+    images = NULL;
+    curr_table = NULL;
+    curr_table = cf_options;
+    for (walk = curr_table; walk->type != cft_end; walk++) {
+#if DEBUG
+        prom_printf("ItemA %s = %s\n", walk->name, walk->data);
+#endif
+        if (walk->data != NULL)
+            walk->data = NULL;
+#if DEBUG
+        prom_printf("ItemB %s = %s\n\n", walk->name, walk->data);
+#endif
+    }
+
+    return 0;
+}
+
 int cfg_parse (char *cfg_file, char *buff, int len)
 {
      char *item, *value;
 int cfg_parse (char *cfg_file, char *buff, int len)
 {
      char *item, *value;
@@ -430,6 +454,8 @@ int cfg_parse (char *cfg_file, char *buff, int len)
      currp = buff;
      endp = currp + len;
 
      currp = buff;
      endp = currp + len;
 
+     cfg_reset();
+
      if (setjmp (env))
          return -1;
      while (1) {
      if (setjmp (env))
          return -1;
      while (1) {