plan 9 kernel history: overview | file list | diff list

2002/1222/port/dev.c (diff list | history)

2002/0925/sys/src/9/port/dev.c:50,572002/1222/sys/src/9/port/dev.c:50,88 (short | long | prev | next)
Add comment explaining use of devgen. Add devdebug.
rsc Fri Mar 4 12:44:25 2005
1990/0227    
} 
 
2001/0527    
/* 
2002/1222    
 * (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. 
 */ 
/* 
2001/0527    
 * the zeroth element of the table MUST be the directory itself for .. 
*/ 
2002/1222    
int devdebug; 
1990/0227    
int 
2001/0527    
devgen(Chan *c, char*, Dirtab *tab, int ntab, int i, Dir *dp) 
1990/0227    
{ 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)