| plan 9 kernel history: overview | file list | diff list |
1991/1011/port/pgrp.c (diff list | history)
| 1991/0806/sys/src/9/port/pgrp.c:28,33 – 1991/1011/sys/src/9/port/pgrp.c:28,34 (short | long | prev | next) | ||
| 1990/0227 | struct{ Lock; Mount *free; | |
| 1991/1011 | Mhead *mhfree; | |
| 1990/0227 | ulong mountid; }mountalloc; | |
| 1991/0806/sys/src/9/port/pgrp.c:39,53 – 1991/1011/sys/src/9/port/pgrp.c:40,54 | ||
| 1991/0705 | Egrp *e, *ee; Fgrp *f, *fe; Mount *m, *em; | |
| 1991/1011 | Mhead *hm, *hem; | |
| 1990/0227 | ||
| 1990/1110 | pgrpalloc.arena = ialloc(conf.npgrp*sizeof(Pgrp), 0); pgrpalloc.free = pgrpalloc.arena; | |
| 1990/0227 | p = pgrpalloc.free; | |
| 1990/0825 |
| |
| 1991/1011 | for(i=0; i<conf.npgrp; i++,p++) { | |
| 1990/1110 | p->index = i; | |
| 1990/0227 | p->next = p+1; | |
| 1990/0825 | p[-1].next = 0; | |
| 1990/0227 | ||
| 1991/0806/sys/src/9/port/pgrp.c:64,75 – 1991/1011/sys/src/9/port/pgrp.c:65,70 | ||
| 1991/0705 | for(f = fgrpalloc.free; f < fe; f++) f->next = f+1; f->next = 0; | |
| 1990/0227 |
| |
| 1991/0806/sys/src/9/port/pgrp.c:119,126 – 1991/1011/sys/src/9/port/pgrp.c:114,121 | ||
| 1991/0705 | pgrpalloc.free = p->next; p->ref = 1; p->pgrpid = ++pgrpalloc.pgrpid; | |
| 1991/0806 | memset(p->rendhash, 0, sizeof(p->rendhash)); | |
| 1991/1011 | memset(p->mnthash, 0, sizeof(p->mnthash)); | |
| 1991/0705 | unlock(&pgrpalloc); return p; } | |
| 1991/0806/sys/src/9/port/pgrp.c:202,219 – 1991/1011/sys/src/9/port/pgrp.c:197,218 | ||
| 1990/0227 | void closepgrp(Pgrp *p) { | |
| 1991/1011 | Mhead **h, **e, *f, *next; | |
| 1990/0227 | if(decref(p) == 0){ | |
| 1991/0212 | qlock(&p->debug); | |
| 1990/1110 | p->pgrpid = -1; | |
| 1990/0227 |
| |
| 1991/1011 | e = &p->mnthash[MNTHASH]; for(h = p->mnthash; h < e; h++) { for(f = *h; f; f = next) { close(f->from); mountfree(f->mount); next = f->hash; mntheadfree(f); | |
| 1990/0227 | } | |
| 1991/1011 | } | |
| 1990/0227 | lock(&pgrpalloc); p->next = pgrpalloc.free; pgrpalloc.free = p; | |
| 1991/0806/sys/src/9/port/pgrp.c:260,308 – 1991/1011/sys/src/9/port/pgrp.c:259,292 | ||
| 1991/0705 | ||
| 1990/0227 | Mount* | |
| 1991/1011 | newmount(Mhead *mh, Chan *to) | |
| 1990/0227 | { | |
| 1991/1011 | Mount *m, *f, *e; | |
| 1990/0227 |
| |
| 1990/0928 |
| |
| 1990/0227 |
| |
| 1991/1011 | for(;;) { lock(&mountalloc); if(m = mountalloc.free){ /* assign = */ mountalloc.free = m->next; m->mountid = ++mountalloc.mountid; unlock(&mountalloc); m->next = 0; m->head = mh; m->to = to; incref(to); return m; } | |
| 1990/0227 | unlock(&mountalloc); | |
| 1990/0321 |
| |
| 1990/0227 |
| |
| 1991/1011 | m = (Mount*)VA(kmap(newpage(0, 0, 0))); e = &m[(BY2PG/sizeof(Mount))-1]; for(f = m; f < e; f++) f->next = f+1; | |
| 1990/0227 | lock(&mountalloc); | |
| 1991/1011 | e->next = mountalloc.free; | |
| 1990/0227 | mountalloc.free = m; unlock(&mountalloc); | |
| 1991/0806/sys/src/9/port/pgrp.c:348,368 – 1991/1011/sys/src/9/port/pgrp.c:332,411 | ||
| 1991/0514 | void pgrpcpy(Pgrp *to, Pgrp *from) { | |
| 1991/1011 | Mhead **h, **e, *f, **l, *mh; Mount *n, *m, **link; | |
| 1991/0514 |
| |
| 1991/1011 | rlock(&from->ns); e = &from->mnthash[MNTHASH]; for(h = from->mnthash; h < e; h++) { for(f = *h; f; f = f->hash) { mh = newmnthead(); mh->from = f->from; incref(mh->from); l = &MOUNTH(to, mh->from); mh->hash = *l; *l = mh; link = &mh->mount; for(m = f->mount; m; m = m->next) { n = newmount(mh, m->to); *link = n; link = &n->next; } | |
| 1991/0514 | } | |
| 1991/1011 | } runlock(&from->ns); } | |
| 1991/0514 | ||
| 1990/0227 |
| |
| 1991/1011 | Mhead * newmnthead(void) { Mhead *mh, *f, *e; for(;;) { lock(&mountalloc); if(mh = mountalloc.mhfree) { /* Assign '=' */ mountalloc.mhfree = mh->hash; unlock(&mountalloc); mh->hash = 0; mh->mount = 0; return mh; } unlock(&mountalloc); mh = (Mhead*)VA(kmap(newpage(0, 0, 0))); e = &mh[(BY2PG/sizeof(Mhead))-1]; for(f = mh; f < e; f++) f->hash = f+1; lock(&mountalloc); e->hash = mountalloc.mhfree; mountalloc.mhfree = mh; unlock(&mountalloc); } } void mntheadfree(Mhead *mh) { lock(&mountalloc); mh->hash = mountalloc.mhfree; mountalloc.mhfree = mh; unlock(&mountalloc); } void mountfree(Mount *m) { Mount *f; for(f = m; f->next; f = f->next) close(f->to); close(f->to); lock(&mountalloc); f->next = mountalloc.free; mountalloc.free = m; unlock(&mountalloc); | |
| 1990/0227 | } | |