aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs/hpfs.h
diff options
context:
space:
mode:
Diffstat (limited to 'fs/hpfs/hpfs.h')
-rw-r--r--fs/hpfs/hpfs.h219
1 files changed, 149 insertions, 70 deletions
diff --git a/fs/hpfs/hpfs.h b/fs/hpfs/hpfs.h
index 8cd5130247bc..91a6223893f9 100644
--- a/fs/hpfs/hpfs.h
+++ b/fs/hpfs/hpfs.h
@@ -19,6 +19,10 @@
19 For definitive information on HPFS, ask somebody else -- this is guesswork. 19 For definitive information on HPFS, ask somebody else -- this is guesswork.
20 There are certain to be many mistakes. */ 20 There are certain to be many mistakes. */
21 21
22#if !defined(__LITTLE_ENDIAN) && !defined(__BIG_ENDIAN)
23#error unknown endian
24#endif
25
22/* Notation */ 26/* Notation */
23 27
24typedef u32 secno; /* sector number, partition relative */ 28typedef u32 secno; /* sector number, partition relative */
@@ -86,7 +90,6 @@ struct hpfs_super_block
86 secno badblocks; /* bad block list */ 90 secno badblocks; /* bad block list */
87 u32 zero3; /* 0 */ 91 u32 zero3; /* 0 */
88 time32_t last_chkdsk; /* date last checked, 0 if never */ 92 time32_t last_chkdsk; /* date last checked, 0 if never */
89 /*u32 zero4;*/ /* 0 */
90 time32_t last_optimize; /* date last optimized, 0 if never */ 93 time32_t last_optimize; /* date last optimized, 0 if never */
91 secno n_dir_band; /* number of sectors in dir band */ 94 secno n_dir_band; /* number of sectors in dir band */
92 secno dir_band_start; /* first sector in dir band */ 95 secno dir_band_start; /* first sector in dir band */
@@ -109,21 +112,44 @@ struct hpfs_spare_block
109 u32 magic; /* f991 1849 */ 112 u32 magic; /* f991 1849 */
110 u32 magic1; /* fa52 29c5, more magic? */ 113 u32 magic1; /* fa52 29c5, more magic? */
111 114
112 unsigned dirty: 1; /* 0 clean, 1 "improperly stopped" */ 115#ifdef __LITTLE_ENDIAN
113 unsigned sparedir_used: 1; /* spare dirblks used */ 116 u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */
114 unsigned hotfixes_used: 1; /* hotfixes used */ 117 u8 sparedir_used: 1; /* spare dirblks used */
115 unsigned bad_sector: 1; /* bad sector, corrupted disk (???) */ 118 u8 hotfixes_used: 1; /* hotfixes used */
116 unsigned bad_bitmap: 1; /* bad bitmap */ 119 u8 bad_sector: 1; /* bad sector, corrupted disk (???) */
117 unsigned fast: 1; /* partition was fast formatted */ 120 u8 bad_bitmap: 1; /* bad bitmap */
118 unsigned old_wrote: 1; /* old version wrote to partion */ 121 u8 fast: 1; /* partition was fast formatted */
119 unsigned old_wrote_1: 1; /* old version wrote to partion (?) */ 122 u8 old_wrote: 1; /* old version wrote to partion */
120 unsigned install_dasd_limits: 1; /* HPFS386 flags */ 123 u8 old_wrote_1: 1; /* old version wrote to partion (?) */
121 unsigned resynch_dasd_limits: 1; 124#else
122 unsigned dasd_limits_operational: 1; 125 u8 old_wrote_1: 1; /* old version wrote to partion (?) */
123 unsigned multimedia_active: 1; 126 u8 old_wrote: 1; /* old version wrote to partion */
124 unsigned dce_acls_active: 1; 127 u8 fast: 1; /* partition was fast formatted */
125 unsigned dasd_limits_dirty: 1; 128 u8 bad_bitmap: 1; /* bad bitmap */
126 unsigned flag67: 2; 129 u8 bad_sector: 1; /* bad sector, corrupted disk (???) */
130 u8 hotfixes_used: 1; /* hotfixes used */
131 u8 sparedir_used: 1; /* spare dirblks used */
132 u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */
133#endif
134
135#ifdef __LITTLE_ENDIAN
136 u8 install_dasd_limits: 1; /* HPFS386 flags */
137 u8 resynch_dasd_limits: 1;
138 u8 dasd_limits_operational: 1;
139 u8 multimedia_active: 1;
140 u8 dce_acls_active: 1;
141 u8 dasd_limits_dirty: 1;
142 u8 flag67: 2;
143#else
144 u8 flag67: 2;
145 u8 dasd_limits_dirty: 1;
146 u8 dce_acls_active: 1;
147 u8 multimedia_active: 1;
148 u8 dasd_limits_operational: 1;
149 u8 resynch_dasd_limits: 1;
150 u8 install_dasd_limits: 1; /* HPFS386 flags */
151#endif
152
127 u8 mm_contlgulty; 153 u8 mm_contlgulty;
128 u8 unused; 154 u8 unused;
129 155
@@ -255,10 +281,18 @@ struct dnode {
255 u32 magic; /* 77e4 0aae */ 281 u32 magic; /* 77e4 0aae */
256 u32 first_free; /* offset from start of dnode to 282 u32 first_free; /* offset from start of dnode to
257 first free dir entry */ 283 first free dir entry */
258 unsigned root_dnode:1; /* Is it root dnode? */ 284#ifdef __LITTLE_ENDIAN
259 unsigned increment_me:31; /* some kind of activity counter? 285 u8 root_dnode: 1; /* Is it root dnode? */
260 Neither HPFS.IFS nor CHKDSK cares 286 u8 increment_me: 7; /* some kind of activity counter? */
287 /* Neither HPFS.IFS nor CHKDSK cares
261 if you change this word */ 288 if you change this word */
289#else
290 u8 increment_me: 7; /* some kind of activity counter? */
291 /* Neither HPFS.IFS nor CHKDSK cares
292 if you change this word */
293 u8 root_dnode: 1; /* Is it root dnode? */
294#endif
295 u8 increment_me2[3];
262 secno up; /* (root dnode) directory's fnode 296 secno up; /* (root dnode) directory's fnode
263 (nonroot) parent dnode */ 297 (nonroot) parent dnode */
264 dnode_secno self; /* pointer to this dnode */ 298 dnode_secno self; /* pointer to this dnode */
@@ -266,33 +300,59 @@ struct dnode {
266}; 300};
267 301
268struct hpfs_dirent { 302struct hpfs_dirent {
269 u16 length; /* offset to next dirent */ 303 u16 length; /* offset to next dirent */
270 unsigned first: 1; /* set on phony ^A^A (".") entry */ 304
271 unsigned has_acl: 1; 305#ifdef __LITTLE_ENDIAN
272 unsigned down: 1; /* down pointer present (after name) */ 306 u8 first: 1; /* set on phony ^A^A (".") entry */
273 unsigned last: 1; /* set on phony \377 entry */ 307 u8 has_acl: 1;
274 unsigned has_ea: 1; /* entry has EA */ 308 u8 down: 1; /* down pointer present (after name) */
275 unsigned has_xtd_perm: 1; /* has extended perm list (???) */ 309 u8 last: 1; /* set on phony \377 entry */
276 unsigned has_explicit_acl: 1; 310 u8 has_ea: 1; /* entry has EA */
277 unsigned has_needea: 1; /* ?? some EA has NEEDEA set 311 u8 has_xtd_perm: 1; /* has extended perm list (???) */
312 u8 has_explicit_acl: 1;
313 u8 has_needea: 1; /* ?? some EA has NEEDEA set
314 I have no idea why this is
315 interesting in a dir entry */
316#else
317 u8 has_needea: 1; /* ?? some EA has NEEDEA set
278 I have no idea why this is 318 I have no idea why this is
279 interesting in a dir entry */ 319 interesting in a dir entry */
280 unsigned read_only: 1; /* dos attrib */ 320 u8 has_explicit_acl: 1;
281 unsigned hidden: 1; /* dos attrib */ 321 u8 has_xtd_perm: 1; /* has extended perm list (???) */
282 unsigned system: 1; /* dos attrib */ 322 u8 has_ea: 1; /* entry has EA */
283 unsigned flag11: 1; /* would be volume label dos attrib */ 323 u8 last: 1; /* set on phony \377 entry */
284 unsigned directory: 1; /* dos attrib */ 324 u8 down: 1; /* down pointer present (after name) */
285 unsigned archive: 1; /* dos attrib */ 325 u8 has_acl: 1;
286 unsigned not_8x3: 1; /* name is not 8.3 */ 326 u8 first: 1; /* set on phony ^A^A (".") entry */
287 unsigned flag15: 1; 327#endif
328
329#ifdef __LITTLE_ENDIAN
330 u8 read_only: 1; /* dos attrib */
331 u8 hidden: 1; /* dos attrib */
332 u8 system: 1; /* dos attrib */
333 u8 flag11: 1; /* would be volume label dos attrib */
334 u8 directory: 1; /* dos attrib */
335 u8 archive: 1; /* dos attrib */
336 u8 not_8x3: 1; /* name is not 8.3 */
337 u8 flag15: 1;
338#else
339 u8 flag15: 1;
340 u8 not_8x3: 1; /* name is not 8.3 */
341 u8 archive: 1; /* dos attrib */
342 u8 directory: 1; /* dos attrib */
343 u8 flag11: 1; /* would be volume label dos attrib */
344 u8 system: 1; /* dos attrib */
345 u8 hidden: 1; /* dos attrib */
346 u8 read_only: 1; /* dos attrib */
347#endif
348
288 fnode_secno fnode; /* fnode giving allocation info */ 349 fnode_secno fnode; /* fnode giving allocation info */
289 time32_t write_date; /* mtime */ 350 time32_t write_date; /* mtime */
290 u32 file_size; /* file length, bytes */ 351 u32 file_size; /* file length, bytes */
291 time32_t read_date; /* atime */ 352 time32_t read_date; /* atime */
292 time32_t creation_date; /* ctime */ 353 time32_t creation_date; /* ctime */
293 u32 ea_size; /* total EA length, bytes */ 354 u32 ea_size; /* total EA length, bytes */
294 unsigned char no_of_acls : 3; /* number of ACL's */ 355 u8 no_of_acls; /* number of ACL's (low 3 bits) */
295 unsigned char reserver : 5;
296 u8 ix; /* code page index (of filename), see 356 u8 ix; /* code page index (of filename), see
297 struct code_page_data */ 357 struct code_page_data */
298 u8 namelen, name[1]; /* file name */ 358 u8 namelen, name[1]; /* file name */
@@ -328,21 +388,33 @@ struct bplus_internal_node
328 388
329struct bplus_header 389struct bplus_header
330{ 390{
331 unsigned hbff: 1; /* high bit of first free entry offset */ 391#ifdef __LITTLE_ENDIAN
332 unsigned flag1: 1; 392 u8 hbff: 1; /* high bit of first free entry offset */
333 unsigned flag2: 1; 393 u8 flag1234: 4;
334 unsigned flag3: 1; 394 u8 fnode_parent: 1; /* ? we're pointed to by an fnode,
335 unsigned flag4: 1;
336 unsigned fnode_parent: 1; /* ? we're pointed to by an fnode,
337 the data btree or some ea or the 395 the data btree or some ea or the
338 main ea bootage pointer ea_secno */ 396 main ea bootage pointer ea_secno */
339 /* also can get set in fnodes, which 397 /* also can get set in fnodes, which
340 may be a chkdsk glitch or may mean 398 may be a chkdsk glitch or may mean
341 this bit is irrelevant in fnodes, 399 this bit is irrelevant in fnodes,
342 or this interpretation is all wet */ 400 or this interpretation is all wet */
343 unsigned binary_search: 1; /* suggest binary search (unused) */ 401 u8 binary_search: 1; /* suggest binary search (unused) */
344 unsigned internal: 1; /* 1 -> (internal) tree of anodes 402 u8 internal: 1; /* 1 -> (internal) tree of anodes
345 0 -> (leaf) list of extents */ 403 0 -> (leaf) list of extents */
404#else
405 u8 internal: 1; /* 1 -> (internal) tree of anodes
406 0 -> (leaf) list of extents */
407 u8 binary_search: 1; /* suggest binary search (unused) */
408 u8 fnode_parent: 1; /* ? we're pointed to by an fnode,
409 the data btree or some ea or the
410 main ea bootage pointer ea_secno */
411 /* also can get set in fnodes, which
412 may be a chkdsk glitch or may mean
413 this bit is irrelevant in fnodes,
414 or this interpretation is all wet */
415 u8 flag1234: 4;
416 u8 hbff: 1; /* high bit of first free entry offset */
417#endif
346 u8 fill[3]; 418 u8 fill[3];
347 u8 n_free_nodes; /* free nodes in following array */ 419 u8 n_free_nodes; /* free nodes in following array */
348 u8 n_used_nodes; /* used nodes in following array */ 420 u8 n_used_nodes; /* used nodes in following array */
@@ -379,23 +451,25 @@ struct fnode
379 secno ea_secno; /* first sector of disk-resident ea's*/ 451 secno ea_secno; /* first sector of disk-resident ea's*/
380 u16 ea_size_s; /* length of fnode-resident ea's */ 452 u16 ea_size_s; /* length of fnode-resident ea's */
381 453
382 unsigned flag0: 1; 454#ifdef __LITTLE_ENDIAN
383 unsigned ea_anode: 1; /* 1 -> ea_secno is an anode */ 455 u8 flag0: 1;
384 unsigned flag2: 1; 456 u8 ea_anode: 1; /* 1 -> ea_secno is an anode */
385 unsigned flag3: 1; 457 u8 flag234567: 6;
386 unsigned flag4: 1; 458#else
387 unsigned flag5: 1; 459 u8 flag234567: 6;
388 unsigned flag6: 1; 460 u8 ea_anode: 1; /* 1 -> ea_secno is an anode */
389 unsigned flag7: 1; 461 u8 flag0: 1;
390 unsigned dirflag: 1; /* 1 -> directory. first & only extent 462#endif
463
464#ifdef __LITTLE_ENDIAN
465 u8 dirflag: 1; /* 1 -> directory. first & only extent
466 points to dnode. */
467 u8 flag9012345: 7;
468#else
469 u8 flag9012345: 7;
470 u8 dirflag: 1; /* 1 -> directory. first & only extent
391 points to dnode. */ 471 points to dnode. */
392 unsigned flag9: 1; 472#endif
393 unsigned flag10: 1;
394 unsigned flag11: 1;
395 unsigned flag12: 1;
396 unsigned flag13: 1;
397 unsigned flag14: 1;
398 unsigned flag15: 1;
399 473
400 struct bplus_header btree; /* b+ tree, 8 extents or 12 subtrees */ 474 struct bplus_header btree; /* b+ tree, 8 extents or 12 subtrees */
401 union { 475 union {
@@ -456,16 +530,21 @@ struct anode
456 530
457struct extended_attribute 531struct extended_attribute
458{ 532{
459 unsigned indirect: 1; /* 1 -> value gives sector number 533#ifdef __LITTLE_ENDIAN
534 u8 indirect: 1; /* 1 -> value gives sector number
460 where real value starts */ 535 where real value starts */
461 unsigned anode: 1; /* 1 -> sector is an anode 536 u8 anode: 1; /* 1 -> sector is an anode
462 that points to fragmented value */ 537 that points to fragmented value */
463 unsigned flag2: 1; 538 u8 flag23456: 5;
464 unsigned flag3: 1; 539 u8 needea: 1; /* required ea */
465 unsigned flag4: 1; 540#else
466 unsigned flag5: 1; 541 u8 needea: 1; /* required ea */
467 unsigned flag6: 1; 542 u8 flag23456: 5;
468 unsigned needea: 1; /* required ea */ 543 u8 anode: 1; /* 1 -> sector is an anode
544 that points to fragmented value */
545 u8 indirect: 1; /* 1 -> value gives sector number
546 where real value starts */
547#endif
469 u8 namelen; /* length of name, bytes */ 548 u8 namelen; /* length of name, bytes */
470 u16 valuelen; /* length of value, bytes */ 549 u16 valuelen; /* length of value, bytes */
471 u8 name[0]; 550 u8 name[0];