]> git.ozlabs.org Git - yaboot.git/blobdiff - second/cfg.c
print available ranges under control of linux, yaboot-debug property
[yaboot.git] / second / cfg.c
index d7f4084abb6b8e0d2e716873fda7510760f82ed2..381d16b349175927e945608884d8d9fa8d865d5e 100644 (file)
@@ -41,8 +41,7 @@ typedef struct {
      void *data;
 } CONFIG;
 
-#define MAX_TOKEN 200
-#define MAX_VAR_NAME MAX_TOKEN
+#define MAX_TOKEN 511
 #define EOF -1
 
 CONFIG cf_options[] =
@@ -92,7 +91,6 @@ CONFIG cf_image[] =
      {cft_flag, "pause-after", NULL},
      {cft_strg, "pause-message", NULL},
      {cft_flag, "novideo", NULL},
-     {cft_strg, "sysmap", NULL},
      {cft_end, NULL, NULL}};
 
 static char flag_set;
@@ -103,7 +101,6 @@ static char *currp = NULL;
 static char *endp = NULL;
 static char *file_name = NULL;
 static CONFIG *curr_table = cf_options;
-static int ignore_entry;
 static jmp_buf env;
 
 static struct IMAGES {
@@ -585,6 +582,43 @@ char *cfg_get_default (void)
      return ret;
 }
 
+/*
+ * cfg_set_default_by_mac ()
+ * return 1 if the default cf_option was changed to label with the MAC addr
+ * return 0 if not changed
+ */
+int cfg_set_default_by_mac (char *mac_addr)
+{
+     CONFIG *walk;
+     struct IMAGES *tmp;
+     char * label = NULL;
+     int haslabel = 0;
+
+     /* check if there is an image label equal to mac_addr */
+     for (tmp = images; tmp; tmp = tmp->next) {
+        label = cfg_get_strg_i (tmp->table, "label");
+        if (!strcmp(label,mac_addr)){
+            haslabel = 1;
+        }
+     }
+
+     if (!haslabel)
+         return 0;
+     else {
+         /*
+          * if there is an image label equal to mac_addr, change the default
+          * cf_options to this image label
+          */
+         for (walk = cf_options; walk->type != cft_end; walk++) {
+             if (!strcasecmp(walk->name,"default")) {
+                 walk->data = mac_addr;
+                 return 1;
+             }
+         }
+         return 0;
+     }
+}
+
 /*
  * Local variables:
  * c-file-style: "k&r"