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