From 9af584b5250e67128ba0300846948516e4022fbd Mon Sep 17 00:00:00 2001 From: David du Colombier <0intro@gmail.com> Date: Sun, 22 Dec 2002 00:00:00 +0000 Subject: [PATCH] Plan 9 from Bell Labs 2002-12-22 --- port/dev.c | 31 +++++++++++++++++++++++++++++++ port/sysproc.c | 3 +++ 2 files changed, 34 insertions(+) diff --git a/port/dev.c b/port/dev.c index 3fda0aad34ea256bcbe7e6823a652c7ba56b0560..0fb920300b71c19d99b62a4596d62d2b3d4c4a44 100644 --- a/port/dev.c +++ b/port/dev.c @@ -49,9 +49,40 @@ devdir(Chan *c, Qid qid, char *n, vlong length, char *user, long perm, Dir *db) db->muid = user; } +/* + * (here, Devgen is the prototype; devgen is the function in dev.c.) + * + * a Devgen is expected to return the directory entry for ".." + * if you pass it s==DEVDOTDOT (-1). otherwise... + * + * there are two contradictory rules. + * + * (i) if c is a directory, a Devgen is expected to list its children + * as you iterate s. + * + * (ii) whether or not c is a directory, a Devgen is expected to list + * its siblings as you iterate s. + * + * devgen always returns the list of children in the root + * directory. thus it follows (i) when c is the root and (ii) otherwise. + * many other Devgens follow (i) when c is a directory and (ii) otherwise. + * + * devwalk assumes (i). it knows that devgen breaks (i) + * for children that are themselves directories, and explicitly catches them. + * + * devstat assumes (ii). if the Devgen in question follows (i) + * for this particular c, devstat will not find the necessary info. + * with our particular Devgen functions, this happens only for + * directories, so devstat makes something up, assuming + * c->name, c->qid, eve, DMDIR|0555. + * + * devdirread assumes (i). the callers have to make sure + * that the Devgen satisfies (i) for the chan being read. + */ /* * the zeroth element of the table MUST be the directory itself for .. */ +int devdebug; int devgen(Chan *c, char*, Dirtab *tab, int ntab, int i, Dir *dp) { diff --git a/port/sysproc.c b/port/sysproc.c index c23d205790aa7e547b9cd81db81a0b5887efc50c..1a4fd455cc997037ec3239ea5bb1329cefe20d78 100644 --- a/port/sysproc.c +++ b/port/sysproc.c @@ -16,6 +16,9 @@ sysr1(ulong *arg) { long a; +extern int devdebug; +devdebug = !devdebug; + a = *arg; if(a > 0) return incref(&sysr1ref);