grub2: bring back build of aros-side grub2 tools
[AROS.git] / tools / adflib / adf_blk.h
blob1e687089ea314990fcb02676ac27433968a9338d
1 /*
2 * ADF Library. (C) 1997-1999 Laurent Clevy
4 * adf_blk.h
6 * general blocks structures
7 */
10 #ifndef ADF_BLK_H
11 #define ADF_BLK_H 1
13 #include "adf_defs.h"
15 #define LOGICAL_BLOCK_SIZE 512
17 /* ----- FILE SYSTEM ----- */
19 #define FSMASK_FFS 1
20 #define FSMASK_INTL 2
21 #define FSMASK_DIRCACHE 4
23 #define isFFS(c) ((c)&FSMASK_FFS)
24 #define isOFS(c) (!((c)&FSMASK_FFS))
25 #define isINTL(c) ((c)&FSMASK_INTL)
26 #define isDIRCACHE(c) ((c)&FSMASK_DIRCACHE)
29 /* ----- ENTRIES ----- */
31 /* access constants */
33 #define ACCMASK_D (1<<0)
34 #define ACCMASK_E (1<<1)
35 #define ACCMASK_W (1<<2)
36 #define ACCMASK_R (1<<3)
37 #define ACCMASK_A (1<<4)
38 #define ACCMASK_P (1<<5)
39 #define ACCMASK_S (1<<6)
40 #define ACCMASK_H (1<<7)
42 #define hasD(c) ((c)&ACCMASK_D)
43 #define hasE(c) ((c)&ACCMASK_E)
44 #define hasW(c) ((c)&ACCMASK_W)
45 #define hasR(c) ((c)&ACCMASK_R)
46 #define hasA(c) ((c)&ACCMASK_A)
47 #define hasP(c) ((c)&ACCMASK_P)
48 #define hasS(c) ((c)&ACCMASK_S)
49 #define hasH(c) ((c)&ACCMASK_H)
52 /* ----- BLOCKS ----- */
54 /* block constants */
56 #define BM_VALID -1
57 #define BM_INVALID 0
59 #define HT_SIZE 72
60 #define BM_SIZE 25
61 #define MAX_DATABLK 72
63 #define MAXNAMELEN 30
64 #define MAXCMMTLEN 79
67 /* block primary and secondary types */
69 #define T_HEADER 2
70 #define ST_ROOT 1
71 #define ST_DIR 2
72 #define ST_FILE -3
73 #define ST_LFILE -4
74 #define ST_LDIR 4
75 #define ST_LSOFT 3
76 #define T_LIST 16
77 #define T_DATA 8
78 #define T_DIRC 33
81 /*--- blocks structures --- */
84 struct bBootBlock {
85 /*000*/ TEXT dosType[4];
86 /*004*/ ULONG checkSum;
87 /*008*/ ULONG rootBlock;
88 /*00c*/ UCHAR data[500+512];
92 struct bRootBlock {
93 /*000*/ ULONG type;
94 ULONG headerKey;
95 ULONG highSeq;
96 /*00c*/ ULONG hashTableSize;
97 ULONG firstData;
98 /*014*/ ULONG checkSum;
99 /*018*/ ULONG hashTable[HT_SIZE]; /* hash table */
100 /*138*/ ULONG bmFlag; /* bitmap flag, -1 means VALID */
101 /*13c*/ ULONG bmPages[BM_SIZE];
102 /*1a0*/ ULONG bmExt;
103 /*1a4*/ ULONG cDays; /* creation date FFS and OFS */
104 /*1a8*/ ULONG cMins;
105 /*1ac*/ ULONG cTicks;
106 /*1b0*/ UBYTE nameLen;
107 /*1b1*/ TEXT diskName[MAXNAMELEN+1];
108 UBYTE r2[8];
109 /*1d8*/ ULONG days; /* last access : days after 1 jan 1978 */
110 /*1dc*/ ULONG mins; /* hours and minutes in minutes */
111 /*1e0*/ ULONG ticks; /* 1/50 seconds */
112 /*1e4*/ ULONG coDays; /* creation date OFS */
113 /*1e8*/ ULONG coMins;
114 /*1ec*/ ULONG coTicks;
115 ULONG nextSameHash; /* == 0 */
116 ULONG parent; /* == 0 */
117 /*1f8*/ ULONG extension; /* FFS: first directory cache block */
118 /*1fc*/ ULONG secType; /* == 1 */
122 struct bFileHeaderBlock {
123 /*000*/ ULONG type; /* == 2 */
124 /*004*/ ULONG headerKey; /* current block number */
125 /*008*/ ULONG highSeq; /* number of data block in this hdr block */
126 /*00c*/ ULONG dataSize; /* == 0 */
127 /*010*/ ULONG firstData;
128 /*014*/ ULONG checkSum;
129 /*018*/ ULONG dataBlocks[MAX_DATABLK];
130 /*138*/ ULONG r1;
131 /*13c*/ ULONG r2;
132 /*140*/ ULONG access; /* bit0=del, 1=modif, 2=write, 3=read */
133 /*144*/ ULONG byteSize;
134 /*148*/ UBYTE commLen;
135 /*149*/ TEXT comment[MAXCMMTLEN+1];
136 UBYTE r3[91-(MAXCMMTLEN+1)];
137 /*1a4*/ ULONG days;
138 /*1a8*/ ULONG mins;
139 /*1ac*/ ULONG ticks;
140 /*1b0*/ UBYTE nameLen;
141 /*1b1*/ TEXT fileName[MAXNAMELEN+1];
142 ULONG r4;
143 /*1d4*/ ULONG real; /* unused == 0 */
144 /*1d8*/ ULONG nextLink; /* link chain */
145 ULONG r5[5];
146 /*1f0*/ ULONG nextSameHash; /* next entry with sane hash */
147 /*1f4*/ ULONG parent; /* parent directory */
148 /*1f8*/ ULONG extension; /* pointer to extension block */
149 /*1fc*/ ULONG secType; /* == -3 */
153 /*--- file header extension block structure ---*/
155 struct bFileExtBlock {
156 /*000*/ ULONG type; /* == 0x10 */
157 /*004*/ ULONG headerKey;
158 /*008*/ ULONG highSeq;
159 /*00c*/ ULONG dataSize; /* == 0 */
160 /*010*/ ULONG firstData; /* == 0 */
161 /*014*/ ULONG checkSum;
162 /*018*/ ULONG dataBlocks[MAX_DATABLK];
163 ULONG r[45];
164 ULONG info; /* == 0 */
165 ULONG nextSameHash; /* == 0 */
166 /*1f4*/ ULONG parent; /* header block */
167 /*1f8*/ ULONG extension; /* next header extension block */
168 /*1fc*/ ULONG secType; /* -3 */
173 struct bDirBlock {
174 /*000*/ ULONG type; /* == 2 */
175 /*004*/ ULONG headerKey;
176 /*008*/ ULONG highSeq; /* == 0 */
177 /*00c*/ ULONG hashTableSize; /* == 0 */
178 ULONG r1; /* == 0 */
179 /*014*/ ULONG checkSum;
180 /*018*/ ULONG hashTable[HT_SIZE]; /* hash table */
181 ULONG r2[2];
182 /*140*/ ULONG access;
183 ULONG r4; /* == 0 */
184 /*148*/ UBYTE commLen;
185 /*149*/ TEXT comment[MAXCMMTLEN+1];
186 TEXT r5[91-(MAXCMMTLEN+1)];
187 /*1a4*/ ULONG days; /* last access */
188 /*1a8*/ ULONG mins;
189 /*1ac*/ ULONG ticks;
190 /*1b0*/ UBYTE nameLen;
191 /*1b1*/ TEXT dirName[MAXNAMELEN+1];
192 ULONG r6;
193 /*1d4*/ ULONG real; /* ==0 */
194 /*1d8*/ ULONG nextLink; /* link list */
195 ULONG r7[5];
196 /*1f0*/ ULONG nextSameHash;
197 /*1f4*/ ULONG parent;
198 /*1f8*/ ULONG extension; /* FFS : first directory cache */
199 /*1fc*/ ULONG secType; /* == 2 */
204 struct bOFSDataBlock{
205 /*000*/ ULONG type; /* == 8 */
206 /*004*/ ULONG headerKey; /* pointer to file_hdr block */
207 /*008*/ ULONG seqNum; /* file data block number */
208 /*00c*/ ULONG dataSize; /* <= 0x1e8 */
209 /*010*/ ULONG nextData; /* next data block */
210 /*014*/ ULONG checkSum;
211 /*018*/ UCHAR data[488];
212 /*200*/ };
215 /* --- bitmap --- */
217 struct bBitmapBlock {
218 /*000*/ ULONG checkSum;
219 /*004*/ ULONG map[127];
223 struct bBitmapExtBlock {
224 /*000*/ ULONG bmPages[127];
225 /*1fc*/ ULONG nextBlock;
229 struct bLinkBlock {
230 /*000*/ ULONG type; /* == 2 */
231 /*004*/ ULONG headerKey; /* self pointer */
232 ULONG r1[3];
233 /*014*/ ULONG checkSum;
234 /*018*/ TEXT realName[64];
235 ULONG r2[83];
236 /*1a4*/ ULONG days; /* last access */
237 /*1a8*/ ULONG mins;
238 /*1ac*/ ULONG ticks;
239 /*1b0*/ UBYTE nameLen;
240 /*1b1*/ TEXT name[MAXNAMELEN+1];
241 ULONG r3;
242 /*1d4*/ ULONG realEntry;
243 /*1d8*/ ULONG nextLink;
244 ULONG r4[5];
245 /*1f0*/ ULONG nextSameHash;
246 /*1f4*/ ULONG parent;
247 ULONG r5;
248 /*1fc*/ ULONG secType; /* == -4, 4, 3 */
253 /*--- directory cache block structure ---*/
255 struct bDirCacheBlock {
256 /*000*/ ULONG type; /* == 33 */
257 /*004*/ ULONG headerKey;
258 /*008*/ ULONG parent;
259 /*00c*/ ULONG recordsNb;
260 /*010*/ ULONG nextDirC;
261 /*014*/ ULONG checkSum;
262 /*018*/ UBYTE records[488];
266 #endif /* ADF_BLK_H */
267 /*##########################################################################*/