On 2016-01-09 at 22:22 ron minnich wrote:
> It was for .

It was for what?  There's nothing after 'for' and before the period
'.'.  =)

So are you saying that the previous comment:

* the zeroth element of the table MUST be the directory itself for .. 

was:

* the zeroth element of the table MUST be the directory itself for .PERIOD

(first dot means '.', second dot is a period?)

The git log says that line came from the original dev.c (9838b574b8d0
("dev.c, which has stubs we need").

Anyway, I don't disagree that the first entry in the devtab is DOT.
But why does the first entry need to be DOT?  I think it is because of
DOTDOT processing, which goes on in the later lines of code.
Specifically, if i == DEVDOTDOT, then we just devdir the first entry of
the table.  For DOTDOT to work correctly, this first entry should be
the actual directory we're in (a.k.a. DOT).  I think.

Barret





> ron
> 
> On Sat, Jan 9, 2016 at 2:17 PM Dan Cross <[email protected]> wrote:
> 
> > On Sat, Jan 9, 2016 at 11:21 AM, barret rhoden
> > <[email protected]> wrote:
> >  
> >> On 2016-01-08 at 15:53 Dan Cross wrote:  
> >> > diff --git a/kern/src/ns/dev.c b/kern/src/ns/dev.c
> >> > index 8b23bbd..99ee384 100644
> >> > --- a/kern/src/ns/dev.c
> >> > +++ b/kern/src/ns/dev.c
> >> > @@ -85,28 +85,30 @@ devdir(struct chan *c, struct qid qid, char
> >> > *n, }
> >> >
> >> >  /*
> >> > - * the zeroth element of the table MUST be the directory itself
> >> > for ..
> >> > - * Any entry with qid vers of -1 will return 0, indicating that
> >> > the value is
> >> > - * valid but there is nothing there continue walk.
> >> > - * TODO(gvdl): Update akaros devgen man page.
> >> > -*/
> >> > + * The zeroth element of the table MUST be the directory
> >> > itself, or '.' (dot).  
> >>
> >> The "for .." in the original comment was probably "for DOTDOT
> >> processing", not that the 0th element represented "..".  Clearly,
> >> the comment needs to change a little, since it was unclear enough
> >> that you changed it.  =)
> >>  
> >
> > No, it was definitely for 'dot'. I got confused by that myself, but
> > stared through it enough to finally understand that that's what it
> > is, hence the change of the comment.
> >  
> > > + * Any entry with qid verion of -1 will return 0, indicating
> > > that the  
> >> > value is
> >> > + * valid but there is nothing there, so continue walking.
> >> > + *
> >> > + * TODO(cross): Document devgen.
> >> > + */
> >> >  int
> >> > -devgen(struct chan *c, char *unused_char_p_t, struct dirtab
> >> > *tab, int ntab,
> >> > -   int i, struct dir *dp)
> >> > +devgen(struct chan *c, char *unused_name, struct dirtab *tab,
> >> > int ntab,
> >> > +       int i, struct dir *dp)
> >> >  {
> >> > - if (tab == 0)
> >> > + if (tab == NULL)
> >> >   return -1;
> >> >   if (i != DEVDOTDOT) {
> >> > - /* skip over the first element, that for . itself */
> >> > + /* Skip over the first element, that for the directory itself.
> >> > */ i++;
> >> > - if (i >= ntab)
> >> > + if (i < 0 || i >= ntab || tab[i] == NULL)
> >> >   return -1;
> >> >   tab += i;
> >> >   }
> >> > - int ret = (tab->qid.vers == -1)? 0 : 1;
> >> > - if (ret)
> >> > - devdir(c, tab->qid, tab->name, tab->length, eve, tab->perm,
> >> > dp);
> >> > - return ret;
> >> > + assert(tab != NULL);  
> >>
> >> don't need the assert, since there's a check for tab == NULL
> >> earlier. 
> >
> > Ooops. Will change once I get access to my workstation again....
> >  
> > > + if (tab->qid.vers == -1)  
> >> > + return 0;
> >> > + devdir(c, tab->qid, tab->name, tab->length, eve, tab->perm,
> >> > dp);
> >> > + return 1;
> >> >  }  
> >>
> >> barret
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> >> Groups "Akaros" group.
> >> To unsubscribe from this group and stop receiving emails from it,
> >> send an email to [email protected].
> >> To post to this group, send email to [email protected].
> >> For more options, visit https://groups.google.com/d/optout.
> >>  
> > --
> > You received this message because you are subscribed to the Google
> > Groups "Akaros" group.
> > To unsubscribe from this group and stop receiving emails from it,
> > send an email to [email protected].
> > To post to this group, send email to [email protected].
> > For more options, visit https://groups.google.com/d/optout.
> >  
> 

-- 
You received this message because you are subscribed to the Google Groups 
"Akaros" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to