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

gnot/devdup.c (diff list | history)

1990/03091/sys/src/9/gnot/devdup.c:20,261990/11211/sys/src/9/gnot/devdup.c:20,26 (short | long)
1990/03091    
	if((f=u->fd[s]) == 0) 
		return 0; 
	sprint(buf, "%ld", s); 
	devdir(c, s, buf, 0, perm[f->mode&3], dp); 
1990/11211    
	devdir(c, (Qid){s, 0}, buf, 0, perm[f->mode&3], dp); 
1990/03091    
	return 1; 
} 
 
1990/03091/sys/src/9/gnot/devdup.c:63,781990/11211/sys/src/9/gnot/devdup.c:63,78
1990/03091    
{ 
	Chan *f; 
 
	if(c->qid == CHDIR){ 
1990/11211    
	if(c->qid.path == CHDIR){ 
1990/03091    
		if(omode != 0) 
			error(0, Eisdir); 
1990/11211    
			error(Eisdir); 
1990/03091    
		c->mode = 0; 
		c->flag |= COPEN; 
		c->offset = 0; 
		return c; 
	} 
	fdtochan(c->qid, openmode(omode));	/* error check only */ 
	f = u->fd[c->qid]; 
1990/11211    
	fdtochan(c->qid.path, openmode(omode));	/* error check only */ 
	f = u->fd[c->qid.path]; 
1990/03091    
	close(c); 
	incref(f); 
	return f; 
1990/03091/sys/src/9/gnot/devdup.c:81,991990/11211/sys/src/9/gnot/devdup.c:81,99
1990/03091    
void 
dupcreate(Chan *c, char *name, int omode, ulong perm) 
{ 
	error(0, Eperm); 
1990/11211    
	error(Eperm); 
1990/03091    
} 
 
void 
dupremove(Chan *c) 
{ 
	error(0, Eperm); 
1990/11211    
	error(Eperm); 
1990/03091    
} 
 
void 
dupwstat(Chan *c, char *dp) 
{ 
	error(0, Egreg); 
1990/11211    
	error(Egreg); 
1990/03091    
} 
 
void 
1990/03091/sys/src/9/gnot/devdup.c:106,1121990/11211/sys/src/9/gnot/devdup.c:106,112
1990/03091    
{ 
	char *a = va; 
 
	if(c->qid != CHDIR) 
1990/11211    
	if(c->qid.path != CHDIR) 
1990/03091    
		panic("dupread"); 
	return devdirread(c, a, n, (Dirtab *)0, 0L, dupgen); 
} 
1990/03091/sys/src/9/gnot/devdup.c:115,1301990/11211/sys/src/9/gnot/devdup.c:115,118
1990/03091    
dupwrite(Chan *c, void *va, long n) 
{ 
	panic("dupwrite"); 
} 
                 
void 
duperrstr(Error *e, char *buf) 
{ 
	rooterrstr(e, buf); 
} 
                 
void 
dupuserstr(Error *e, char *buf) 
{ 
	consuserstr(e, buf); 
} 
1990/11211/sys/src/9/gnot/devdup.c:1,1181990/1210/sys/src/9/gnot/devdup.c:0 (short | long)
Deleted.
rsc Mon Mar 7 10:21:39 2005
1990/03091    
#include	"u.h" 
#include	"lib.h" 
#include	"mem.h" 
#include	"dat.h" 
#include	"fns.h" 
#include	"errno.h" 
                 
#include	"devtab.h" 
                 
                 
int 
dupgen(Chan *c, Dirtab *tab, int ntab, int s, Dir *dp) 
{ 
	char buf[8]; 
	Chan *f; 
	static int perm[] = { 0400, 0200, 0600, 0 }; 
                 
	if(s >= NFD) 
		return -1; 
	if((f=u->fd[s]) == 0) 
		return 0; 
	sprint(buf, "%ld", s); 
1990/11211    
	devdir(c, (Qid){s, 0}, buf, 0, perm[f->mode&3], dp); 
1990/03091    
	return 1; 
} 
                 
void 
dupinit(void) 
{ 
} 
                 
void 
dupreset(void) 
{ 
} 
                 
Chan * 
dupattach(char *spec) 
{ 
	return devattach('d', spec); 
} 
                 
Chan * 
dupclone(Chan *c, Chan *nc) 
{ 
	return devclone(c, nc); 
} 
                 
int 
dupwalk(Chan *c, char *name) 
{ 
	return devwalk(c, name, (Dirtab *)0, 0, dupgen); 
} 
                 
void 
dupstat(Chan *c, char *db) 
{ 
	devstat(c, db, (Dirtab *)0, 0L, dupgen); 
} 
                 
Chan * 
dupopen(Chan *c, int omode) 
{ 
	Chan *f; 
                 
1990/11211    
	if(c->qid.path == CHDIR){ 
1990/03091    
		if(omode != 0) 
1990/11211    
			error(Eisdir); 
1990/03091    
		c->mode = 0; 
		c->flag |= COPEN; 
		c->offset = 0; 
		return c; 
	} 
1990/11211    
	fdtochan(c->qid.path, openmode(omode));	/* error check only */ 
	f = u->fd[c->qid.path]; 
1990/03091    
	close(c); 
	incref(f); 
	return f; 
} 
                 
void 
dupcreate(Chan *c, char *name, int omode, ulong perm) 
{ 
1990/11211    
	error(Eperm); 
1990/03091    
} 
                 
void 
dupremove(Chan *c) 
{ 
1990/11211    
	error(Eperm); 
1990/03091    
} 
                 
void 
dupwstat(Chan *c, char *dp) 
{ 
1990/11211    
	error(Egreg); 
1990/03091    
} 
                 
void 
dupclose(Chan *c) 
{ 
} 
                 
long 
dupread(Chan *c, void *va, long n) 
{ 
	char *a = va; 
                 
1990/11211    
	if(c->qid.path != CHDIR) 
1990/03091    
		panic("dupread"); 
	return devdirread(c, a, n, (Dirtab *)0, 0L, dupgen); 
} 
                 
long 
dupwrite(Chan *c, void *va, long n) 
{ 
	panic("dupwrite"); 
} 


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