Fixes for compiling on 64bit and outside the source dir
[AROS.git] / tools / adflib / adf_blk.h
blobd67603546e83c7c081ed8dd7bb619ed22360284d
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 #define ULONG unsigned long
14 #define USHORT unsigned short
15 #define UCHAR unsigned char
17 #define LOGICAL_BLOCK_SIZE 512
19 /* ----- FILE SYSTEM ----- */
21 #define FSMASK_FFS 1
22 #define FSMASK_INTL 2
23 #define FSMASK_DIRCACHE 4
25 #define isFFS(c) ((c)&FSMASK_FFS)
26 #define isOFS(c) (!((c)&FSMASK_FFS))
27 #define isINTL(c) ((c)&FSMASK_INTL)
28 #define isDIRCACHE(c) ((c)&FSMASK_DIRCACHE)
31 /* ----- ENTRIES ----- */
33 /* access constants */
35 #define ACCMASK_D (1<<0)
36 #define ACCMASK_E (1<<1)
37 #define ACCMASK_W (1<<2)
38 #define ACCMASK_R (1<<3)
39 #define ACCMASK_A (1<<4)
40 #define ACCMASK_P (1<<5)
41 #define ACCMASK_S (1<<6)
42 #define ACCMASK_H (1<<7)
44 #define hasD(c) ((c)&ACCMASK_D)
45 #define hasE(c) ((c)&ACCMASK_E)
46 #define hasW(c) ((c)&ACCMASK_W)
47 #define hasR(c) ((c)&ACCMASK_R)
48 #define hasA(c) ((c)&ACCMASK_A)
49 #define hasP(c) ((c)&ACCMASK_P)
50 #define hasS(c) ((c)&ACCMASK_S)
51 #define hasH(c) ((c)&ACCMASK_H)
54 /* ----- BLOCKS ----- */
56 /* block constants */
58 #define BM_VALID -1
59 #define BM_INVALID 0
61 #define HT_SIZE 72
62 #define BM_SIZE 25
63 #define MAX_DATABLK 72
65 #define MAXNAMELEN 30
66 #define MAXCMMTLEN 79
69 /* block primary and secondary types */
71 #define T_HEADER 2
72 #define ST_ROOT 1
73 #define ST_DIR 2
74 #define ST_FILE -3
75 #define ST_LFILE -4
76 #define ST_LDIR 4
77 #define ST_LSOFT 3
78 #define T_LIST 16
79 #define T_DATA 8
80 #define T_DIRC 33
83 /*--- blocks structures --- */
86 struct bBootBlock {
87 /*000*/ char dosType[4];
88 /*004*/ ULONG checkSum;
89 /*008*/ long rootBlock;
90 /*00c*/ UCHAR data[500+512];
94 struct bRootBlock {
95 /*000*/ long type;
96 long headerKey;
97 long highSeq;
98 /*00c*/ long hashTableSize;
99 long firstData;
100 /*014*/ ULONG checkSum;
101 /*018*/ long hashTable[HT_SIZE]; /* hash table */
102 /*138*/ long bmFlag; /* bitmap flag, -1 means VALID */
103 /*13c*/ long bmPages[BM_SIZE];
104 /*1a0*/ long bmExt;
105 /*1a4*/ long cDays; /* creation date FFS and OFS */
106 /*1a8*/ long cMins;
107 /*1ac*/ long cTicks;
108 /*1b0*/ char nameLen;
109 /*1b1*/ char diskName[MAXNAMELEN+1];
110 char r2[8];
111 /*1d8*/ long days; /* last access : days after 1 jan 1978 */
112 /*1dc*/ long mins; /* hours and minutes in minutes */
113 /*1e0*/ long ticks; /* 1/50 seconds */
114 /*1e4*/ long coDays; /* creation date OFS */
115 /*1e8*/ long coMins;
116 /*1ec*/ long coTicks;
117 long nextSameHash; /* == 0 */
118 long parent; /* == 0 */
119 /*1f8*/ long extension; /* FFS: first directory cache block */
120 /*1fc*/ long secType; /* == 1 */
124 struct bFileHeaderBlock {
125 /*000*/ long type; /* == 2 */
126 /*004*/ long headerKey; /* current block number */
127 /*008*/ long highSeq; /* number of data block in this hdr block */
128 /*00c*/ long dataSize; /* == 0 */
129 /*010*/ long firstData;
130 /*014*/ ULONG checkSum;
131 /*018*/ long dataBlocks[MAX_DATABLK];
132 /*138*/ long r1;
133 /*13c*/ long r2;
134 /*140*/ long access; /* bit0=del, 1=modif, 2=write, 3=read */
135 /*144*/ unsigned long byteSize;
136 /*148*/ char commLen;
137 /*149*/ char comment[MAXCMMTLEN+1];
138 char r3[91-(MAXCMMTLEN+1)];
139 /*1a4*/ long days;
140 /*1a8*/ long mins;
141 /*1ac*/ long ticks;
142 /*1b0*/ char nameLen;
143 /*1b1*/ char fileName[MAXNAMELEN+1];
144 long r4;
145 /*1d4*/ long real; /* unused == 0 */
146 /*1d8*/ long nextLink; /* link chain */
147 long r5[5];
148 /*1f0*/ long nextSameHash; /* next entry with sane hash */
149 /*1f4*/ long parent; /* parent directory */
150 /*1f8*/ long extension; /* pointer to extension block */
151 /*1fc*/ long secType; /* == -3 */
155 /*--- file header extension block structure ---*/
157 struct bFileExtBlock {
158 /*000*/ long type; /* == 0x10 */
159 /*004*/ long headerKey;
160 /*008*/ long highSeq;
161 /*00c*/ long dataSize; /* == 0 */
162 /*010*/ long firstData; /* == 0 */
163 /*014*/ ULONG checkSum;
164 /*018*/ long dataBlocks[MAX_DATABLK];
165 long r[45];
166 long info; /* == 0 */
167 long nextSameHash; /* == 0 */
168 /*1f4*/ long parent; /* header block */
169 /*1f8*/ long extension; /* next header extension block */
170 /*1fc*/ long secType; /* -3 */
175 struct bDirBlock {
176 /*000*/ long type; /* == 2 */
177 /*004*/ long headerKey;
178 /*008*/ long highSeq; /* == 0 */
179 /*00c*/ long hashTableSize; /* == 0 */
180 long r1; /* == 0 */
181 /*014*/ ULONG checkSum;
182 /*018*/ long hashTable[HT_SIZE]; /* hash table */
183 long r2[2];
184 /*140*/ long access;
185 long r4; /* == 0 */
186 /*148*/ char commLen;
187 /*149*/ char comment[MAXCMMTLEN+1];
188 char r5[91-(MAXCMMTLEN+1)];
189 /*1a4*/ long days; /* last access */
190 /*1a8*/ long mins;
191 /*1ac*/ long ticks;
192 /*1b0*/ char nameLen;
193 /*1b1*/ char dirName[MAXNAMELEN+1];
194 long r6;
195 /*1d4*/ long real; /* ==0 */
196 /*1d8*/ long nextLink; /* link list */
197 long r7[5];
198 /*1f0*/ long nextSameHash;
199 /*1f4*/ long parent;
200 /*1f8*/ long extension; /* FFS : first directory cache */
201 /*1fc*/ long secType; /* == 2 */
206 struct bOFSDataBlock{
207 /*000*/ long type; /* == 8 */
208 /*004*/ long headerKey; /* pointer to file_hdr block */
209 /*008*/ long seqNum; /* file data block number */
210 /*00c*/ long dataSize; /* <= 0x1e8 */
211 /*010*/ long nextData; /* next data block */
212 /*014*/ ULONG checkSum;
213 /*018*/ UCHAR data[488];
214 /*200*/ };
217 /* --- bitmap --- */
219 struct bBitmapBlock {
220 /*000*/ ULONG checkSum;
221 /*004*/ ULONG map[127];
225 struct bBitmapExtBlock {
226 /*000*/ long bmPages[127];
227 /*1fc*/ long nextBlock;
231 struct bLinkBlock {
232 /*000*/ long type; /* == 2 */
233 /*004*/ long headerKey; /* self pointer */
234 long r1[3];
235 /*014*/ ULONG checkSum;
236 /*018*/ char realName[64];
237 long r2[83];
238 /*1a4*/ long days; /* last access */
239 /*1a8*/ long mins;
240 /*1ac*/ long ticks;
241 /*1b0*/ char nameLen;
242 /*1b1*/ char name[MAXNAMELEN+1];
243 long r3;
244 /*1d4*/ long realEntry;
245 /*1d8*/ long nextLink;
246 long r4[5];
247 /*1f0*/ long nextSameHash;
248 /*1f4*/ long parent;
249 long r5;
250 /*1fc*/ long secType; /* == -4, 4, 3 */
255 /*--- directory cache block structure ---*/
257 struct bDirCacheBlock {
258 /*000*/ long type; /* == 33 */
259 /*004*/ long headerKey;
260 /*008*/ long parent;
261 /*00c*/ long recordsNb;
262 /*010*/ long nextDirC;
263 /*014*/ ULONG checkSum;
264 /*018*/ unsigned char records[488];
268 #endif /* ADF_BLK_H */
269 /*##########################################################################*/