예제 #1
0
파일: sysfile.c 프로젝트: Shamar/harvey
static int32_t
wstat(Chan* c, uint8_t* p, usize n)
{
	Proc *up = externup();
	int32_t l;
	usize namelen;

	if(waserror()){
		cclose(c);
		nexterror();
	}

	/*
	 * Renaming mount points is disallowed to avoid surprises
	 * (which should be renamed? the mount point or the mounted Chan?).
	 */
	if(c->ismtpt){
		dirname(p, &namelen);
		if(namelen)
			nameerror(chanpath(c), Eismtpt);
	}
	l = c->dev->wstat(c, p, n);
	poperror();
	cclose(c);

	return l;
}
예제 #2
0
파일: sysfile.c 프로젝트: Shamar/harvey
void
sysfd2path(Ar0* ar0, ...)
{
	Chan *c;
	char *buf;
	int fd;
	usize nbuf;
	va_list list;
	va_start(list, ar0);

	/*
	 * int fd2path(int fd, char* buf, int nbuf);
	 * should be
	 * int fd2path(int fd, char* buf, usize nbuf);
	 */
	fd = va_arg(list, int);
	buf = va_arg(list, char*);
	nbuf = va_arg(list, usize);
	va_end(list);
	buf = validaddr(buf, nbuf, 1);

	c = fdtochan(fd, -1, 0, 1);
	snprint(buf, nbuf, "%s", chanpath(c));
	cclose(c);

	ar0->i = 0;
}
예제 #3
0
파일: sysfile.c 프로젝트: Akheon23/nix-os
long
sysfd2path(ulong *arg)
{
	Chan *c;

	validaddr(arg[1], arg[2], 1);

	c = fdtochan(arg[0], -1, 0, 1);
	snprint((char*)arg[1], arg[2], "%s", chanpath(c));
	cclose(c);
	return 0;
}
예제 #4
0
파일: sdloop.c 프로젝트: Zabrane/smalltable
static char*
looprtopctl(SDev *s, char *p, char *e)
{
	Ctlr *c;
	char *r;

	c = s->ctlr;
	r = "ro";
	if(c->mode == ORDWR)
		r = "rw";
	return seprint(p, e, "%s loop %s %s\n", s->name, r, chanpath(c->c));
}
예제 #5
0
파일: sysfile.c 프로젝트: 0intro/vx32
long
sysfd2path(uint32 *arg)
{
	Chan *c;
	char *buf;

	buf = uvalidaddr(arg[1], arg[2], 1);

	c = fdtochan(arg[0], -1, 0, 1);
	snprint(buf, arg[2], "%s", chanpath(c));
	cclose(c);
	return 0;
}
예제 #6
0
파일: sdloop.c 프로젝트: Zabrane/smalltable
static int
looprctl(SDunit *unit, char *p, int l)
{
	Ctlr *ctlr;
	char *e, *op;
	
	ctlr = unit->dev->ctlr;
	e = p+l;
	op = p;
	
	p = seprint(p, e, "loop %s %s\n", ctlr->mode == ORDWR ? "rw" : "ro", chanpath(ctlr->c));
	p = seprint(p, e, "geometry %llud 512\n", unit->sectors*512);
	return p - op;
}
예제 #7
0
파일: sysfile.c 프로젝트: Akheon23/nix-os
static long
wstat(Chan *c, uchar *d, int nd)
{
	long l;
	int namelen;

	if(waserror()){
		cclose(c);
		nexterror();
	}
	if(c->ismtpt){
		/*
		 * Renaming mount points is disallowed to avoid surprises
		 * (which should be renamed? the mount point or the mounted Chan?).
		 */
		dirname(d, &namelen);
		if(namelen)
			nameerror(chanpath(c), Eismtpt);
	}
	l = devtab[c->type]->wstat(c, d, nd);
	poperror();
	cclose(c);
	return l;
}