Subversion Repositories planix.SVN

Rev

Rev 2 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
2 - 1
#include <u.h>
2
#include <libc.h>
3
#include <auth.h>
4
#include <fcall.h>
5
#include <thread.h>
6
#include <9p.h>
7
#include "flashfs.h"
8
 
9
extern int	chatty9p;
10
 
11
static void
12
usage(void)
13
{
14
	fprint(2, "usage: %s [-rD] [-n nsect] [-z sectsize] [-m mount] [-f file]\n", argv0);
15
	exits("usage");
16
}
17
 
18
static ulong
19
argval(char *arg)
20
{
21
	long v;
22
	char *extra;
23
 
24
	if(arg == nil)
25
		usage();
26
	v = strtol(arg, &extra, 0);
27
	if(*extra || v <= 0)
28
		usage();
29
	return v;
30
}
31
 
32
void
33
main(int argc, char **argv)
34
{
35
	int ro;
36
	char *file, *mount;
37
 
38
	mount = "/n/brzr";
39
	ro = 0;
40
	file = "/dev/flash/fs";
41
 
42
	ARGBEGIN {
43
	case 'D':
44
		chatty9p++;
45
		break;
46
	case 'r':
47
		ro++;
48
		break;
49
	case 'n':
50
		nsects = argval(ARGF());
51
		break;
52
	case 'z':
53
		sectsize = argval(ARGF());
54
		break;
55
	case 'f':
56
		file = ARGF();
57
		break;
58
	case 'm':
59
		mount = ARGF();
60
		break;
61
	default:
62
		usage();
63
	} ARGEND
64
 
65
	if(argc != 0)
66
		usage();
67
 
68
	initdata(file, 0);
69
	sectbuff = emalloc9p(sectsize);
70
	einit();
71
	loadfs(ro);
72
	serve(mount);
73
	exits(nil);
74
}