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

1990/11211/port/chan.c (diff list | history)

1990/1104/sys/src/9/port/chan.c:80,901990/11211/sys/src/9/port/chan.c:80,91 (short | long | prev | next)
1990/0227    
		c->flag = 0; 
		c->ref = 1; 
		unlock(&chanalloc); 
1990/11211    
		c->dev = 0; 
1990/0227    
		c->offset = 0; 
		c->mnt = 0; 
		c->stream = 0; 
1990/0303    
		c->mchan = 0; 
		c->mqid = 0; 
1990/11211    
		c->mqid = (Qid){0, 0}; 
1990/0227    
		return c; 
	} 
	unlock(&chanalloc); 
1990/1104/sys/src/9/port/chan.c:116,1251990/11211/sys/src/9/port/chan.c:117,134
1990/0227    
} 
 
int 
eqchan(Chan *a, Chan *b, long qmask) 
1990/11211    
eqqid(Qid a, Qid b) 
1990/0227    
{ 
	if((a->qid^b->qid) & qmask) 
1990/11211    
	return a.path==b.path && a.vers==b.vers; 
} 
 
int 
eqchan(Chan *a, Chan *b, int pathonly) 
{ 
	if(a->qid.path != b->qid.path) 
1990/0227    
		return 0; 
1990/11211    
	if(!pathonly && a->qid.vers!=b->qid.vers) 
		return 0; 
1990/0227    
	if(a->type != b->type) 
		return 0; 
	if(a->dev != b->dev) 
1990/1104/sys/src/9/port/chan.c:158,1671990/11211/sys/src/9/port/chan.c:167,176
1990/0227    
	Pgrp *pg; 
1990/0321    
	int islast; 
1990/0227    
 
	if(CHDIR & (old->qid^new->qid)) 
		error(0, Emount); 
	if((old->qid&CHDIR)==0 && (flag&MORDER)!=MREPL) 
		error(0, Emount); 
1990/11211    
	if(CHDIR & (old->qid.path^new->qid.path)) 
		error(Emount); 
	if((old->qid.path&CHDIR)==0 && (flag&MORDER)!=MREPL) 
		error(Emount); 
1990/0227    
 
	mz = 0; 
1990/0321    
	islast = 0; 
1990/1104/sys/src/9/port/chan.c:190,1961990/11211/sys/src/9/port/chan.c:199,205
1990/0227    
	} 
	if(mz == 0){ 
		if(i == conf.nmtab) 
			error(0, Enomount); 
1990/11211    
			error(Enomount); 
1990/0227    
		mz = &pg->mtab[i]; 
1990/0321    
		islast++; 
1990/0227    
	} 
1990/1104/sys/src/9/port/chan.c:210,2161990/11211/sys/src/9/port/chan.c:219,225
1990/0227    
	 */ 
	case MBEFORE: 
		if(mt->mnt == 0) 
			error(0, Enotunion); 
1990/11211    
			error(Enotunion); 
1990/0227    
		/* fall through */ 
 
	case MREPL: 
1990/1104/sys/src/9/port/chan.c:227,2331990/11211/sys/src/9/port/chan.c:236,242
1990/0227    
	 */ 
	case MAFTER: 
		if(mt->mnt == 0) 
			error(0, Enotunion); 
1990/11211    
			error(Enotunion); 
