9os

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

commit 940d405c2261873c6c773e322db275627618dcf5
parent 506b99dcbb419aa72712a90be22d5d587d24a6df
Author: Roberto Vargas <roberto.vargas@arm.com>
Date:   Mon, 18 Feb 2019 16:23:25 +0000

[drivers] Remove binds

Change-Id: Iff457edffcf4d10dcd64c6c8b54a946cc084b0a9

Diffstat:
Mdrivers/dev.c | 65+++--------------------------------------------------------------
Mdrivers/dev.h | 8--------
Msrc/lib9p/dirtop9.c | 2+-
3 files changed, 4 insertions(+), 71 deletions(-)

diff --git a/drivers/dev.c b/drivers/dev.c @@ -24,22 +24,6 @@ newchan(void) return NULL; } -static Bind * -newbind(void) -{ - Bind *b, *lim; - struct devdata *dinfo = devinfo; - - lim = &dinfo->binds[NR_BINDS]; - for (b = dinfo->binds; b < lim; b++) { - if (b->where == NULL) - return b; - } - - errno = ENOMEM; - return NULL; -} - static Chan * fd2chan(int fd) { @@ -116,38 +100,6 @@ clone(Chan *c, Chan *nc) return devtab[c->type]->clone(c, nc); } -static int -eqchan(Chan *c1, Chan *c2) -{ - return c1->qid == c2->qid && - c1->type == c2->type && - c1->dev == c2->dev; -} - -static int -walk(Chan *c, char *name) -{ - Chan *cw, tmp; - Bind *bp, *lim; - struct devdata *dinfo = devinfo; - - if (devtab[c->type]->walk(c, name) == 1) - return 1; - - lim = &dinfo->binds[NR_BINDS]; - for (bp = dinfo->binds; bp < lim; bp++) { - cw = bp->where; - if (!cw || !eqchan(c, cw)) - continue; - tmp = *bp->from; - if (devtab[tmp.type]->walk(&tmp, name) == 1) { - *c = tmp; - return 1; - } - } - return -1; -} - static void chanclose(Chan *c) { @@ -200,7 +152,7 @@ namec(const char *name, int mode) return NULL; for (s = next(s, elem); *elem; s = next(s, elem)) { - if (walk(c, elem) < 0) + if (devtab[c->type]->walk(c, name) < 0) goto notfound; } if (!s) @@ -290,7 +242,7 @@ devdirread(Chan *c, break; case 1: c->offset += DIRLEN; - n = dirto9p(&dir, buf + cnt, nbytes); + n = dirtop9(&dir, buf + cnt, nbytes); nbytes -= n; cnt += n; } @@ -408,7 +360,6 @@ int bind(char *new, char *where) { Chan *cw, *cn; - Bind *b; if ((cw = namec(where, O_READ)) == NULL) goto err0; @@ -421,11 +372,7 @@ bind(char *new, char *where) if ((cn = namec(new, O_BIND)) == NULL) goto err1; - if ((b = newbind()) == NULL) - goto err2; - - b->from = cn; - b->where = cw; + panic("not implemented"); return 0; @@ -442,7 +389,6 @@ idev(void) { struct devdata *dinfo; Chan *c, *clim; - Bind *b, *blim; dinfo = alloc(sizeof(*dinfo)); devinfo = dinfo; @@ -451,11 +397,6 @@ idev(void) for (c = fdset; c < clim; c++) c->type = NODEV; - - blim = &dinfo->binds[NR_BINDS]; - for (b = dinfo->binds; b < blim; b++) - b->where = b->from = NULL; - if ((c = devattach(NULL, '/')) == NULL) panic("idev:attach"); diff --git a/drivers/dev.h b/drivers/dev.h @@ -12,7 +12,6 @@ typedef struct dirtab Dirtab; typedef int Devgen(Chan *, const Dirtab *, int, int, Dir *); typedef struct attr Attr; typedef struct uart Uart; -typedef struct bind Bind; struct dirtab { char name[NAMELEN]; @@ -44,16 +43,9 @@ struct attr { char *value; }; -struct bind { - Chan *where; - Chan *from; - int flags; -}; - struct devdata { Chan slash; Uart *uarts[NR_UARTS]; - Bind binds[NR_BINDS]; }; extern Chan *devclone(Chan *c, Chan *nc); diff --git a/src/lib9p/dirtop9.c b/src/lib9p/dirtop9.c @@ -5,7 +5,7 @@ #include "convto9p.h" int -dirto9p(Dir *dp, unsigned char *buf, int n) +dirtop9(Dir *dp, unsigned char *buf, int n) { int len; unsigned char *p;