add -a aname

This commit is contained in:
rsc 2007-06-21 02:11:21 +00:00
parent 6654bd74cb
commit 9ec386fef4
2 changed files with 19 additions and 15 deletions

View file

@ -7,12 +7,12 @@
.B -D .B -D
] ]
[ [
.B -a .B -A
.I t .I t
] ]
[ [
.B -e .B -a
.I t .I aname
] ]
.I addr .I addr
.I mtpt .I mtpt
@ -34,16 +34,16 @@ The options are:
.B -D .B -D
Print each FUSE and 9P message to standard error. Print each FUSE and 9P message to standard error.
.TP .TP
.B -a\fI t .B -a\fI aname
Use
.I aname
as the attach name.
.TP
.B -A\fI t
Set the kernel cache timeout for attribute information Set the kernel cache timeout for attribute information
to to
.I t .I t
(default 1.0) seconds. (default 1.0) seconds.
.TP
.B -e\fI t
Set the kernel cache timeout for directory entries to
.I t
(default 1.0) seconds.
.PD .PD
.PP .PP
The The

View file

@ -33,6 +33,7 @@
int debug; int debug;
char *argv0; char *argv0;
char *aname = "";
void fusedispatch(void*); void fusedispatch(void*);
Channel *fusechan; Channel *fusechan;
@ -57,12 +58,12 @@ double entrytimeout = 1.0;
CFsys *fsys; CFsys *fsys;
CFid *fsysroot; CFid *fsysroot;
void init9p(char*); void init9p(char*, char*);
void void
usage(void) usage(void)
{ {
fprint(2, "usage: 9pfuse [-D] [-a attrtimeout] address mtpt\n"); fprint(2, "usage: 9pfuse [-D] [-A attrtimeout] [-a aname] address mtpt\n");
exit(1); exit(1);
} }
@ -76,9 +77,12 @@ threadmain(int argc, char **argv)
chatty9pclient++; chatty9pclient++;
debug++; debug++;
break; break;
case 'a': case 'A':
attrtimeout = atof(EARGF(usage())); attrtimeout = atof(EARGF(usage()));
break; break;
case 'a':
aname = EARGF(usage());
break;
default: default:
usage(); usage();
}ARGEND }ARGEND
@ -93,7 +97,7 @@ threadmain(int argc, char **argv)
setsid(); /* won't be able to use console, but can't be interrupted */ setsid(); /* won't be able to use console, but can't be interrupted */
init9p(argv[0]); init9p(argv[0], aname);
initfuse(argv[1]); initfuse(argv[1]);
fusechan = chancreate(sizeof(void*), 0); fusechan = chancreate(sizeof(void*), 0);
@ -122,13 +126,13 @@ fusereader(void *v)
} }
void void
init9p(char *addr) init9p(char *addr, char *spec)
{ {
int fd; int fd;
if((fd = dial(netmkaddr(addr, "tcp", "564"), nil, nil, nil)) < 0) if((fd = dial(netmkaddr(addr, "tcp", "564"), nil, nil, nil)) < 0)
sysfatal("dial %s: %r", addr); sysfatal("dial %s: %r", addr);
if((fsys = fsmount(fd, "")) == nil) if((fsys = fsmount(fd, spec)) == nil)
sysfatal("fsmount: %r"); sysfatal("fsmount: %r");
fsysroot = fsroot(fsys); fsysroot = fsroot(fsys);
} }