hjfs: network announce/listen support
This commit is contained in:
parent
a5b6143c4c
commit
0c85432359
4 changed files with 22 additions and 5 deletions
|
@ -15,6 +15,9 @@ hjfs \- file server
|
|||
.B -n
|
||||
.I name
|
||||
] [
|
||||
.B -a
|
||||
.I announce-string
|
||||
] ... [
|
||||
-r
|
||||
] [
|
||||
.B -S
|
||||
|
@ -46,6 +49,9 @@ Use
|
|||
.I name
|
||||
as the name of the service.
|
||||
.TP
|
||||
.BI "-a " announce-string
|
||||
will announce and listen on the specified network address.
|
||||
.TP
|
||||
.B -r
|
||||
Ream the file system, erasing all of the old data.
|
||||
.TP
|
||||
|
|
|
@ -135,8 +135,10 @@ static Srv mysrv = {
|
|||
};
|
||||
|
||||
void
|
||||
start9p(char *service, int stdio)
|
||||
start9p(char *service, char **nets, int stdio)
|
||||
{
|
||||
while(nets && *nets)
|
||||
threadlistensrv(&mysrv, *nets++);
|
||||
if(stdio){
|
||||
mysrv.infd = 1;
|
||||
mysrv.outfd = 1;
|
||||
|
|
|
@ -25,7 +25,7 @@ int chanwstat(Chan *, Dir *);
|
|||
int permcheck(Fs *, Dentry *, short, int);
|
||||
char * uid2name(Fs *, short, char *);
|
||||
int name2uid(Fs *, char *, short *);
|
||||
void start9p(char *, int);
|
||||
void start9p(char *, char **, int);
|
||||
int chanclunk(Chan *);
|
||||
int chanremove(Chan *);
|
||||
int getblk(Fs *, FLoc *, Buf *, uvlong, uvlong *, int);
|
||||
|
|
|
@ -86,7 +86,7 @@ syncproc(void *)
|
|||
void
|
||||
usage(void)
|
||||
{
|
||||
fprint(2, "usage: %s [-rsS] [-m mem] [-n service] -f dev\n", argv0);
|
||||
fprint(2, "usage: %s [-rsS] [-m mem] [-n service] [-a announce-string]... -f dev\n", argv0);
|
||||
exits("usage");
|
||||
}
|
||||
|
||||
|
@ -94,9 +94,11 @@ void
|
|||
threadmain(int argc, char **argv)
|
||||
{
|
||||
Dev *d;
|
||||
static char *nets[8];
|
||||
char *file, *service;
|
||||
int doream, flags, stdio, nbuf;
|
||||
int doream, flags, stdio, nbuf, netc;
|
||||
|
||||
netc = 0;
|
||||
doream = 0;
|
||||
stdio = 0;
|
||||
flags = FSNOAUTH;
|
||||
|
@ -115,6 +117,13 @@ threadmain(int argc, char **argv)
|
|||
if(nbuf < 10)
|
||||
nbuf = 10;
|
||||
break;
|
||||
case 'a':
|
||||
if(netc >= nelem(nets)-1){
|
||||
fprint(2, "%s: too many networks to announce\n", argv0);
|
||||
exits("too many nets");
|
||||
}
|
||||
nets[netc++] = estrdup(EARGF(usage()));
|
||||
break;
|
||||
default: usage();
|
||||
} ARGEND;
|
||||
rfork(RFNOTEG);
|
||||
|
@ -131,7 +140,7 @@ threadmain(int argc, char **argv)
|
|||
sysfatal("fsinit: %r");
|
||||
initcons(service);
|
||||
proccreate(syncproc, nil, mainstacksize);
|
||||
start9p(service, stdio);
|
||||
start9p(service, nets, stdio);
|
||||
threadexits(nil);
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue