plan 9 kernel history: overview | file list | diff list

1993/1015/port/devmnt.c (diff list | history)

1993/1014/sys/src/9/port/devmnt.c:66,711993/1015/sys/src/9/port/devmnt.c:66,73 (short | long | prev | next)
1990/0227    
{ 
1991/0911    
	mntalloc.id = 1; 
1992/0620    
	mntalloc.rpctag = Tagspace; 
1993/1015    
 
	cinit(); 
1990/0604    
} 
 
1990/0227    
void 
1993/1014/sys/src/9/port/devmnt.c:83,891993/1015/sys/src/9/port/devmnt.c:85,91
1990/0227    
	struct bogus{ 
		Chan	*chan; 
		char	*spec; 
1993/1014    
		int	flag; 
1993/1015    
		int	flags; 
1990/0227    
	}bogus; 
 
1991/0911    
	bogus = *((struct bogus *)muxattach); 
1993/1014/sys/src/9/port/devmnt.c:91,971993/1015/sys/src/9/port/devmnt.c:93,99
1992/0620    
 
	lock(&mntalloc); 
	for(m = mntalloc.list; m; m = m->list) { 
		if(m->c == c && m->id) { 
1993/1015    
		if(m->c == c && m->id && m->flags == bogus.flags) { 
1991/0911    
			lock(m); 
1992/0620    
			if(m->id && m->ref > 0 && m->c == c) { 
				unlock(&mntalloc); 
1993/1014/sys/src/9/port/devmnt.c:109,1141993/1015/sys/src/9/port/devmnt.c:111,117
1991/0911    
			unlock(m);	 
		} 
1991/0901    
	} 
1993/1015    
 
1991/0911    
	m = mntalloc.mntfree; 
1992/0620    
	if(m != 0) 
		mntalloc.mntfree = m->list;	 
1993/1014/sys/src/9/port/devmnt.c:354,3591993/1015/sys/src/9/port/devmnt.c:357,366
1990/0227    
	c->flag |= COPEN; 
1991/0911    
	poperror(); 
	mntfree(r); 
1993/1015    
 
	if(m->flags&MCACHE) 
		copen(c); 
 
1990/0227    
	return c; 
} 
 
1993/1014/sys/src/9/port/devmnt.c:381,3861993/1015/sys/src/9/port/devmnt.c:388,396
1990/0227    
	c->mode = openmode(omode); 
1991/0911    
	poperror(); 
	mntfree(r); 
1993/1015    
 
	if(m->flags & MCACHE) 
		copen(c); 
1990/0227    
} 
 
void	  
1993/1014/sys/src/9/port/devmnt.c:481,4991993/1015/sys/src/9/port/devmnt.c:491,511
1990/0227    
long	  
1991/0411    
mntread(Chan *c, void *buf, long n, ulong offset) 
1990/0227    
{ 
1993/1014    
	int nc; 
1993/1015    
	Mnt *m; 
1991/0911    
	uchar *p, *e; 
1993/1015    
	int nc, cached; 
1990/0227    
 
1993/1014    
	m = mntchk(c); 
	nc = 0; 
	if((m->flags&MCACHE) && !isdir(c)) { 
		nc = cread(c, buf, n, offset); 
		if(nc == n) 
			return n; 
1993/1015    
	cached = m->flags&MCACHE; 
1993/1014    
 
		buf = (uchar*)buf+nc; 
		offset += nc; 
		n -= nc; 
1993/1015    
	SET(nc); 
	if(cached) { 
		nc = cread(c, buf, n, offset); 
		if(nc > 0) { 
			buf = (uchar*)buf+nc; 
			offset += nc; 
			n -= nc; 
		} 
1993/1014    
	} 
 
	n = mntrdwr(Tread, m, c, buf, n, offset); 
1993/1014/sys/src/9/port/devmnt.c:501,5081993/1015/sys/src/9/port/devmnt.c:513,522
1991/0911    
		for(p = (uchar*)buf, e = &p[n]; p < e; p += DIRLEN) 
			mntdirfix(p, c); 
 
1993/1014    
	if(nc != 0) 
1993/1015    
	if(cached) { 
1993/1014    
		cupdate(c, buf, n, offset); 
1993/1015    
		n += nc; 
	} 
1993/1014    
 
1990/0227    
	return n; 
} 
1993/1014/sys/src/9/port/devmnt.c:510,5171993/1015/sys/src/9/port/devmnt.c:524,530
1990/0227    
long	  
1991/0411    
mntwrite(Chan *c, void *buf, long n, ulong offset) 
1990/0227    
{ 
1993/1014    
	m = mntchk(c); 
	return mntrdwr(Twrite, m, c, buf, n, offset);	 
1993/1015    
	return mntrdwr(Twrite, mntchk(c), c, buf, n, offset); 
1990/0227    
} 
 
1991/0911    
long 
1993/1014/sys/src/9/port/devmnt.c:519,5281993/1015/sys/src/9/port/devmnt.c:532,543
1990/0227    
{ 
1991/0911    
	Mntrpc *r; 
	char *uba; 
1993/1015    
	int cache; 
1992/0825    
	ulong cnt, nr; 
1990/0227    
 
1991/0911    
	uba = buf; 
1993/0907    
	cnt = 0; 
1993/1015    
	cache = m->flags & MCACHE; 
1993/0907    
	for(;;) { 
1993/0501    
		r = mntralloc(c); 
1991/0911    
		if(waserror()) { 
1993/1014/sys/src/9/port/devmnt.c:538,5451993/1015/sys/src/9/port/devmnt.c:553,564
1991/0911    
		nr = r->reply.count; 
1993/0907    
		if(nr > r->request.count) 
			nr = r->request.count; 
1993/1015    
 
1991/0911    
		if(type == Tread) 
			memmove(uba, r->reply.data, nr); 
1993/1015    
		else if(cache) 
			cwrite(c, (uchar*)r->reply.data, nr, offset); 
 
1991/0911    
		poperror(); 
		mntfree(r); 
		offset += nr; 


source code copyright © 1990-2005 Lucent Technologies; see license
Plan 9 distribution
comments to russ cox (rsc@swtch.com)