/* * assumes that we have loaded our /cfg/pxe/mac file at 0x1000 with * tftp in u-boot. no longer uses malloc, so can be called early. */ static void plan9iniinit(void) { char *k, *v, *next; k = (char *)CONFADDR; if(!isascii(*k)) return; for(; k && *k != '\0'; k = next) { if (!isascii(*k)) /* sanity check */ break; next = strchr(k, '\n'); if (next) *next++ = '\0'; if (*k == '\0' || *k == '\n' || *k == '#') continue; v = strchr(k, '='); if(v == nil) continue; /* mal-formed line */ *v++ = '\0'; addconf(k, v); } }
/* * Leave partitions around for devsd to pick up. * (Needed by boot process; more extensive * partitioning is done by termrc or cpurc). */ void sdaddconf(int i) { SDunit *unit; SDpart *pp; unit = sdindex2unit(i); /* * If there were no partitions (just data and partition), don't bother. */ if(unit->npart<= 1 || (unit->npart==2 && strcmp(unit->part[1].name, "partition")==0)) return; addconf("%spart=", unit->name); for(i=1, pp=&unit->part[i]; i<unit->npart; i++, pp++) /* skip 0, which is "data" */ addconf("%s%s %lld %lld", i==1 ? "" : "/", pp->name, pp->start, pp->end); addconf("\n"); }
static void plan9iniinit(char *s, int cmdline) { char *toks[MAXCONF]; int i, c, n; char *v; if((c = *s) < ' ' || c >= 0x80) return; if(cmdline) n = tokenize(s, toks, MAXCONF); else n = getfields(s, toks, MAXCONF, 1, "\n"); for(i = 0; i < n; i++){ if(toks[i][0] == '#') continue; v = strchr(toks[i], '='); if(v == nil) continue; *v++ = '\0'; addconf(toks[i], v); } }
static void addmainconf(const char *name, void (*function)(char *)) { confs=addconf(confs,name,function) ; }