1 /* 2 * format of cache on disk 3 */ 4 typedef struct Dptr Dptr; 5 typedef struct Dahdr Dahdr; 6 typedef struct Dalloc Dalloc; 7 typedef struct Fphdr Fphdr; 8 typedef struct Fptr Fptr; 9 typedef struct Inode Inode; 10 typedef struct Dihdr Dihdr; 11 typedef struct Dinode Dinode; 12 13 enum 14 { 15 Amagic= 0xfaafaa, /* allocation block magic */ 16 Imagic= 0xdeadbeef, /* inode block magic */ 17 BtoUL= 8*sizeof(ulong),/* bits in a ulong */ 18 }; 19 #define Indbno 0x80000000 /* indirect block */ 20 #define Notabno 0xFFFFFFFF /* not a block number */ 21 22 /* 23 * Allocation blocks at the begining of the disk. There are 24 * enough of these blocks to supply 1 bit for each block on the 25 * disk; 26 */ 27 struct Dahdr 28 { 29 ulong magic; 30 ulong bsize; /* logical block size */ 31 char name[NAMELEN]; 32 short nab; /* number of allocation blocks */ 33 }; 34 struct Dalloc 35 { 36 Dahdr; 37 ulong bits[1]; 38 }; 39 40 /* 41 * A pointer to disk data 42 */ 43 struct Dptr 44 { 45 ulong fbno; /* file block number */ 46 ulong bno; /* disk block number */ 47 ushort start; /* offset into block of valid data */ 48 ushort end; /* offset into block after valid data */ 49 }; 50 51 /* 52 * A file descriptor. 53 */ 54 struct Inode 55 { 56 Qid qid; 57 Dptr ptr; /* pointer page */ 58 char inuse; 59 }; 60 61 /* 62 * inode blocks (after allocation blocks) 63 */ 64 struct Dihdr 65 { 66 ulong magic; 67 ulong nino; /* number of inodes */ 68 }; 69 struct Dinode 70 { 71 Dihdr; 72 Inode inode[1]; 73 }; 74