vacfs: implement -m flag

This commit is contained in:
Russ Cox 2008-04-17 16:12:34 -04:00
parent 6bcc5ae985
commit be3e351464
2 changed files with 14 additions and 21 deletions

View file

@ -14,10 +14,10 @@ vacfs \- a Venti-based file system
.B -h .B -h
.I host .I host
] ]
.\" [ [
.\" .B -m .B -m
.\" .I mtpt .I mtpt
.\" ] ]
[ [
.B -s .B -s
.I srvname .I srvname
@ -59,10 +59,9 @@ metaname
.TP .TP
.B -i .B -i
Use file descriptors 0 and 1 as the 9P communication channel rather than create a pipe. Use file descriptors 0 and 1 as the 9P communication channel rather than create a pipe.
.\" .TP .TP
.\" .BI -m " mtpt .BI -m " mtpt
.\" The location to mount the file system. The default is The location to mount the file system. The default is not to mount.
.\" .BR /n/vac .
.TP .TP
.BI -p .BI -p
Disables permission checking. Disables permission checking.

View file

@ -62,6 +62,7 @@ VtConn *conn;
/* VtSession *session; */ /* VtSession *session; */
int noperm; int noperm;
int dotu; int dotu;
char *defmnt;
Fid * newfid(int); Fid * newfid(int);
void error(char*); void error(char*);
@ -166,6 +167,9 @@ threadmain(int argc, char *argv[])
case 's': case 's':
defsrv = EARGF(usage()); defsrv = EARGF(usage());
break; break;
case 'm':
defmnt = EARGF(usage());
break;
case 'p': case 'p':
noperm = 1; noperm = 1;
break; break;
@ -189,7 +193,7 @@ threadmain(int argc, char *argv[])
mfd[1] = p[0]; mfd[1] = p[0];
proccreate(srv, 0, 32 * 1024); proccreate(srv, 0, 32 * 1024);
if(defsrv == nil){ if(defsrv == nil && defmnt == nil){
q = strrchr(argv[0], '/'); q = strrchr(argv[0], '/');
if(q) if(q)
q++; q++;
@ -203,7 +207,7 @@ threadmain(int argc, char *argv[])
defsrv[l-4] = 0; defsrv[l-4] = 0;
} }
if(post9pservice(p[1], defsrv) != 0) if(post9pservice(p[1], defsrv, defmnt) != 0)
sysfatal("post9pservice"); sysfatal("post9pservice");
threadexits(0); threadexits(0);
@ -814,18 +818,8 @@ io(void)
int n; int n;
for(;;){ for(;;){
/*
* reading from a pipe or a network device
* will give an error after a few eof reads
* however, we cannot tell the difference
* between a zero-length read and an interrupt
* on the processes writing to us,
* so we wait for the error
*/
n = read9pmsg(mfd[0], mdata, sizeof mdata); n = read9pmsg(mfd[0], mdata, sizeof mdata);
if(n == 0) if(n <= 0)
continue;
if(n < 0)
break; break;
if(convM2Su(mdata, n, &rhdr, dotu) != n) if(convM2Su(mdata, n, &rhdr, dotu) != n)
sysfatal("convM2S conversion error"); sysfatal("convM2S conversion error");