| plan 9 kernel history: overview | file list | diff list |
1993/0724/port/devroot.c (diff list | history)
| 1993/0501/sys/src/9/port/devroot.c:6,14 – 1993/0724/sys/src/9/port/devroot.c:6,13 (short | long | prev | next) | ||
| 1992/0111 | #include "../port/error.h" | |
| 1990/0227 | #include "devtab.h" | |
| 1993/0501 |
| |
| 1990/0227 |
| |
| 1993/0724 | enum{ Qdir= 0, | |
| 1990/0227 | Qbin, Qdev, Qenv, | |
| 1993/0501/sys/src/9/port/devroot.c:15,50 – 1993/0724/sys/src/9/port/devroot.c:14,39 | ||
| 1990/0227 | Qproc, | |
| 1992/0213 | Qnet, | |
| 1993/0501 | Qrecover, | |
| 1993/0724 | Qboot, /* readable files */ | |
| 1991/1206 |
| |
| 1992/0902 |
| |
| 1993/0724 | Nfiles=13, /* max root files */ | |
| 1990/0227 | }; | |
| 1991/0214 |
| |
| 1991/0216 |
| |
| 1992/0902 |
| |
| 1991/1206 | extern ulong bootlen; | |
| 1992/0902 | extern uchar bootcode[]; | |
| 1991/0214 | ||
| 1990/0227 |
| |
| 1991/1112 |
| |
| 1992/0213 |
| |
| 1993/0501 |
| |
| 1993/0724 | Dirtab rootdir[Nfiles]={ "bin", {Qbin|CHDIR}, 0, 0777, "dev", {Qdev|CHDIR}, 0, 0777, "env", {Qenv|CHDIR}, 0, 0777, "proc", {Qproc|CHDIR}, 0, 0777, "net", {Qnet|CHDIR}, 0, 0777, "recover", {Qrecover}, 0, 0777, | |
| 1990/0227 | }; | |
| 1991/0615 |
| |
| 1991/1112 |
| |
| 1992/0902 |
| |
| 1991/0615 |
| |
| 1991/0214 |
| |
| 1990/0227 | ||
| 1993/0724 | static uchar *rootdata[Nfiles]; static int nroot = Qboot - 1; | |
| 1993/0501 | typedef struct Recover Recover; struct Recover { | |
| 1993/0501/sys/src/9/port/devroot.c:61,94 – 1993/0724/sys/src/9/port/devroot.c:50,79 | ||
| 1993/0501 | Recover *q; }reclist; | |
| 1991/0615 |
| |
| 1993/0724 | /* * add a root file */ void addrootfile(char *name, uchar *contents, ulong len) | |
| 1991/0615 | { | |
| 1992/0711 |
| |
| 1993/0724 | Dirtab *d; | |
| 1992/0711 | ||
| 1992/0225 |
| |
| 1991/0615 |
| |
| 1992/0225 | ||
| 1991/0615 |
| |
| 1992/0225 |
| |
| 1991/0615 |
| |
| 1992/0225 | ||
| 1991/1109 |
| |
| 1991/0615 |
| |
| 1993/0724 | if(nroot >= Nfiles) panic("too many root files"); rootdata[nroot] = contents; d = &rootdir[nroot]; strcpy(d->name, name); d->length = len; d->perm = 0555; d->qid.path = nroot+1; nroot++; | |
| 1991/0615 | } | |
| 1990/0227 | void rootreset(void) { | |
| 1991/0615 |
| |
| 1992/0902 |
| |
| 1991/0913 |
| |
| 1991/0615 |
| |
| 1993/0724 | addrootfile("boot", bootcode, bootlen); /* always have a boot file */ | |
| 1990/0227 | } void | |
| 1993/0501/sys/src/9/port/devroot.c:117,129 – 1993/0724/sys/src/9/port/devroot.c:102,114 | ||
| 1991/1206 | } | |
| 1992/0225 | if((c->qid.path & ~CHDIR) != Qdir) | |
| 1992/0226 | return 0; | |
| 1991/0615 |
| |
| 1993/0724 | return devwalk(c, name, rootdir, nroot, devgen); | |
| 1990/0227 | } void rootstat(Chan *c, char *dp) { | |
| 1991/0615 |
| |
| 1993/0724 | devstat(c, dp, rootdir, nroot, devgen); | |
| 1990/0227 | } Chan* | |
| 1993/0501/sys/src/9/port/devroot.c:138,144 – 1993/0724/sys/src/9/port/devroot.c:123,129 | ||
| 1993/0501 | break; } | |
| 1991/0615 |
| |
| 1993/0724 | return devopen(c, omode, rootdir, nroot, devgen); | |
| 1990/0227 | } void | |
| 1993/0501/sys/src/9/port/devroot.c:167,202 – 1993/0724/sys/src/9/port/devroot.c:152,166 | ||
| 1990/0227 | long | |
| 1991/0411 | rootread(Chan *c, void *buf, long n, ulong offset) | |
| 1990/0227 | { | |
| 1993/0724 | ulong t; Dirtab *d; uchar *data; | |
| 1993/0501 | Recover *r; | |
| 1990/0227 | ||
| 1990/11211 |
| |
| 1993/0724 | t = c->qid.path & ~CHDIR; switch(t){ | |
| 1990/0227 | case Qdir: | |
| 1991/0615 |
| |
| 1990/0227 |
| |
| 1991/1206 |
| |
| 1990/0227 |
| |
| 1991/1206 |
| |
| 1992/0902 |
| |
| 1991/0214 |
| |
| 1991/0312 |
| |
| 1991/0411 |
| |
| 1991/0214 |
| |
| 1991/0411 |
| |
| 1991/0910 |
| |
| 1992/0902 |
| |
| 1991/0910 |
| |
| 1992/0902 |
| |
| 1990/0227 |
| |
| 1993/0724 | return devdirread(c, buf, n, rootdir, nroot, devgen); | |
| 1993/0501 | case Qrecover: qlock(&reclist); if(waserror()) { | |
| 1993/0501/sys/src/9/port/devroot.c:220,230 – 1993/0724/sys/src/9/port/devroot.c:184,202 | ||
| 1993/0501 | free(r->req); free(r); return n; | |
| 1993/0724 | } | |
| 1993/0501 | ||
| 1990/0227 |
| |
| 1993/0724 | if(t < Qboot) | |
| 1990/0227 | return 0; | |
| 1993/0724 | d = &rootdir[t-1]; data = rootdata[t-1]; if(offset >= d->length) return 0; if(offset+n > d->length) n = d->length - offset; memmove(buf, data+offset, n); return n; | |
| 1990/0227 | } long | |