diff options
| -rw-r--r-- | sys/src/9/port/chan.c | 6 | ||||
| -rw-r--r-- | sys/src/9/port/devshr.c | 2 | ||||
| -rw-r--r-- | sys/src/9/port/pgrp.c | 24 | ||||
| -rw-r--r-- | sys/src/9/port/portdat.h | 2 | ||||
| -rw-r--r-- | sys/src/9/port/portfns.h | 2 |
5 files changed, 19 insertions, 17 deletions
diff --git a/sys/src/9/port/chan.c b/sys/src/9/port/chan.c index 41b686170..7e87b9110 100644 --- a/sys/src/9/port/chan.c +++ b/sys/src/9/port/chan.c @@ -704,7 +704,7 @@ cmount(Chan **newp, Chan *old, int flag, char *spec) * node to the mount chain. */ if(order != MREPL) - m->mount = newmount(m, old, 0, 0); + m->mount = newmount(old, 0, nil); } wlock(&m->lock); if(waserror()){ @@ -713,7 +713,7 @@ cmount(Chan **newp, Chan *old, int flag, char *spec) } wunlock(&pg->ns); - nm = newmount(m, new, flag, spec); + nm = newmount(new, flag, spec); if(mh != nil && mh->mount != nil){ /* * copy a union when binding it onto a directory @@ -724,7 +724,7 @@ cmount(Chan **newp, Chan *old, int flag, char *spec) h = &nm->next; um = mh->mount; for(um = um->next; um != nil; um = um->next){ - f = newmount(m, um->to, flg, um->spec); + f = newmount(um->to, flg, um->spec); *h = f; h = &f->next; } diff --git a/sys/src/9/port/devshr.c b/sys/src/9/port/devshr.c index 03a79bc8a..bc7677210 100644 --- a/sys/src/9/port/devshr.c +++ b/sys/src/9/port/devshr.c @@ -531,7 +531,6 @@ shrcreate(Chan *c, char *name, int omode, ulong perm) incref(mpt); mpt->m.mflag = (h->mount == nil) ? MCREATE : 0; - mpt->m.head = h; mpt->m.next = h->mount; h->mount = &mpt->m; @@ -602,7 +601,6 @@ shrremove(Chan *c) if(*ml == m){ *ml = m->next; m->next = nil; - m->head = nil; putmpt(mpt); break; } diff --git a/sys/src/9/port/pgrp.c b/sys/src/9/port/pgrp.c index 430052db9..5de7c695f 100644 --- a/sys/src/9/port/pgrp.c +++ b/sys/src/9/port/pgrp.c @@ -115,11 +115,12 @@ pgrpinsert(Mount **order, Mount *m) void pgrpcpy(Pgrp *to, Pgrp *from) { - int i; Mount *n, *m, **link, *order; Mhead *f, **tom, **l, *mh; + int i; - wlock(&from->ns); + wlock(&to->ns); + rlock(&from->ns); order = nil; tom = to->mnthash; for(i = 0; i < MNTHASH; i++) { @@ -131,9 +132,14 @@ pgrpcpy(Pgrp *to, Pgrp *from) l = &mh->hash; link = &mh->mount; for(m = f->mount; m != nil; m = m->next) { - n = newmount(mh, m->to, m->mflag, m->spec); - m->copy = n; - pgrpinsert(&order, m); + n = smalloc(sizeof(Mount)); + n->mountid = m->mountid; + n->mflag = m->mflag; + n->to = m->to; + incref(n->to); + if(m->spec != nil) + kstrdup(&n->spec, m->spec); + pgrpinsert(&order, n); *link = n; link = &n->next; } @@ -144,8 +150,9 @@ pgrpcpy(Pgrp *to, Pgrp *from) * Allocate mount ids in the same sequence as the parent group */ for(m = order; m != nil; m = m->order) - m->copy->mountid = incref(&mountid); - wunlock(&from->ns); + m->mountid = incref(&mountid); + runlock(&from->ns); + wunlock(&to->ns); } Fgrp* @@ -246,12 +253,11 @@ forceclosefgrp(void) Mount* -newmount(Mhead *mh, Chan *to, int flag, char *spec) +newmount(Chan *to, int flag, char *spec) { Mount *m; m = smalloc(sizeof(Mount)); - m->head = mh; m->to = to; incref(to); m->mountid = incref(&mountid); diff --git a/sys/src/9/port/portdat.h b/sys/src/9/port/portdat.h index 9eafd7b93..21107d870 100644 --- a/sys/src/9/port/portdat.h +++ b/sys/src/9/port/portdat.h @@ -255,8 +255,6 @@ struct Mount { ulong mountid; Mount* next; - Mhead* head; - Mount* copy; Mount* order; Chan* to; /* channel replacing channel */ int mflag; diff --git a/sys/src/9/port/portfns.h b/sys/src/9/port/portfns.h index 6ca7a54ba..4944b9285 100644 --- a/sys/src/9/port/portfns.h +++ b/sys/src/9/port/portfns.h @@ -190,7 +190,7 @@ int needpages(void*); Chan* newchan(void); int newfd(Chan*); Mhead* newmhead(Chan*); -Mount* newmount(Mhead*, Chan*, int, char*); +Mount* newmount(Chan*, int, char*); Page* newpage(int, Segment **, uintptr); Path* newpath(char*); Pgrp* newpgrp(void); |
