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

1990/0303/port/devmnt.c (diff list | history)

1990/0227/sys/src/9/port/devmnt.c:18,231990/0303/sys/src/9/port/devmnt.c:18,24 (short | long | prev | next)
1990/0227    
{ 
	Ref;			/* for number of chans, incl. mntpt but not msg */ 
	QLock;			/* for access */ 
1990/0303    
	ulong	mntid;		/* serial # */ 
1990/0227    
	Chan	*msg;		/* for reading and writing messages */ 
	Chan	*mntpt;		/* channel in user's name space */ 
}; 
1990/0227/sys/src/9/port/devmnt.c:50,551990/0303/sys/src/9/port/devmnt.c:51,62
1990/0227    
	Mnthdr	*free; 
}mnthdralloc; 
 
1990/0303    
struct 
{ 
	Lock; 
	long	id; 
}mntid; 
 
1990/0227    
Mnt	*mnt; 
void	mntxmit(Mnt*, Mnthdr*); 
 
1990/0227/sys/src/9/port/devmnt.c:119,1371990/0303/sys/src/9/port/devmnt.c:126,142
1990/0227    
mntdev(int dev, int noerr) 
{ 
	Mnt *m; 
1990/0303    
	int i; 
1990/0227    
 
	if(dev<0 || conf.nmntdev<=dev){ 
		if(noerr) 
			return 0; 
		panic("mntdev out of range"); 
	} 
	m = &mnt[dev]; 
	if(m->msg == 0){ 
		if(noerr) 
			return 0; 
		error(0, Eshutdown); 
	} 
	return m; 
1990/0303    
	for(m=mnt,i=0; i<conf.nmntdev; i++,m++)		/* use a hash table some day */ 
		if(m->mntid == dev){ 
			if(m->msg == 0) 
				break; 
			return m; 
		} 
	if(noerr) 
		return 0; 
	error(0, Eshutdown); 
1990/0227    
} 
 
void 
1990/0227/sys/src/9/port/devmnt.c:187,1941990/0303/sys/src/9/port/devmnt.c:192,202
1990/0227    
    Found: 
	m->ref = 1; 
	unlock(m); 
1990/0303    
	lock(&mntid); 
	m->mntid = ++mntid.id; 
	unlock(&mntid); 
1990/0227    
	c = devattach('M', spec); 
	c->dev = m - mnt; 
1990/0303    
	c->dev = m->mntid; 
1990/0227    
	m->mntpt = c; 
	cm = bogus.chan; 
	m->msg = cm; 
1990/0227/sys/src/9/port/devmnt.c:205,2101990/0303/sys/src/9/port/devmnt.c:213,220
1990/0227    
	strcpy(mh->thdr.aname, spec); 
	mntxmit(m, mh); 
	c->qid = mh->rhdr.qid; 
1990/0303    
	c->mchan = m->msg; 
	c->mqid = c->qid; 
1990/0227    
	mhfree(mh); 
	poperror(); 
	return c; 
1990/0227/sys/src/9/port/devmnt.c:243,2481990/0303/sys/src/9/port/devmnt.c:253,260
1990/0227    
	nc->flag = c->flag; 
	nc->offset = c->offset; 
	nc->mnt = c->mnt; 
1990/0303    
	nc->mchan = c->mchan; 
	nc->mqid = c->qid; 
1990/0227    
	if(new) 
		poperror(); 
	mhfree(mh); 


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