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

1997/0408/port/dev.c (diff list | history)

1997/0327/sys/src/9/port/dev.c:10,311997/0408/sys/src/9/port/dev.c:10,25 (short | long | prev | next)
Devtab is now an array of pointers not structures.
rsc Fri Mar 4 12:44:25 2005
1990/0227    
int 
devno(int c, int user) 
{ 
1992/1217    
	Rune *s; 
	int i; 
1990/0227    
 
1992/1217    
	s = devchar; 
	i = 0; 
	while(*s){ 
		if(c == *s) 
1997/0408    
	for(i = 0; devtab[i] != nil; i++) { 
		if(devtab[i]->dc == c) 
1992/1217    
			return i; 
		i++; 
		s++; 
1990/0227    
	} 
1997/0408    
	if(user == 0) 
		panic("devno %C 0x%ux", c, c); 
1992/1217    
 
	if(user) 
		return -1; 
	panic("devno %C 0x%ux", c, c); 
	return 0; 
1997/0408    
	return -1; 
1990/0227    
} 
 
void 
1997/0327/sys/src/9/port/dev.c:33,391997/0408/sys/src/9/port/dev.c:27,33
1990/0227    
{ 
	strcpy(db->name, n); 
	db->qid = qid; 
	db->type = devchar[c->type]; 
1997/0408    
	db->type = devtab[c->type]->dc; 
1990/0227    
	db->dev = c->dev; 
1990/11211    
	if(qid.path & CHDIR) 
1990/0227    
		db->mode = CHDIR|perm; 
1997/0327/sys/src/9/port/dev.c:89,951997/0408/sys/src/9/port/dev.c:83,89
1990/0227    
devclone(Chan *c, Chan *nc) 
{ 
1990/0329    
	if(c->flag & COPEN) 
1992/1217    
		panic("clone of open file type %C\n", devchar[c->type]); 
1997/0408    
		panic("clone of open file type %C\n", devtab[c->type]->dc); 
1993/0501    
 
1990/0227    
	if(nc == 0) 
		nc = newchan(); 
1997/0327/sys/src/9/port/dev.c:158,1641997/0408/sys/src/9/port/dev.c:152,158
1990/0227    
			} 
1997/0327    
			print("%s %s: devstat %C %lux\n", 
				up->text, up->user, 
				devchar[c->type], c->qid.path); 
1997/0408    
				devtab[c->type]->dc, c->qid.path); 
1997/0327    
 
1991/0626    
			error(Enonexist); 
1993/0330    
		case 0: 


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