configure: when detecting linux include directory for kernel compiler use target...
[AROS.git] / rom / filesys / pfs3 / pfsdoctor / pfs3.h
blobc116216aef7708f17a1c94d7642f5ceb0048e1a7
1 /*
2 * This file forms part of PFS3 (Professional File System 3)
3 * Written by Michiel Pelt
5 * PFS3 header file
6 */
8 #ifndef _PFS_H
9 #define _PFS_H 1
11 #ifndef EXEC_PORTS_H
12 #include "exec/ports.h"
13 #endif /* EXEC_PORTS_H */
15 #if defined(__GNUC__) || defined(__VBCC__)
16 /* Force SAS/C compatible alignment rules for all these structures */
17 #pragma pack(2)
18 #endif
20 /****************************************************************************/
21 /* PFS specific actions (packets) */
22 /****************************************************************************/
24 #define ACTION_SLEEP 2200
25 #define ACTION_UPDATE_ANODE 2201
26 #define ACTION_PFS_INFO 2202
27 #define ACTION_PFS_CONFIG 2203
28 #define ACTION_REMOVE_DIRENTRY 2204
29 #define ACTION_CREATE_ROLLOVER 2205
30 #define ACTION_SET_ROLLOVER 2206
31 #define ACTION_IS_PFS2 2211
32 #define ACTION_ADD_IDLE_SIGNAL 2220
33 #define ACTION_SET_DELDIR 2221
34 #define ACTION_SET_FNSIZE 2222
36 /****************************************************************************/
37 /* PFS3 blocks */
38 /****************************************************************************/
40 typedef struct bootblock
42 LONG disktype; /* PFS\1 */
43 UBYTE not_used[508];
44 } bootblock_t;
46 typedef struct rootblock
48 LONG disktype;
49 ULONG options; /* bit 0 is harddisk mode */
50 ULONG datestamp;
51 UWORD creationday; /* days since Jan. 1, 1978 (like ADOS; WORD instead of LONG) */
52 UWORD creationminute; /* minutes past midnight */
53 UWORD creationtick; /* ticks past minute */
54 UWORD protection; /* protection bits (ala ADOS) */
55 UBYTE diskname[32]; /* disk label (pascal string) */
56 ULONG lastreserved; /* reserved area. blocknumbers */
57 ULONG firstreserved;
58 ULONG reserved_free; /* number of reserved blocks (blksize blocks) free */
59 UWORD reserved_blksize; /* size of reserved blocks in bytes */
60 UWORD rblkcluster; /* number of blocks in rootblock, including bitmap */
61 ULONG blocksfree; /* blocks free */
62 ULONG alwaysfree; /* minimum number of blocks free */
63 ULONG roving_ptr; /* current LONG bitmapfield nr for allocation */
64 ULONG deldir; /* (before 4.3) deldir location */
65 ULONG disksize; /* disksize in sectors */
66 ULONG extension; /* rootblock extension */
67 ULONG not_used;
68 union
70 struct
72 ULONG bitmapindex[5]; /* 5 bitmap indexblocks */
73 ULONG indexblocks[99]; /* 99 indexblocks */
74 } small;
75 struct
77 ULONG bitmapindex[104]; /* 104 bitmap indexblock */
78 } large;
79 } idx;
80 } rootblock_t;
83 typedef struct rootblockextension
85 UWORD id; /* id ('EX') */
86 UWORD not_used_1;
87 ULONG ext_options;
88 ULONG datestamp;
89 ULONG pfs2version; /* pfs2 format revision */
90 UWORD root_date[3]; /* root directory datestamp */
91 UWORD volume_date[3]; /* volume datestamp */
92 ULONG postponed_op[4]; /* postponed operation (private) */
93 ULONG reserved_roving; /* reserved roving pointer */
94 UWORD rovingbit; /* bitnr in rootblock->roving_ptr field */
95 UWORD curranseqnr; /* anode allocation roving pointer */
96 UWORD deldirroving; /* (5.1) deldir roving pointer */
97 UWORD deldirsize; /* (5.1) size of deldir in blocks, 0 is disabled */
98 UWORD fnsize; /* (5.1) filename size */
99 UWORD not_used_2[3];
100 ULONG superindex[16]; /* (4.2) MODE_SUPERINDEX only */
101 UWORD dd_uid; /* (5.1) deldir user id (17.9) */
102 UWORD dd_gid; /* (5.1) deldir group id */
103 ULONG dd_protection; /* (5.1) deldir protection */
104 UWORD dd_creationday; /* (5.1) deldir datestamp */
105 UWORD dd_creationminute;
106 UWORD dd_creationtick;
107 UWORD not_used_3;
108 ULONG deldir[32]; /* (5.1) 32 deldir blocks */
109 ULONG not_used_4[188];
110 } extensionblock_t;
112 /* structure for both normal as reserved bitmap
113 * normal: normal clustersize
114 * reserved: directly behind rootblock. As long as necessary.
116 typedef struct bitmapblock
118 UWORD id; /* 'BM' (bitmap block) */
119 UWORD not_used;
120 ULONG datestamp;
121 ULONG seqnr;
122 ULONG bitmap[253]; /* the bitmap. */
123 } bitmapblock_t;
125 typedef struct indexblock
127 UWORD id; /* 'AI', 'BI', or 'SB' */
128 UWORD not_used;
129 ULONG datestamp;
130 ULONG seqnr;
131 LONG index[253]; /* the indices */
132 } indexblock_t;
134 typedef struct
136 UWORD seqnr;
137 UWORD offset;
138 } anodenr_t;
140 typedef struct anode
142 ULONG clustersize;
143 ULONG blocknr;
144 ULONG next;
145 } anode_t;
147 typedef struct anodeblock
149 UWORD id; /* 'AB' */
150 UWORD not_used;
151 ULONG datestamp;
152 ULONG seqnr;
153 ULONG not_used_2;
154 struct anode nodes[84];
155 } anodeblock_t;
157 typedef struct dirblock
159 UWORD id; /* 'DB' */
160 UWORD not_used;
161 ULONG datestamp;
162 UWORD not_used_2[2];
163 ULONG anodenr; /* anodenr belonging to this directory (points to FIRST block of dir) */
164 ULONG parent; /* parent */
165 UBYTE entries[0]; /* entries */
166 } dirblock_t;
168 struct direntry
170 UBYTE next; /* sizeof direntry */
171 BYTE type; /* dir, file, link etc */
172 ULONG anode; /* anode nummer */
173 ULONG fsize; /* sizeof file */
174 UWORD creationday; /* days since Jan. 1, 1978 (like ADOS; WORD instead of LONG) */
175 UWORD creationminute; /* minutes past modnight */
176 UWORD creationtick; /* ticks past minute */
177 UBYTE protection; /* protection bits (like DOS) */
178 UBYTE nlength; /* lenght of filename */
179 UBYTE startofname; /* filename, followed by filenote length & filenote */
180 UBYTE pad; /* make size even */
183 struct extrafields
185 ULONG link; /* link anodenr */
186 UWORD uid; /* user id */
187 UWORD gid; /* group id */
188 ULONG prot; /* byte 1-3 of protection */
189 ULONG virtualsize; /* virtual rollover filesize */
190 ULONG rollpointer; /* rollover fileoffset */
191 UWORD fsizex; /* extended bits 32-47 of direntry.fsize */
194 struct deldirentry
196 ULONG anodenr; /* anodenr */
197 ULONG fsize; /* size of file */
198 UWORD creationday; /* datestamp */
199 UWORD creationminute;
200 UWORD creationtick;
201 UBYTE filename[16]; /* filename; filling up to 30 chars */
202 // was previously filename[18]
203 // now last two bytes used for extended file size
204 UWORD fsizex; /* extended bits 32-47 of fsize */
207 typedef struct deldirblock
209 UWORD id; /* 'DD' */
210 UWORD not_used;
211 ULONG datestamp;
212 ULONG seqnr;
213 UWORD not_used_2[3];
214 UWORD uid; /* user id */
215 UWORD gid; /* group id */
216 ULONG protection;
217 UWORD creationday;
218 UWORD creationminute;
219 UWORD creationtick;
220 struct deldirentry entries[0]; /* 31 entries */
221 } deldirblock_t;
223 union reservedblock
225 UWORD id;
227 anodeblock_t anodeblock;
228 bitmapblock_t btmapblock;
229 bootblock_t bootblock;
230 dirblock_t dirblock;
231 deldirblock_t deldirblock;
232 indexblock_t indexblock;
233 rootblock_t rootblock;
234 extensionblock_t extensionblock;
237 typedef union reservedblock reservedblock_t;
239 /* limits */
240 #define MAXSMALLBITMAPINDEX 4
241 #define MAXBITMAPINDEX 103
242 #define MAXNUMRESERVED (4096 + 255*1024*8)
243 #define MAXSUPER 15
244 #define MAXSMALLINDEXNR 98
245 #define MAXDELDIRSEQNR 31
247 /* maximum disksize in blocks, limited by number of bitmapindexblocks */
248 #define MAXSMALLDISK (5*253*253*32)
249 #define MAXDISKSIZE1K (104*253*253*32)
250 #define MAXDISKSIZE2K (104*509*509*32)
251 #define MAXDISKSIZE4K ((ULONG)104*1021*1021*32)
253 #define MAXRESBLOCKSIZE 4096
255 /* disk id 'PFS\1' */
256 #define ID_PFS_DISK (0x50465301L) /* 'PFS\1' */
257 #define ID_PFS2_DISK (0x50465302L) /* 'PFS\2' */
258 #define ID_MUPFS_DISK (0x6d755046L) /* 'muPF' */
259 #define ID_AFS_DISK (0x41465301L) /* 'AFS\1' */
261 /* block id's */
262 #define DBLKID 0x4442
263 #define ABLKID 0x4142
264 #define IBLKID 0x4942
265 #define BMBLKID 0x424D
266 #define BMIBLKID 0x4D49
267 #define DELDIRID 0x4444
268 #define EXTENSIONID 0x4558
269 #define SBLKID 0x5342
270 #define SIZEOF_RESBLOCK (rbl->reserved_blksize)
273 /* predefined anodes */
274 #define ANODE_EOF 0
275 #define ANODE_BADBLOCKS 4
276 #define ANODE_ROOTDIR 5
277 #define ANODE_USERFIRST 6
279 /* disk options */
280 #define MODE_HARDDISK 1
281 #define MODE_SPLITTED_ANODES 2
282 #define MODE_DIR_EXTENSION 4
283 #define MODE_DELDIR 8
284 #define MODE_SIZEFIELD 16
285 #define MODE_EXTENSION 32
286 #define MODE_DATESTAMP 64
287 #define MODE_SUPERINDEX 128
288 #define MODE_SUPERDELDIR 256
289 #define MODE_EXTROVING 512
290 #define MODE_LONGFN 1024
291 #define MODE_LARGEFILE 2048
292 #define MODE_MASK (4096-1)
294 /* seperator used for deldirentries */
295 #define DELENTRY_SEP '@'
297 /* rollover filetype */
298 #define ST_ROLLOVERFILE -16
300 /* get filenote from directory entry */
301 #define FILENOTE(de) ((UBYTE*)(&((de)->startofname) + (de)->nlength))
303 /* get next directory entry */
304 #define NEXTENTRY(de) ((struct direntry*)((UBYTE*)(de) + (de)->next))
306 #if defined(__GNUC__) || defined(__VBCC__)
307 #pragma pack()
308 #endif
310 #endif /* _PFS_H */