2 * ADF Library. (C) 1997-1999 Laurent Clevy
6 * general blocks structures
13 #define ULONG unsigned long
14 #define USHORT unsigned short
15 #define UCHAR unsigned char
17 #define LOGICAL_BLOCK_SIZE 512
19 /* ----- FILE SYSTEM ----- */
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 ----- */
63 #define MAX_DATABLK 72
69 /* block primary and secondary types */
83 /*--- blocks structures --- */
87 /*000*/ char dosType
[4];
88 /*004*/ ULONG checkSum
;
89 /*008*/ long rootBlock
;
90 /*00c*/ UCHAR data
[500+512];
98 /*00c*/ long hashTableSize
;
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
];
105 /*1a4*/ long cDays
; /* creation date FFS and OFS */
108 /*1b0*/ char nameLen
;
109 /*1b1*/ char diskName
[MAXNAMELEN
+1];
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 */
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
];
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)];
142 /*1b0*/ char nameLen
;
143 /*1b1*/ char fileName
[MAXNAMELEN
+1];
145 /*1d4*/ long real
; /* unused == 0 */
146 /*1d8*/ long nextLink
; /* link chain */
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
];
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 */
176 /*000*/ long type
; /* == 2 */
177 /*004*/ long headerKey
;
178 /*008*/ long highSeq
; /* == 0 */
179 /*00c*/ long hashTableSize
; /* == 0 */
181 /*014*/ ULONG checkSum
;
182 /*018*/ long hashTable
[HT_SIZE
]; /* hash table */
186 /*148*/ char commLen
;
187 /*149*/ char comment
[MAXCMMTLEN
+1];
188 char r5
[91-(MAXCMMTLEN
+1)];
189 /*1a4*/ long days
; /* last access */
192 /*1b0*/ char nameLen
;
193 /*1b1*/ char dirName
[MAXNAMELEN
+1];
195 /*1d4*/ long real
; /* ==0 */
196 /*1d8*/ long nextLink
; /* link list */
198 /*1f0*/ long nextSameHash
;
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];
219 struct bBitmapBlock
{
220 /*000*/ ULONG checkSum
;
221 /*004*/ ULONG map
[127];
225 struct bBitmapExtBlock
{
226 /*000*/ long bmPages
[127];
227 /*1fc*/ long nextBlock
;
232 /*000*/ long type
; /* == 2 */
233 /*004*/ long headerKey
; /* self pointer */
235 /*014*/ ULONG checkSum
;
236 /*018*/ char realName
[64];
238 /*1a4*/ long days
; /* last access */
241 /*1b0*/ char nameLen
;
242 /*1b1*/ char name
[MAXNAMELEN
+1];
244 /*1d4*/ long realEntry
;
245 /*1d8*/ long nextLink
;
247 /*1f0*/ long nextSameHash
;
250 /*1fc*/ long secType
; /* == -4, 4, 3 */
255 /*--- directory cache block structure ---*/
257 struct bDirCacheBlock
{
258 /*000*/ long type
; /* == 33 */
259 /*004*/ long headerKey
;
261 /*00c*/ long recordsNb
;
262 /*010*/ long nextDirC
;
263 /*014*/ ULONG checkSum
;
264 /*018*/ unsigned char records
[488];
268 #endif /* ADF_BLK_H */
269 /*##########################################################################*/