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. =)
> + * 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.
> + 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.