2 * fundamental constants
4 #define NAMELEN 28 /* size of names */
5 #define NDBLOCK 6 /* number of direct blocks in Dentry */
6 #define MAXDAT 8192 /* max allowable data message */
7 #define NTLOCK 200 /* number of active file Tlocks */
9 typedef struct Fbuf Fbuf;
10 typedef struct Super1 Super1;
11 typedef struct Superb Superb;
12 // typedef struct Qid Qid;
13 typedef struct Dentry Dentry;
14 typedef struct Tag Tag;
16 typedef struct Device Device;
17 typedef struct Qid9p1 Qid9p1;
18 typedef struct File File;
19 typedef struct Filsys Filsys;
20 typedef struct Filta Filta;
21 typedef struct Filter Filter;
23 typedef struct Hiob Hiob;
24 typedef struct Iobuf Iobuf;
25 typedef struct P9call P9call;
26 typedef struct Tlock Tlock;
27 // typedef struct Tm Tm;
28 typedef struct Uid Uid;
29 typedef struct Wpath Wpath;
30 typedef struct AuthRpc AuthRpc;
33 * DONT TOUCH -- data structures stored on disk
35 /* DONT TOUCH, this is the disk structure */
42 /* DONT TOUCH, this is the disk structure */
65 /* DONT TOUCH, this is the disk structure */
73 /* DONT TOUCH, this is the disk structure */
79 long qidgen; /* generator for unique ids */
81 long fsok; /* file system ok */
84 * garbage for WWC device
86 long roraddr; /* dump root addr */
87 long last; /* last super block addr */
88 long next; /* next super block addr */
91 /* DONT TOUCH, this is the disk structure */
95 long free[1]; /* changes based on BUFSIZE */
98 /* DONT TOUCH, this is the disk structure */
118 ulong count; /* count and old count kept separate */
119 ulong oldcount; /* so interrput can read them */
120 Float filter[3]; /* filters for 1m 10m 100m */
130 * array of qids that are locked
145 Chan* cp; /* null means a free slot */
146 Tlock* tlock; /* if file is locked */
147 File* next; /* in cp->flist */
148 File* list; /* in list of free files */
152 long lastra; /* read ahead address */
160 long doffset; /* directory reading */
164 /* for network authentication */
171 char* name; /* name of filesys */
172 Device dev; /* device that filesys is on */
174 #define FREAM (1<<1) /* mkfs */
175 #define FRECOVER (1<<2) /* install last dump */
188 Iobuf *next; /* for hash */
189 Iobuf *fore; /* for lru */
190 Iobuf *back; /* for lru */
191 char *iobuf; /* only active while locked */
192 char *xiobuf; /* "real" buffer pointer */
202 void (*func)(Chan*, int);
207 // /* see ctime(3) */
221 short uid; /* user id */
222 short lead; /* leader of group */
223 short offset; /* byte offset in uidspace */
228 Wpath *up; /* pointer upwards in path */
229 Wpath *list; /* link in free chain */
230 long addr; /* directory entry addr of parent */
231 long slot; /* directory entry slot of parent */
232 short refs; /* number of files using this structure */
235 #define MAXFDATA 8192
238 * error codes generated from the file server
285 * devnone block numbers
306 Tsuper, /* the super block */
307 Tdir, /* directory contents */
308 Tind1, /* points to blocks */
309 Tind2, /* points to Tind1 */
310 Tfile, /* file contents */
311 Tfree, /* in free list */
312 Tbuck, /* cache fs bucket */
313 Tvirgo, /* fake worm virgin bits */
314 Tcache, /* cw cache things */
323 Bread = (1<<0), /* read the block if miss */
324 Bprobe = (1<<1), /* return null if miss */
325 Bmod = (1<<2), /* set modified bit in buffer */
326 Bimm = (1<<3), /* set immediate bit in buffer */
327 Bres = (1<<4), /* reserved, never renammed */
331 * open modes passed into P9 open/create
339 MTRUNC = (1<<4), /* truncate on open */
340 MCEXEC = (1<<5), /* close on exec (host) */
341 MRCLOSE = (1<<6), /* remove on close */
349 Crdall = (1<<0), /* read all files */
350 Ctag = (1<<1), /* rebuild tags */
351 Cpfile = (1<<2), /* print files */
352 Cpdir = (1<<3), /* print directories */
353 Cfree = (1<<4), /* rebuild free list */
354 Cream = (1<<6), /* clear all bad tags */
355 Cbad = (1<<7), /* clear all bad blocks */
356 Ctouch = (1<<8), /* touch old dir and indir */
357 Cquiet = (1<<9), /* report just nasty things */
361 * buffer size variables
365 extern int DIRPERBUF;
366 extern int INDPERBUF;
367 extern int INDPERBUF2;