1) Checking in filesystem example
[repair.git] / Repair / RepairCompiler / MCC / specs / filesystem / test3.struct
1 // sEXT2 - Simple File System Example
2 // Type Definition Language File
3
4 // structures are assumed to be aligned to double-word
5 // boundaries. fields are tightly packed, so reserved bits 
6 // can be used to add neccesary padding
7
8 Disk *d; 
9
10 structure Block {
11      reserved byte[d.s.blocksize];
12 }
13
14 structure Disk {
15      Block  b[d.s.NumberofBlocks];
16      label b[0]: Superblock s;
17      label b[1]: Groupblock g;
18 }
19
20 structure Superblock subtype of Block {
21      int FreeBlockCount;
22      int FreeInodeCount;
23      int NumberofBlocks;
24      int NumberofInodes;
25      int RootDirectoryInode;
26      int blocksize;
27 }
28
29 structure Groupblock subtype of Block {
30      int BlockBitmapBlock;
31      int InodeBitmapBlock;
32      int InodeTableBlock; 
33      int GroupFreeBlockCount;
34      int GroupFreeInodeCount;
35 }
36
37 structure InodeTable subtype of Block {
38      Inode itable[d.s.NumberofInodes];
39 }
40
41 structure InodeBitmap subtype of Block {
42      bit inodebitmap[d.s.NumberofInodes];
43 }
44
45 structure BlockBitmap subtype of Block {
46      bit blockbitmap[d.s.NumberofBlocks];
47 }
48
49 structure Inode {
50      int filesize;
51      int Blockptr[12];
52      int referencecount;
53 }
54
55 structure DirectoryBlock subtype of Block {
56      DirectoryEntry de[d.s.blocksize/128];
57 }
58
59 structure DirectoryEntry {
60      byte name[124];
61      int inodenumber;
62 }
63
64
65
66
67