diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-07-28 09:52:21 +0200 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2015-07-28 09:52:21 +0200 |
commit | 4bd9ed80c379d0f531a8fc8e8307dea36df0c8c0 (patch) | |
tree | c3dee1e6b67aff6d8ae53c93c1bd48ee2d638693 /sys/src/9/port/devmnt.c | |
parent | 311a99e23b2f1adcf01a91db3e551dc1dda9f61a (diff) |
kernel: export mntattach() from devmnt.c avoiding bogus struct passing and special case in namec()
we already export mntauth() and mntversion(), so why not stop
being sneaky and just export mntattach() so bindmount() and
devshr can just call it directly with proper arguments being
checked.
we can also avoid handling #M attach specially in namec()
by having the devmnt's attach function do error(Enoattach).
Diffstat (limited to 'sys/src/9/port/devmnt.c')
-rw-r--r-- | sys/src/9/port/devmnt.c | 31 |
1 files changed, 14 insertions, 17 deletions
diff --git a/sys/src/9/port/devmnt.c b/sys/src/9/port/devmnt.c index 9f6728a4b..65bdf5453 100644 --- a/sys/src/9/port/devmnt.c +++ b/sys/src/9/port/devmnt.c @@ -302,21 +302,11 @@ mntauth(Chan *c, char *spec) } -static Chan* -mntattach(char *muxattach) +Chan* +mntattach(Chan *c, Chan *ac, char *spec, int flags) { Mnt *m; - Chan *c; Mntrpc *r; - struct bogus{ - Chan *chan; - Chan *authchan; - char *spec; - int flags; - }bogus; - - bogus = *((struct bogus *)muxattach); - c = bogus.chan; m = c->mux; if(m == nil){ @@ -342,12 +332,12 @@ mntattach(char *muxattach) } r->request.type = Tattach; r->request.fid = c->fid; - if(bogus.authchan == nil) + if(ac == nil) r->request.afid = NOFID; else - r->request.afid = bogus.authchan->fid; + r->request.afid = ac->fid; r->request.uname = up->user; - r->request.aname = bogus.spec; + r->request.aname = spec; mountrpc(m, r); c->qid = r->reply.qid; @@ -360,12 +350,19 @@ mntattach(char *muxattach) poperror(); /* c */ - if(bogus.flags&MCACHE) + if(flags&MCACHE) c->flag |= CCACHE; return c; } static Chan* +noattach(char *) +{ + error(Enoattach); + return nil; +} + +static Chan* mntchan(void) { Chan *c; @@ -1422,7 +1419,7 @@ Dev mntdevtab = { mntreset, devinit, devshutdown, - mntattach, + noattach, mntwalk, mntstat, mntopen, |