From 53ed9104284c7ad05b10d65d11455b30b31502f7 Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sat, 29 Mar 2003 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2003-03-29 --- port/dev.c | 6 +++++- port/devroot.c | 11 +++++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/port/dev.c b/port/dev.c index f585acc0484a7617b723e335f390e7c9d9f47e27..26549a061cad1a0271951258c8d833d59227b764 100644 --- a/port/dev.c +++ b/port/dev.c @@ -203,7 +203,11 @@ devwalk(Chan *c, Chan *nc, char **name, int nname, Dirtab *tab, int ntab, Devgen continue; } if(strcmp(n, "..") == 0){ - (*gen)(nc, nil, tab, ntab, DEVDOTDOT, &dir); + if((*gen)(nc, nil, tab, ntab, DEVDOTDOT, &dir) != 1){ + print("devgen walk .. in dev%s %llux broken\n", + devtab[nc->type]->name, nc->qid.path); + error("broken devgen"); + } nc->qid = dir.qid; goto Accept; } diff --git a/port/devroot.c b/port/devroot.c index 20799edd62a9720db8ea1f33ef2dd80fe4135a60..e7bef3c194eca3edeca5fd54df98f0462418c082 100644 --- a/port/devroot.c +++ b/port/devroot.c @@ -133,6 +133,13 @@ rootgen(Chan *c, char *name, Dirtab*, int, int s, Dir *dp) } return devgen(c, name, bootlist.dir, bootlist.ndir, s, dp); default: + if(s == DEVDOTDOT){ + if((int)c->qid.path < Qboot) + devdir(c, (Qid){Qdir, 0, QTDIR}, "#/", 0, eve, 0555, dp); + else + devdir(c, (Qid){Qboot, 0, QTDIR}, "#/", 0, eve, 0555, dp); + return 1; + } if(s != 0) return -1; if((int)c->qid.path < Qboot){ @@ -144,6 +151,10 @@ rootgen(Chan *c, char *name, Dirtab*, int, int s, Dir *dp) } if(t >= l->ndir) return -1; +if(t < 0){ +print("rootgen %llud %d %d\n", c->qid.path, s, t); +panic("whoops"); +} d = &l->dir[t]; devdir(c, d->qid, d->name, d->length, eve, d->perm, dp); return 1;