1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
|
#include <u.h>
#include <libc.h>
#include <fcall.h>
#include <thread.h>
#include <9p.h>
#include "dat.h"
#include "fns.h"
#include "errstr.h"
int errno;
int rdonly;
char *srvfile;
char *deffile;
extern void iobuf_init(void);
extern Srv ext2srv;
void
usage(void)
{
fprint(2, "usage: %s [-v] [-s] [-r] [-p passwd] [-g group] [-f devicefile] [srvname]\n", argv0);
exits("usage");
}
/*void handler(void *v, char *sig)
{
USED(v,sig);
syncbuf();
noted(NDFLT);
}*/
void
main(int argc, char **argv)
{
int stdio;
stdio = 0;
ARGBEGIN{
case 'D':
++chatty9p;
break;
case 'v':
++chatty;
break;
case 'f':
deffile = ARGF();
break;
case 'g':
gidfile(ARGF());
break;
case 'p':
uidfile(ARGF());
break;
case 's':
stdio = 1;
break;
case 'r':
rdonly = 1;
break;
default:
usage();
}ARGEND
if(argc == 0)
srvfile = "ext2";
else if(argc == 1)
srvfile = argv[0];
else
usage();
iobuf_init();
/*notify(handler);*/
if(!chatty){
close(2);
open("#c/cons", OWRITE);
}
if(stdio){
srv(&ext2srv);
}else{
chat("%s %d: serving %s\n", argv0, getpid(), srvfile);
postmountsrv(&ext2srv, srvfile, 0, 0);
}
exits(0);
}
char *
xerrstr(int e)
{
if (e < 0 || e >= sizeof errmsg/sizeof errmsg[0])
return "no such error";
else
return errmsg[e];
}
|