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

1993/1202/carrera/devether.c (diff list | history)

1993/0918/sys/src/9/carrera/devether.c:682,6871993/1202/sys/src/9/carrera/devether.c:682,718 (short | long | prev | next)
1993/0904    
	return ctlr->tda[ctlr->th].status == Host; 
1993/0903    
} 
 
1993/1202    
static int 
etherloop(Etherpkt *p, long n) 
{ 
	int s, different; 
	ushort t; 
	Netfile *f, **fp; 
 
	different = memcmp(p->d, p->s, sizeof(p->s)); 
	if(different && memcmp(p->d, ether.bcast, sizeof(p->d))) 
		return 0; 
 
	s = splhi(); 
	t = (p->type[0]<<8) | p->type[1]; 
	for(fp = ether.f; fp < ðer.f[Ntypes]; fp++) { 
		f = *fp; 
		if(f == 0) 
			continue; 
		if(f->type == t || f->type < 0) 
			switch(qproduce(f->in, p->d, n)){ 
			case -1: 
				print("etherloop overflow\n"); 
				break; 
			case -2: 
				print("etherloop memory\n"); 
				break; 
			} 
	} 
	splx(s); 
	return !different; 
} 
 
1993/0903    
long 
etherwrite(Chan *c, void *buf, long n, ulong offset) 
{ 
1993/0918/sys/src/9/carrera/devether.c:699,7041993/1202/sys/src/9/carrera/devether.c:730,738
1993/0904    
		return netifwrite(ether[0], c, buf, n); 
1993/0903    
 
	/* we handle data */ 
1993/1202    
	if(etherloop(buf, n)) 
		return n; 
 
1993/0904    
	qlock(&ctlr->tlock); 
1993/0918    
	if(waserror()) { 
		qunlock(&ctlr->tlock); 


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