From c036890165fa1be9f90dd3f6a33b68a71d887ce1 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Fri, 5 Nov 1999 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 1999-11-05 --- pc/vgat2r4.c | 8 +++ port/chan.c | 12 ---- port/devmnt.c | 179 ------------------------------------------------- port/devproc.c | 2 - port/devroot.c | 68 +------------------ port/devsrv.c | 18 ----- port/error.h | 1 - port/lib.h | 1 - port/portdat.h | 7 +- port/portfns.h | 3 - port/sysfile.c | 2 +- 11 files changed, 13 insertions(+), 288 deletions(-) diff --git a/pc/vgat2r4.c b/pc/vgat2r4.c index 21ba69226c6d9f61f664f831aaa1d4aacea471fb..74cfd19523e0c8fb0fa2af660fdf63393518e357 100644 --- a/pc/vgat2r4.c +++ b/pc/vgat2r4.c @@ -328,6 +328,13 @@ t2r4curenable(VGAscr* scr) t2r4xo(scr, CursorCtl, CursorMode); } +static void +t2r4drawinit(VGAscr *scr) +{ + scr->fill = nil; + scr->scroll = nil; +} + VGAdev vgat2r4dev = { "t2r4", @@ -335,6 +342,7 @@ VGAdev vgat2r4dev = { nil, nil, t2r4linear, + t2r4drawinit, }; VGAcur vgat2r4cur = { diff --git a/port/chan.c b/port/chan.c index 1c54b323d10739b7d16cc25a0716bec414a77eaf..398bd2e8260f87f4bff3f28139128f0205f02f1f 100644 --- a/port/chan.c +++ b/port/chan.c @@ -46,18 +46,6 @@ decref(Ref *r) return x; } -void -chanrec(Mnt *m) -{ - Chan *c; - - lock(&chanalloc); - for(c = chanalloc.list; c; c = c->link) - if(c->mntptr == m) - c->flag |= CRECOV; - unlock(&chanalloc); -} - void chandevreset(void) { diff --git a/port/devmnt.c b/port/devmnt.c index d2a220391f3a5051b53704f64d15a25ae794cb30..a2865ba53d06af85729f1617f8a4d0ddc827718f 100644 --- a/port/devmnt.c +++ b/port/devmnt.c @@ -55,7 +55,6 @@ void mountmux(Mnt*, Mntrpc*); void mountrpc(Mnt*, Mntrpc*); int rpcattn(void*); void mclose(Mnt*, Chan*); -void mntrecover(Mnt*, Mntrpc*); Chan* mntchan(void); int defmaxmsg = MAXFDATA; @@ -621,13 +620,7 @@ mountrpc(Mnt *m, Mntrpc *r) r->reply.tag = 0; r->reply.type = 4; - while(waserror()) { - if((m->flags&MRECOV) == 0) - nexterror(); - mntrecover(m, r); - } mountio(m, r); - poperror(); t = r->reply.type; switch(t) { @@ -898,62 +891,6 @@ mntqrm(Mnt *m, Mntrpc *r) unlock(m); } -void -recoverchan(Mnt*, Chan*) -{ -panic("recoverchan"); -#ifdef asdf -BUG: WON'T WORK WITH PATHS GONE? - int i, n, flg; - Path *safe, *p, **pav; - - if(m->c == 0) - error(Eshutdown); - - flg = c->flag; - /* Don't recursively recover */ - c->flag &= ~(COPEN|CRECOV); - - n = 0; - for(p = c->path; p; p = p->parent) - n++; - pav = smalloc(sizeof(Path*)*n); - i = n; - for(p = c->path; p; p = p->parent) - pav[--i] = p; - - safe = c->path; - - if(waserror()) { - c->flag = flg; - free(pav); - nexterror(); - } - - /* Attach the fid onto the file server (sets c->path to #Mxxx) */ - mattach(m, c, c->xmh->mount->spec); - poperror(); - - /* - * c is now at the root so we free where - * the chan was before the server connection was lost - */ - decref(safe); - - for(i = 1; i < n; i++) { - if(mntwalk(c, pav[i]->elem) == 0) { - free(pav); - /* Shut down the channel */ - c->dev = m->id-1; - error(Erecover); - } - } - free(pav); - if(flg&COPEN) - mntopen(c, c->mode); -#endif -} - Mnt* mntchk(Chan *c) { @@ -967,12 +904,6 @@ mntchk(Chan *c) if(m->id == 0 || m->id >= c->dev) error(Eshutdown); - /* - * Try and get the channel back after a crash - */ - if((c->flag&CRECOV) && m->recprog == 0) - recoverchan(m, c); - return m; } @@ -997,116 +928,6 @@ rpcattn(void *v) return r->done || r->m->rip == 0; } -int -recdone(void *v) -{ - Mnt *m; - - m = v; - return m->recprog == 0; -} - -void -mntrecdel(Mnt *m, Mntrpc *r) -{ - Mntrpc *f, **l; - - lock(m); - l = &m->recwait; - for(f = *l; f; f = f->list) { - if(f == r) { - *l = r->list; - break; - } - } - unlock(m); -} - -void -mntrecover(Mnt *m, Mntrpc *r) -{ - char *ps; - - lock(m); - if(m->recprog == 0) { - m->recprog = 1; - unlock(m); - chanrec(m); - /* - * Send a message to boot via #/recover - */ -panic("mntrecover\n"); -// rootrecover(m->c->path, m->tree.root->elem); - lock(m); - } - r->list = m->recwait; - m->recwait = r; - unlock(m); - - pprint("lost server connection, wait...\n"); - - ps = up->psstate; - up->psstate = "Recover"; - - if(waserror()) { - up->psstate = ps; - mntrecdel(m, r); - nexterror(); - } - sleep(&r->r, recdone, m); - poperror(); - - r->done = 0; - mntrecdel(m, r); - if(r->c != 0) - recoverchan(m, r->c); - - up->psstate = ps; -} - -void -mntrepl(char*) -{ -panic("mntrepl"); -#ifdef asdf - int fd; - Mnt *m; - char *p; - Chan *c1, *c2; - Mntrpc *r; - - /* reply from boot is 'fd #M23' */ - fd = strtoul(buf, &p, 0); - - p++; - lock(&mntalloc); - for(m = mntalloc.list; m; m = m->list) { - if(strcmp(p, m->tree.root->elem) == 0) - break; - } - unlock(&mntalloc); - if(m == 0) - error(Eunmount); - - c1 = fdtochan(fd, ORDWR, 0, 1); /* error check and inc ref */ - - /* If the channel was posted fix it up */ - srvrecover(m->c, c1); - - lock(m); - c2 = m->c; - m->c = c1; - m->recprog = 0; - - /* Wakeup partially complete rpc */ - for(r = m->recwait; r; r = r->list) - wakeup(&r->r); - - unlock(m); - cclose(c2); -#endif -} - Dev mntdevtab = { 'M', "mnt", diff --git a/port/devproc.c b/port/devproc.c index e5d00a5222a42a8e7f07ab016e2e6167f5868998..11fc17dc8edb21acdae05da724005f6eef5d357c 100644 --- a/port/devproc.c +++ b/port/devproc.c @@ -341,8 +341,6 @@ int2flag(int flag, char *s) *s++ = 'c'; if(flag & MCACHE) *s++ = 'C'; - if(flag & MRECOV) - *s++ = 'r'; *s = '\0'; } diff --git a/port/devroot.c b/port/devroot.c index dd299f09b5749fb2cdc7d76220f06efba897d2f1..b04d6cbf09d4fa32e5fe766008b8bf06a29c7adc 100644 --- a/port/devroot.c +++ b/port/devroot.c @@ -7,7 +7,6 @@ enum{ Qdir= 0, - Qrecover, Nfiles=32, /* max root files */ }; @@ -15,14 +14,10 @@ enum{ extern ulong bootlen; extern uchar bootcode[]; -Dirtab rootdir[Nfiles]= -{ - "recover", {Qrecover}, 0, 0777, -}; +Dirtab rootdir[Nfiles]; static uchar *rootdata[Nfiles]; -static int nroot = 1; -static int recovbusy; +static int nroot = 0; typedef struct Recover Recover; struct Recover @@ -125,13 +120,6 @@ rootopen(Chan *c, int omode) switch(c->qid.path & ~CHDIR) { default: break; - case Qrecover: - if(recovbusy) - error(Einuse); - if(strcmp(up->user, eve) != 0) - error(Eperm); - recovbusy = 1; - break; } return devopen(c, omode, rootdir, nroot, devgen); @@ -146,10 +134,6 @@ rootclose(Chan *c) switch(c->qid.path) { default: break; - case Qrecover: - if(c->flag&COPEN) - recovbusy = 0; - break; } } @@ -172,29 +156,6 @@ rootread(Chan *c, void *buf, long n, vlong off) switch(t){ case Qdir: return devdirread(c, buf, n, rootdir, nroot, devgen); - case Qrecover: - qlock(&reclist); - if(waserror()) { - qunlock(&reclist); - nexterror(); - } - - sleep(&reclist, rdrdy, 0); - - lock(&reclist); - r = reclist.q; - reclist.q = r->next; - unlock(&reclist); - - qunlock(&reclist); - - poperror(); - if(n < r->len) - n = r->len; - memmove(buf, r->req, n); - free(r->req); - free(r); - return n; } d = &rootdir[t-1]; @@ -210,19 +171,9 @@ rootread(Chan *c, void *buf, long n, vlong off) static long rootwrite(Chan *c, void *buf, long n, vlong) { - char tmp[256]; - switch(c->qid.path & ~CHDIR){ default: error(Egreg); - case Qrecover: - if(n > sizeof(tmp)-1) - error(Etoosmall); - /* Nul terminate */ - memmove(tmp, buf, n); - tmp[n] = '\0'; - mntrepl(tmp); - return n; } return 0; } @@ -258,18 +209,3 @@ Dev rootdevtab = { devremove, devwstat, }; - -void -rootrecover(Chan *c, char *mntname) -{ - Recover *r; - - r = malloc(sizeof(Recover)); - r->req = smalloc(c->name->len+strlen(mntname)+2); - sprint(r->req, "%s %s", c->name->s, mntname); - lock(&reclist); - r->next = reclist.q; - reclist.q = r; - unlock(&reclist); - wakeup(&reclist); -} diff --git a/port/devsrv.c b/port/devsrv.c index aac2072100ba4f5ffa317885011d7dd11cf82240..9987202fe5964863f9f952128bcce8a8bf38d3eb 100644 --- a/port/devsrv.c +++ b/port/devsrv.c @@ -305,21 +305,3 @@ Dev srvdevtab = { srvremove, srvwstat, }; - -void -srvrecover(Chan *old, Chan *new) -{ - Srv *sp; - - qlock(&srvlk); - for(sp = srv; sp; sp = sp->link) { - if(sp->chan == old) { - sp->chan = new; - incref(new); - qunlock(&srvlk); - cclose(old); - return; - } - } - qunlock(&srvlk); -} diff --git a/port/error.h b/port/error.h index 86056e05ae4b72b7c11f7eba2ae632fc47ecee53..0e69e1428146cc7b881a70ec68b340f917cc10e9 100644 --- a/port/error.h +++ b/port/error.h @@ -51,7 +51,6 @@ extern char Enoswap[]; /* swap space full */ extern char Esfnotcached[]; /* subfont not cached */ extern char Esoverlap[]; /* segments overlap */ extern char Emouseset[]; /* mouse type already set */ -extern char Erecover[]; /* failed to recover fd */ extern char Eshort[]; /* i/o count too small */ extern char Egreg[]; /* xterm: Error 50, errno 1: Too big */ extern char Ebadspec[]; /* bad attach specifier */ diff --git a/port/lib.h b/port/lib.h index 6a277865b896c8724be35a38d11f23258eb4b7d7..d4b8d027a91ca04b597eee979d46402487d99b67 100644 --- a/port/lib.h +++ b/port/lib.h @@ -86,7 +86,6 @@ extern char end[]; #define MBEFORE 0x0001 /* mount goes before others in union directory */ #define MAFTER 0x0002 /* mount goes after others in union directory */ #define MCREATE 0x0004 /* permit creation in mounted directory */ -#define MRECOV 0x0008 /* perform recovery if mount channel is lost */ #define MCACHE 0x0010 /* cache some data */ #define MMASK 0x001F /* all bits on */ diff --git a/port/portdat.h b/port/portdat.h index 56aee143f5e2ca68eabda0d9a076b48fb309fd51..0921b97966758e4c38b4896057ac3230cec3708d 100644 --- a/port/portdat.h +++ b/port/portdat.h @@ -109,7 +109,6 @@ enum CCEXEC = 0x0008, /* close on exec */ CFREE = 0x0010, /* not in use */ CRCLOSE = 0x0020, /* remove on close */ - CRECOV = 0x0040, /* requires recovery */ CCACHE = 0x0080, /* client cache */ }; @@ -243,11 +242,9 @@ struct Mnt Chan *c; /* Channel to file service */ Proc *rip; /* Reader in progress */ Mntrpc *queue; /* Queue of pending requests on this channel */ - Mntrpc *recwait; /* List of rpc's with recovery pending */ - ulong id; /* Multiplexor id for channel check */ + ulong id; /* Multiplexer id for channel check */ Mnt *list; /* Free list */ - int flags; /* recover/cache */ - char recprog; /* Recovery in progress */ + int flags; /* cache */ int blocksize; /* read/write block size */ ushort flushtag; /* Tag to send flush on */ ushort flushbase; /* Base tag of flush window for this buffer */ diff --git a/port/portfns.h b/port/portfns.h index 5e11f1842020c8c9247e215590d060bdab960437..6c291a81fcdbbc2f12640b6bc84a65b34e48b3c2 100644 --- a/port/portfns.h +++ b/port/portfns.h @@ -166,7 +166,6 @@ void mmurelease(Proc*); void mmuswitch(Proc*); void mntdump(void); long mntread9p(Chan*, void*, long, vlong); -void mntrepl(char*); long mntwrite9p(Chan*, void*, long, vlong); void mountfree(Mount*); ulong msize(void*); @@ -265,7 +264,6 @@ void resetscsi(void); void resrcwait(char*); int return0(void*); void rlock(RWlock*); -void rootrecover(Chan*, char*); void rootreq(Chan*, Mnt*); long rtctime(void); void runlock(RWlock*); @@ -308,7 +306,6 @@ int splhi(void); int spllo(void); void splx(int); void splxpc(int); -void srvrecover(Chan*, Chan*); char* srvname(Chan*); int swapcount(ulong); int swapfull(void); diff --git a/port/sysfile.c b/port/sysfile.c index c5fbed71bea2bf49a138c392358090f7ee57f195..d905c64ed71b9ededa34883eb75150225b31a4b9 100644 --- a/port/sysfile.c +++ b/port/sysfile.c @@ -607,7 +607,7 @@ bindmount(ulong *arg, int ismount) if(flag>MMASK || (flag&MORDER)==(MBEFORE|MAFTER)) error(Ebadarg); - bogus.flags = flag & (MRECOV|MCACHE); + bogus.flags = flag & MCACHE; if(ismount){ bc = fdtochan(fd, ORDWR, 0, 1);