/* * fundamental constants */ #define ERRREC 64 /* size of a ascii erro message */ #define DIRREC 116 /* size of a directory ascii record */ #define NAMELEN 28 /* size of names */ #define NDBLOCK 6 /* number of direct blocks in Dentry */ #define MAXDAT 8192 /* max allowable data message */ #define MAXMSG 128 /* max size protocol message sans data */ #define NTLOCK 200 /* number of active file Tlocks */ typedef struct Fbuf Fbuf; typedef struct Super1 Super1; typedef struct Superb Superb; typedef struct Qid Qid; typedef struct Dentry Dentry; typedef struct Tag Tag; /* * DONT TOUCH -- data structures stored on disk */ /* DONT TOUCH, this is the disk structure */ struct Qid { long path; long version; }; /* DONT TOUCH, this is the disk structure */ struct Dentry { char name[NAMELEN]; short uid; short gid; ushort mode; #define DALLOC 0x8000 #define DDIR 0x4000 #define DAPND 0x2000 #define DLOCK 0x1000 #define DREAD 0x4 #define DWRITE 0x2 #define DEXEC 0x1 Qid qid; long size; long dblock[NDBLOCK]; long iblock; long diblock; long atime; long mtime; }; /* DONT TOUCH, this is the disk structure */ struct Tag { short pad; short tag; long path; }; /* DONT TOUCH, this is the disk structure */ struct Super1 { long fstart; long fsize; long tfree; long qidgen; /* generator for unique ids */ long fsok; /* file system ok */ /* * garbage for WWC device */ long roraddr; /* dump root addr */ long last; /* last super block addr */ long next; /* next super block addr */ }; /* DONT TOUCH, this is the disk structure */ struct Fbuf { long nfree; long free[1]; /* changes based on BUFSIZE */ }; /* DONT TOUCH, this is the disk structure */ struct Superb { Super1 super; Fbuf fbuf; }; /* * tags on block */ enum { Tnone = 0, Tsuper, /* the super block */ Tdir, /* directory contents */ Tind1, /* points to blocks */ Tind2, /* points to Tind1 */ Tfile, /* file contents */ Tfree, /* in free list */ Tbuck, /* cache fs bucket */ Tvirgo, /* fake worm virgin bits */ Tcache, /* cw cache things */ MAXTAG }; /* * buffer size variables */ extern int RBUFSIZE; extern int BUFSIZE; extern int DIRPERBUF; extern int INDPERBUF; extern int INDPERBUF2; extern int FEPERBUF; #define QPDIR 0x80000000L #define QPNONE 0 #define QPROOT 1 #define QPSUPER 2 #define QID(a,b) (Qid){a,b}