| plan 9 kernel history: overview | file list | diff list |
1994/0312/boot/local.c (diff list | history)
| boot/local.c on 1992/0317 | ||
| 1992/0317 | #include <u.h> #include <libc.h> #include <../boot/boot.h> | |
| 1994/0312 | static char diskname[2*NAMELEN]; | |
| 1992/0317 | static char *disk; | |
| 1993/0403 | static char *niob; | |
| 1992/0317 | void configlocal(Method *mp) { | |
| 1994/0312 | char *p; int n; disk = mp->arg; /* 1st try from config file */ if(disk && (niob = strchr(disk, ' '))) /* assign = */ *niob++ = 0; if(strncmp(argv0, "dksc(0,", 7) == 0){ p = strchr(argv0, ','); n = strtoul(p+1, 0, 10); sprint(diskname, "#w%d/sd%dfs", n, n); disk = diskname; /*print("argv0=\"%s\" --> disk = \"%s\"\n", argv0, disk);/**/ } | |
| 1992/0826 | if(*sys == '/' || *sys == '#') disk = sys; | |
| 1994/0312 | if(disk) setenv("bootdisk", disk); | |
| 1992/0317 | USED(mp); } int authlocal(void) { return -1; } int connectlocal(void) { int p[2]; char d[DIRLEN]; char partition[2*NAMELEN]; | |
| 1992/0902 | char *dev; | |
| 1993/0403 | char *args[16], **argp; | |
| 1992/0317 | ||
| 1992/0902 | if(stat("/fs", d) < 0) | |
| 1992/0317 | return -1; | |
| 1992/0902 | dev = disk ? disk : bootdisk; sprint(partition, "%sfs", dev); if(stat(partition, d) < 0){ strcpy(partition, dev); if(stat(partition, d) < 0) return -1; } print("fs..."); | |
| 1992/0317 | if(bind("#c", "/dev", MREPL) < 0) fatal("bind #c"); if(bind("#p", "/proc", MREPL) < 0) fatal("bind #p"); if(pipe(p)<0) fatal("pipe"); switch(fork()){ case -1: fatal("fork"); case 0: | |
| 1992/0902 | dup(p[0], 0); dup(p[1], 1); close(p[0]); close(p[1]); | |
| 1993/0403 | argp = args; *argp++ = "fs"; if(niob){ *argp++ = "-B"; *argp++ = niob; } *argp++ = "-f"; *argp++ = partition; *argp++ = "-s"; *argp = 0; exec("/fs", args); | |
| 1992/0902 | fatal("can't exec fs"); | |
| 1992/0317 | default: break; } close(p[1]); return p[0]; } | |