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

1997/1106/port/netif.c (diff list | history)

1997/1105/sys/src/9/port/netif.c:212,2171997/1106/sys/src/9/port/netif.c:212,239 (short | long | prev | next)
1997/0327    
} 
 
1993/0525    
/* 
1997/1106    
 *  make sure this type isn't already in use on this device 
 */ 
static int 
typeinuse(Netif *nif, int type) 
{ 
	Netfile *f, **fp, **efp; 
 
	if(type <= 0) 
		return 0; 
 
	efp = &nif->f[nif->nfile]; 
	for(fp = nif->f; fp < efp; fp++){ 
		f = *fp; 
		if(f == 0) 
			continue; 
		if(f->type == type) 
			return 1; 
	} 
	return 0; 
} 
 
/* 
1993/0525    
 *  the devxxx.c that calls us handles writing data, it knows best 
 */ 
long 
1997/1105/sys/src/9/port/netif.c:218,2231997/1106/sys/src/9/port/netif.c:240,246
1993/0525    
netifwrite(Netif *nif, Chan *c, void *a, long n) 
{ 
	Netfile *f; 
1997/1106    
	int type; 
1997/0417    
	char *p, buf[64]; 
1997/0404    
	uchar binaddr[Nmaxaddr]; 
1993/0525    
 
1997/1105/sys/src/9/port/netif.c:237,2431997/1106/sys/src/9/port/netif.c:260,269
1993/0525    
	qlock(nif); 
	f = nif->f[NETID(c->qid.path)]; 
1997/0403    
	if((p = matchtoken(buf, "connect")) != 0){ 
1993/0525    
		f->type = atoi(p); 
1997/1106    
		type = atoi(p); 
		if(typeinuse(nif, type)) 
			error(Einuse); 
		f->type = type; 
1994/0629    
		if(f->type < 0) 
			nif->all++; 
1993/0525    
	} else if(matchtoken(buf, "promiscuous")){ 


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