xref: /plan9/sys/src/cmd/disk/kfs/dat.c (revision 219b2ee8daee37f4aad58d63f21287faa8e4ffdc)
1 #include	"all.h"
2 
3 Uid*	uid;
4 char*	uidspace;
5 short*	gidspace;
6 File*	files;
7 Wpath*	wpaths;
8 Lock	wpathlock;
9 Lock	newfplock;
10 RWlock	mainlock;
11 long	boottime;
12 Tlock	*tlocks;
13 Conf	conf;
14 Cons	cons;
15 Chan	*chan;
16 char	service[2*NAMELEN];
17 char	*progname;
18 char	*procname;
19 int	RBUFSIZE;
20 int	BUFSIZE;
21 int	DIRPERBUF;
22 int	INDPERBUF;
23 int	INDPERBUF2;
24 int	FEPERBUF;
25 
26 Filsys	filsys[MAXFILSYS] =
27 {
28 	{"main",	{Devwren, 0, 0, 0},	0},
29 };
30 
31 Device 	devnone = {Devnone, 0, 0, 0};
32 
33 Devcall devcall[MAXDEV] = {
34 	[Devnone]	{0},
35 	[Devwren]	{wreninit, wrenream, wrencheck, wrensuper, wrenroot, wrensize, wrenread, wrenwrite},
36 };
37 
38 void
39 (*p9call[MAXSYSCALL])(Chan*, Fcall*, Fcall*) =
40 {
41 	[Tnop]		f_nop,
42 	[Tsession]	f_session,
43 	[Tflush]	f_flush,
44 	[Tattach]	f_attach,
45 	[Tclone]	f_clone,
46 	[Twalk]		f_walk,
47 	[Topen]		f_open,
48 	[Tcreate]	f_create,
49 	[Tread]		f_read,
50 	[Twrite]	f_write,
51 	[Tclunk]	f_clunk,
52 	[Tremove]	f_remove,
53 	[Tstat]		f_stat,
54 	[Twstat]	f_wstat,
55 	[Tclwalk]	f_clwalk,
56 };
57 
58 char*	tagnames[] =
59 {
60 	[Tbuck]		"Tbuck",
61 	[Tdir]		"Tdir",
62 	[Tfile]		"Tfile",
63 	[Tfree]		"Tfree",
64 	[Tind1]		"Tind1",
65 	[Tind2]		"Tind2",
66 	[Tnone]		"Tnone",
67 	[Tsuper]	"Tsuper",
68 	[Tvirgo]	"Tvirgo",
69 	[Tcache]	"Tcache",
70 };
71 
72 char	*errstr[MAXERR] =
73 {
74 	[Ebadspc]	"attach -- bad specifier",
75 	[Efid]		"unknown fid",
76 	[Echar]		"bad character in directory name",
77 	[Eopen]		"read/write -- on non open fid",
78 	[Ecount]	"read/write -- count too big",
79 	[Ealloc]	"phase error -- directory entry not allocated",
80 	[Eqid]		"phase error -- qid does not match",
81 	[Eauth]		"no authentication",
82 	[Eaccess]	"access permission denied",
83 	[Eentry]	"directory entry not found",
84 	[Emode]		"open/create -- unknown mode",
85 	[Edir1]		"walk -- in a non-directory",
86 	[Edir2]		"create -- in a non-directory",
87 	[Ephase]	"phase error -- cannot happen",
88 	[Eexist]	"create -- file exists",
89 	[Edot]		"create -- . and .. illegal names",
90 	[Eempty]	"remove -- directory not empty",
91 	[Ebadu]		"attach -- privileged user",
92 	[Enotu]		"wstat -- not owner",
93 	[Enotg]		"wstat -- not in group",
94 	[Ename]		"create/wstat -- bad character in file name",
95 	[Ewalk]		"walk -- too many (system wide)",
96 	[Eronly]	"file system read only",
97 	[Efull]		"file system full",
98 	[Eoffset]	"read/write -- offset negative",
99 	[Elocked]	"open/create -- file is locked",
100 	[Ebroken]	"close/read/write -- lock is broken",
101 };
102