The following changes since commit 548361ec318c5381bc13eb7d9fa7e6f59d7081f1:
Created a new Makefrag-user-app helper for building binaries (2015-12-21 12:56:49 -0500) are available in the git repository at: [email protected]:dancrossnyc/akaros.git gen for you to fetch changes up to 391f7fce9fb680492aa22d3ec2166707906ef621: Clean up 'devgen()' a bit. (2016-01-08 14:42:01 -0500) ---------------------------------------------------------------- Dan Cross (1): Clean up 'devgen()' a bit. kern/src/ns/dev.c | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) 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). + * 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); + if (tab->qid.vers == -1) + return 0; + devdir(c, tab->qid, tab->name, tab->length, eve, tab->perm, dp); + return 1; } void devreset(void) -- 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.
