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

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

2002/0919/sys/src/9/port/devmnt.c:829,8342002/1213/sys/src/9/port/devmnt.c:829,852 (short | long | prev | next)
2000/0105    
	mntflushfree(m, r); 
1990/1124    
} 
 
2002/1213    
static int 
doread(Mnt *m, int len) 
{ 
	Block *b; 
 
	while(qlen(m->q) < len){ 
		b = devtab[m->c->type]->bread(m->c, m->msize, 0); 
		if(b == nil) 
			return -1; 
		if(BLEN(b) == 0){ 
			freeblist(b); 
			return -1; 
		} 
		qaddlist(m->q, b); 
	} 
	return 0; 
} 
 
2001/0527    
int 
1991/0911    
mntrpcread(Mnt *m, Mntrpc *r) 
1990/1124    
{ 
2002/0919/sys/src/9/port/devmnt.c:839,8602002/1213/sys/src/9/port/devmnt.c:857,874
2001/0527    
	r->reply.tag = 0; 
2001/0619    
 
	/* read at least length, type, and tag and pullup to a single block */ 
	while(qlen(m->q) < BIT32SZ+BIT8SZ+BIT16SZ){ 
2002/0615    
		b = devtab[m->c->type]->bread(m->c, m->msize, 0); 
2001/0619    
		if(b == nil) 
			return -1; 
2001/0825    
		qaddlist(m->q, b); 
2001/0527    
	} 
2002/1213    
	if(doread(m, BIT32SZ+BIT8SZ+BIT16SZ) < 0) 
		return -1; 
2001/0619    
	nb = pullupqueue(m->q, BIT32SZ+BIT8SZ+BIT16SZ); 
	len = GBIT32(nb->rp); 
 
	/* read in the rest of the message */ 
	while(qlen(m->q) < len){ 
2002/0615    
		b = devtab[m->c->type]->bread(m->c, m->msize, 0); 
2001/0619    
		if(b == nil) 
			return -1; 
2001/0825    
		qaddlist(m->q, b); 
2002/1213    
	/* read in the rest of the message, avoid rediculous (for now) message sizes */ 
	len = GBIT32(nb->rp); 
	if(len > m->msize){ 
		qdiscard(m->q, qlen(m->q)); 
		return -1; 
2001/0527    
	} 
2002/1213    
	if(doread(m, len) < 0) 
		return -1; 
2001/0619    
 
	/* pullup the header (i.e. everything except data) */ 
	t = nb->rp[BIT32SZ]; 


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