1990/0227    
		omnt = mt->mnt; 
		pmnt = 0; 
		while(!omnt->term){ 
1990/1104/sys/src/9/port/chan.c:416,4261990/11211/sys/src/9/port/chan.c:425,435
1990/0227    
	mnt = c->mnt; 
	if(c->mountid != mnt->mountid){ 
1990/0321    
		pprint("createdir: changed underfoot?\n"); 
1990/0227    
		error(0, Enocreate); 
1990/11211    
		error(Enocreate); 
1990/0227    
	} 
	do{ 
		if(mnt->term) 
			error(0, Enocreate); 
1990/11211    
			error(Enocreate); 
1990/0227    
		mnt = mnt->next; 
	}while(!(mnt->c->flag&CCREATE)); 
	mc = mnt->c; 
1990/1104/sys/src/9/port/chan.c:457,4631990/11211/sys/src/9/port/chan.c:466,472
1990/0821    
	char *elem; 
1990/0227    
 
	if(name[0] == 0) 
		error(0, Enonexist); 
1990/11211    
		error(Enonexist); 
1990/0821    
 
	/* 
	 * Make sure all of name is o.k.  first byte is validated 
1990/1104/sys/src/9/port/chan.c:484,4931990/11211/sys/src/9/port/chan.c:493,502
1990/0227    
	}else if(name[0] == '#'){ 
		mntok = 0; 
1990/1009    
		if(name[1]=='M') 
1990/0227    
			error(0, Enonexist); 
1990/11211    
			error(Enonexist); 
1990/0227    
		t = devno(name[1], 1); 
		if(t == -1) 
			error(0, Ebadsharp); 
1990/11211    
			error(Ebadsharp); 
1990/0227    
		name += 2; 
		if(*name == '/'){ 
			name = skipslash(name); 
1990/1104/sys/src/9/port/chan.c:519,5251990/11211/sys/src/9/port/chan.c:528,534
1990/0227    
	 */ 
	while(*name){ 
		if((nc=walk(c, elem, mntok)) == 0) 
			error(0, Enonexist); 
1990/11211    
			error(Enonexist); 
1990/0227    
		c = nc; 
		name = nextelem(name, elem); 
	} 
1990/1104/sys/src/9/port/chan.c:534,5401990/11211/sys/src/9/port/chan.c:543,549
1990/0820    
			c = domount(c); 
		else{ 
			if((nc=walk(c, elem, mntok)) == 0) 
				error(0, Enonexist); 
1990/11211    
				error(Enonexist); 
1990/0820    
			c = nc; 
		} 
1990/0227    
		break; 
1990/1104/sys/src/9/port/chan.c:545,5541990/11211/sys/src/9/port/chan.c:554,563
1990/0227    
		 * so one may mount on / or . and see the effect. 
		 */ 
		if((nc=walk(c, elem, 0)) == 0) 
			error(0, Enonexist); 
1990/11211    
			error(Enonexist); 
1990/0227    
		c = nc; 
		if(!(c->qid & CHDIR)) 
			error(0, Enotdir); 
1990/11211    
		if(!(c->qid.path & CHDIR)) 
			error(Enotdir); 
1990/0227    
		break; 
 
	case Aopen: 
1990/1104/sys/src/9/port/chan.c:556,5621990/11211/sys/src/9/port/chan.c:565,571
1990/0820    
			c = domount(c); 
		else{ 
			if((nc=walk(c, elem, mntok)) == 0) 
				error(0, Enonexist); 
1990/11211    
				error(Enonexist); 
1990/0820    
			c = nc; 
		} 
1990/0227    
	Open: 
1990/1104/sys/src/9/port/chan.c:573,5851990/11211/sys/src/9/port/chan.c:582,594
1990/0227    
		 * the replacement. 
		 */ 
		if((nc=walk(c, elem, 0)) == 0) 
			error(0, Enonexist); 
1990/11211    
			error(Enonexist); 
1990/0227    
		c = nc; 
		break; 
 
	case Acreate: 
1990/0820    
		if(isdot) 
			error(0, Eisdir); 
1990/11211    
			error(Eisdir); 
1990/0227    
		if((nc=walk(c, elem, 1)) != 0){ 
			c = nc; 
			omode |= OTRUNC; 
1990/1104/sys/src/9/port/chan.c:637,6481990/11211/sys/src/9/port/chan.c:646,657
1990/0227    
	char *end, *e; 
 
	if(*name == '/') 
		error(0, Efilename); 
1990/11211    
		error(Efilename); 
1990/0821    
	end = memchr(name, 0, NAMELEN); 
1990/0227    
	if(end == 0){ 
1990/0821    
		end = memchr(name, '/', NAMELEN); 
1990/0227    
		if(end == 0) 
			error(0, Efilename); 
1990/11211    
			error(Efilename); 
1990/0227    
	}else{ 
		e = memchr(name, '/', end-name); 
		if(e) 
1990/1104/sys/src/9/port/chan.c:651,6571990/11211/sys/src/9/port/chan.c:660,666
1990/0227    
	while(name < end){ 
		c = *name++; 
		if((c&0x80) || isfrog[c]) 
			error(0, Ebadchar); 
1990/11211    
			error(Ebadchar); 
1990/0227    
		*elem++ = c; 
	} 
	*elem = 0; 
1990/1104/sys/src/9/port/chan.c:661,6671990/11211/sys/src/9/port/chan.c:670,676
1990/0227    
void 
isdir(Chan *c) 
{ 
	if(c->qid & CHDIR) 
1990/11211    
	if(c->qid.path & CHDIR) 
1990/0227    
		return; 
	error(0, Enotdir); 
1990/11211    
	error(Enotdir); 
1990/0227    
} 


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