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

2002/0615/port/devmnt.c (diff list | history)

2002/0615/sys/src/9/port/devmnt.c:36,412002/0919/sys/src/9/port/devmnt.c:36,48 (short | long | prev | next)
2000/0105    
	Mntrpc*	flushed;	/* message this one flushes */ 
1990/0227    
}; 
 
2002/0919    
enum 
{ 
	TAGSHIFT = 5,			/* ulong has to be 32 bits */ 
	TAGMASK = (1<<TAGSHIFT)-1, 
	NMASK = (64*1024)>>TAGSHIFT, 
}; 
 
1991/0911    
struct Mntalloc 
1990/0227    
{ 
	Lock; 
2002/0615/sys/src/9/port/devmnt.c:45,512002/0919/sys/src/9/port/devmnt.c:52,58
1999/0212    
	int	nrpcfree; 
	int	nrpcused; 
1994/1124    
	ulong	id; 
1992/0620    
	int	rpctag; 
2002/0919    
	ulong	tagmask[NMASK]; 
1991/0911    
}mntalloc; 
1990/0227    
 
2001/0527    
void	mattach(Mnt*, Chan*, char*); 
2002/0615/sys/src/9/port/devmnt.c:69,892002/0919/sys/src/9/port/devmnt.c:76,93
2001/0527    
char	Esbadstat[] = "invalid directory entry received from server"; 
2001/0819    
char Enoversion[] = "version not established for mount channel"; 
2001/0527    
 
2002/0919    
 
1998/0917    
void (*mntstats)(int, Chan*, uvlong, ulong); 
1994/0513    
 
1991/0911    
enum 
1990/0303    
{ 
1993/1011    
	Tagspace	= 1, 
1991/0911    
}; 
1990/0604    
                 
1997/0327    
static void 
1991/0911    
mntreset(void) 
1990/0227    
{ 
1991/0911    
	mntalloc.id = 1; 
1992/0620    
	mntalloc.rpctag = Tagspace; 
2002/0919    
	mntalloc.tagmask[0] = 1;			/* don't allow 0 as a tag */ 
	mntalloc.tagmask[NMASK-1] = 0x80000000UL;	/* don't allow NOTAG */ 
2002/0217    
	fmtinstall('F', fcallfmt); 
	fmtinstall('D', dirfmt); 
2002/0615    
/*	fmtinstall('M', dirmodefmt);  No!  Clashes with eipfmt [sape] */ 
2002/0919    
/* We can't install %M since eipfmt does and is used in the kernel [sape] */ 
1993/1015    
 
	cinit(); 
1990/0604    
} 
2002/0615/sys/src/9/port/devmnt.c:997,10022002/0919/sys/src/9/port/devmnt.c:1001,1032
1990/03081    
	} 
1991/0911    
} 
1991/0901    
 
2002/0919    
int 
alloctag(void) 
{ 
	int i, j; 
	ulong v; 
 
	for(i = 0; i < NMASK; i++){ 
		v = mntalloc.tagmask[i]; 
		if(v == ~0UL) 
			continue; 
		for(j = 0; j < 1<<TAGSHIFT; j++) 
			if((v & (1<<j)) == 0){ 
				mntalloc.tagmask[i] |= 1<<j; 
				return (i<<TAGSHIFT) + j; 
			} 
	} 
	panic("no friggin tags left"); 
	return NOTAG; 
} 
 
void 
freetag(int t) 
{ 
	mntalloc.tagmask[t>>TAGSHIFT] &= ~(1<<(t&TAGMASK)); 
} 
 
2001/0527    
Mntrpc* 
2001/0820    
mntralloc(Chan *c, ulong msize) 
1991/0911    
{ 
2002/0615/sys/src/9/port/devmnt.c:1021,10272002/0919/sys/src/9/port/devmnt.c:1051,1057
1992/0620    
			exhausted("mount rpc buffer"); 
1991/0911    
		} 
2001/0820    
		new->rpclen = msize; 
1992/0620    
		new->request.tag = mntalloc.rpctag++; 
2002/0919    
		new->request.tag = alloctag(); 
1991/0904    
	} 
1999/0212    
	else { 
		mntalloc.rpcfree = new->list; 
2002/0615/sys/src/9/port/devmnt.c:1056,10612002/0919/sys/src/9/port/devmnt.c:1086,1092
1999/0212    
	if(mntalloc.nrpcfree >= 10){ 
		free(r->rpc); 
		free(r); 
2002/0919    
		freetag(r->request.tag); 
1999/0212    
	} 
	else{ 
		r->list = mntalloc.rpcfree; 


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