~kris/9p

9hist

9af584b5250e67128ba0300846948516e4022fbd — David du Colombier 23 years ago bd093d3
Plan 9 from Bell Labs 2002-12-22
2 files changed, 34 insertions(+), 0 deletions(-)

M port/dev.c
M port/sysproc.c
M port/dev.c => port/dev.c +31 -0
@@ 50,8 50,39 @@ devdir(Chan *c, Qid qid, char *n, vlong length, char *user, long perm, Dir *db)
}

/*
 * (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)
{

M port/sysproc.c => port/sysproc.c +3 -0
@@ 16,6 16,9 @@ sysr1(ulong *arg)
{
	long a;

extern int devdebug;
devdebug = !devdebug;

	a = *arg;
	if(a > 0)
		return incref(&sysr1ref);