aboutsummaryrefslogtreecommitdiffstats
path: root/fs/hpfs
diff options
context:
space:
mode:
authorMikulas Patocka <mikulas@artax.karlin.mff.cuni.cz>2011-05-08 14:43:34 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2011-05-09 12:04:23 -0400
commitd878597c2c498b63abe3e68d343459944bc358f9 (patch)
treea0347439303415ad48019af06feb98019748d7a5 /fs/hpfs
parente5d6a7dd5e0b29eee4359e817e0bee728d7c5530 (diff)
HPFS: Use types with defined width
Use types with defined width Signed-off-by: Mikulas Patocka <mikulas@artax.karlin.mff.cuni.cz> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'fs/hpfs')
-rw-r--r--fs/hpfs/hpfs.h219
1 files changed, 107 insertions, 112 deletions
diff --git a/fs/hpfs/hpfs.h b/fs/hpfs/hpfs.h
index 0e84c73cd9c4..8cd5130247bc 100644
--- a/fs/hpfs/hpfs.h
+++ b/fs/hpfs/hpfs.h
@@ -21,7 +21,7 @@
21 21
22/* Notation */ 22/* Notation */
23 23
24typedef unsigned secno; /* sector number, partition relative */ 24typedef u32 secno; /* sector number, partition relative */
25 25
26typedef secno dnode_secno; /* sector number of a dnode */ 26typedef secno dnode_secno; /* sector number of a dnode */
27typedef secno fnode_secno; /* sector number of an fnode */ 27typedef secno fnode_secno; /* sector number of an fnode */
@@ -38,28 +38,28 @@ typedef u32 time32_t; /* 32-bit time_t type */
38 38
39struct hpfs_boot_block 39struct hpfs_boot_block
40{ 40{
41 unsigned char jmp[3]; 41 u8 jmp[3];
42 unsigned char oem_id[8]; 42 u8 oem_id[8];
43 unsigned char bytes_per_sector[2]; /* 512 */ 43 u8 bytes_per_sector[2]; /* 512 */
44 unsigned char sectors_per_cluster; 44 u8 sectors_per_cluster;
45 unsigned char n_reserved_sectors[2]; 45 u8 n_reserved_sectors[2];
46 unsigned char n_fats; 46 u8 n_fats;
47 unsigned char n_rootdir_entries[2]; 47 u8 n_rootdir_entries[2];
48 unsigned char n_sectors_s[2]; 48 u8 n_sectors_s[2];
49 unsigned char media_byte; 49 u8 media_byte;
50 unsigned short sectors_per_fat; 50 u16 sectors_per_fat;
51 unsigned short sectors_per_track; 51 u16 sectors_per_track;
52 unsigned short heads_per_cyl; 52 u16 heads_per_cyl;
53 unsigned int n_hidden_sectors; 53 u32 n_hidden_sectors;
54 unsigned int n_sectors_l; /* size of partition */ 54 u32 n_sectors_l; /* size of partition */
55 unsigned char drive_number; 55 u8 drive_number;
56 unsigned char mbz; 56 u8 mbz;
57 unsigned char sig_28h; /* 28h */ 57 u8 sig_28h; /* 28h */
58 unsigned char vol_serno[4]; 58 u8 vol_serno[4];
59 unsigned char vol_label[11]; 59 u8 vol_label[11];
60 unsigned char sig_hpfs[8]; /* "HPFS " */ 60 u8 sig_hpfs[8]; /* "HPFS " */
61 unsigned char pad[448]; 61 u8 pad[448];
62 unsigned short magic; /* aa55 */ 62 u16 magic; /* aa55 */
63}; 63};
64 64
65 65
@@ -71,31 +71,30 @@ struct hpfs_boot_block
71 71
72struct hpfs_super_block 72struct hpfs_super_block
73{ 73{
74 unsigned magic; /* f995 e849 */ 74 u32 magic; /* f995 e849 */
75 unsigned magic1; /* fa53 e9c5, more magic? */ 75 u32 magic1; /* fa53 e9c5, more magic? */
76 /*unsigned huh202;*/ /* ?? 202 = N. of B. in 1.00390625 S.*/ 76 u8 version; /* version of a filesystem usually 2 */
77 char version; /* version of a filesystem usually 2 */ 77 u8 funcversion; /* functional version - oldest version
78 char funcversion; /* functional version - oldest version
79 of filesystem that can understand 78 of filesystem that can understand
80 this disk */ 79 this disk */
81 unsigned short int zero; /* 0 */ 80 u16 zero; /* 0 */
82 fnode_secno root; /* fnode of root directory */ 81 fnode_secno root; /* fnode of root directory */
83 secno n_sectors; /* size of filesystem */ 82 secno n_sectors; /* size of filesystem */
84 unsigned n_badblocks; /* number of bad blocks */ 83 u32 n_badblocks; /* number of bad blocks */
85 secno bitmaps; /* pointers to free space bit maps */ 84 secno bitmaps; /* pointers to free space bit maps */
86 unsigned zero1; /* 0 */ 85 u32 zero1; /* 0 */
87 secno badblocks; /* bad block list */ 86 secno badblocks; /* bad block list */
88 unsigned zero3; /* 0 */ 87 u32 zero3; /* 0 */
89 time32_t last_chkdsk; /* date last checked, 0 if never */ 88 time32_t last_chkdsk; /* date last checked, 0 if never */
90 /*unsigned zero4;*/ /* 0 */ 89 /*u32 zero4;*/ /* 0 */
91 time32_t last_optimize; /* date last optimized, 0 if never */ 90 time32_t last_optimize; /* date last optimized, 0 if never */
92 secno n_dir_band; /* number of sectors in dir band */ 91 secno n_dir_band; /* number of sectors in dir band */
93 secno dir_band_start; /* first sector in dir band */ 92 secno dir_band_start; /* first sector in dir band */
94 secno dir_band_end; /* last sector in dir band */ 93 secno dir_band_end; /* last sector in dir band */
95 secno dir_band_bitmap; /* free space map, 1 dnode per bit */ 94 secno dir_band_bitmap; /* free space map, 1 dnode per bit */
96 char volume_name[32]; /* not used */ 95 u8 volume_name[32]; /* not used */
97 secno user_id_table; /* 8 preallocated sectors - user id */ 96 secno user_id_table; /* 8 preallocated sectors - user id */
98 unsigned zero6[103]; /* 0 */ 97 u32 zero6[103]; /* 0 */
99}; 98};
100 99
101 100
@@ -107,11 +106,10 @@ struct hpfs_super_block
107 106
108struct hpfs_spare_block 107struct hpfs_spare_block
109{ 108{
110 unsigned magic; /* f991 1849 */ 109 u32 magic; /* f991 1849 */
111 unsigned magic1; /* fa52 29c5, more magic? */ 110 u32 magic1; /* fa52 29c5, more magic? */
112 111
113 unsigned dirty: 1; /* 0 clean, 1 "improperly stopped" */ 112 unsigned dirty: 1; /* 0 clean, 1 "improperly stopped" */
114 /*unsigned flag1234: 4;*/ /* unknown flags */
115 unsigned sparedir_used: 1; /* spare dirblks used */ 113 unsigned sparedir_used: 1; /* spare dirblks used */
116 unsigned hotfixes_used: 1; /* hotfixes used */ 114 unsigned hotfixes_used: 1; /* hotfixes used */
117 unsigned bad_sector: 1; /* bad sector, corrupted disk (???) */ 115 unsigned bad_sector: 1; /* bad sector, corrupted disk (???) */
@@ -126,25 +124,24 @@ struct hpfs_spare_block
126 unsigned dce_acls_active: 1; 124 unsigned dce_acls_active: 1;
127 unsigned dasd_limits_dirty: 1; 125 unsigned dasd_limits_dirty: 1;
128 unsigned flag67: 2; 126 unsigned flag67: 2;
129 unsigned char mm_contlgulty; 127 u8 mm_contlgulty;
130 unsigned char unused; 128 u8 unused;
131 129
132 secno hotfix_map; /* info about remapped bad sectors */ 130 secno hotfix_map; /* info about remapped bad sectors */
133 unsigned n_spares_used; /* number of hotfixes */ 131 u32 n_spares_used; /* number of hotfixes */
134 unsigned n_spares; /* number of spares in hotfix map */ 132 u32 n_spares; /* number of spares in hotfix map */
135 unsigned n_dnode_spares_free; /* spare dnodes unused */ 133 u32 n_dnode_spares_free; /* spare dnodes unused */
136 unsigned n_dnode_spares; /* length of spare_dnodes[] list, 134 u32 n_dnode_spares; /* length of spare_dnodes[] list,
137 follows in this block*/ 135 follows in this block*/
138 secno code_page_dir; /* code page directory block */ 136 secno code_page_dir; /* code page directory block */
139 unsigned n_code_pages; /* number of code pages */ 137 u32 n_code_pages; /* number of code pages */
140 /*unsigned large_numbers[2];*/ /* ?? */ 138 u32 super_crc; /* on HPFS386 and LAN Server this is
141 unsigned super_crc; /* on HPFS386 and LAN Server this is
142 checksum of superblock, on normal 139 checksum of superblock, on normal
143 OS/2 unused */ 140 OS/2 unused */
144 unsigned spare_crc; /* on HPFS386 checksum of spareblock */ 141 u32 spare_crc; /* on HPFS386 checksum of spareblock */
145 unsigned zero1[15]; /* unused */ 142 u32 zero1[15]; /* unused */
146 dnode_secno spare_dnodes[100]; /* emergency free dnode list */ 143 dnode_secno spare_dnodes[100]; /* emergency free dnode list */
147 unsigned zero2[1]; /* room for more? */ 144 u32 zero2[1]; /* room for more? */
148}; 145};
149 146
150/* The bad block list is 4 sectors long. The first word must be zero, 147/* The bad block list is 4 sectors long. The first word must be zero,
@@ -179,18 +176,18 @@ struct hpfs_spare_block
179 176
180struct code_page_directory 177struct code_page_directory
181{ 178{
182 unsigned magic; /* 4945 21f7 */ 179 u32 magic; /* 4945 21f7 */
183 unsigned n_code_pages; /* number of pointers following */ 180 u32 n_code_pages; /* number of pointers following */
184 unsigned zero1[2]; 181 u32 zero1[2];
185 struct { 182 struct {
186 unsigned short ix; /* index */ 183 u16 ix; /* index */
187 unsigned short code_page_number; /* code page number */ 184 u16 code_page_number; /* code page number */
188 unsigned bounds; /* matches corresponding word 185 u32 bounds; /* matches corresponding word
189 in data block */ 186 in data block */
190 secno code_page_data; /* sector number of a code_page_data 187 secno code_page_data; /* sector number of a code_page_data
191 containing c.p. array */ 188 containing c.p. array */
192 unsigned short index; /* index in c.p. array in that sector*/ 189 u16 index; /* index in c.p. array in that sector*/
193 unsigned short unknown; /* some unknown value; usually 0; 190 u16 unknown; /* some unknown value; usually 0;
194 2 in Japanese version */ 191 2 in Japanese version */
195 } array[31]; /* unknown length */ 192 } array[31]; /* unknown length */
196}; 193};
@@ -201,21 +198,21 @@ struct code_page_directory
201 198
202struct code_page_data 199struct code_page_data
203{ 200{
204 unsigned magic; /* 8945 21f7 */ 201 u32 magic; /* 8945 21f7 */
205 unsigned n_used; /* # elements used in c_p_data[] */ 202 u32 n_used; /* # elements used in c_p_data[] */
206 unsigned bounds[3]; /* looks a bit like 203 u32 bounds[3]; /* looks a bit like
207 (beg1,end1), (beg2,end2) 204 (beg1,end1), (beg2,end2)
208 one byte each */ 205 one byte each */
209 unsigned short offs[3]; /* offsets from start of sector 206 u16 offs[3]; /* offsets from start of sector
210 to start of c_p_data[ix] */ 207 to start of c_p_data[ix] */
211 struct { 208 struct {
212 unsigned short ix; /* index */ 209 u16 ix; /* index */
213 unsigned short code_page_number; /* code page number */ 210 u16 code_page_number; /* code page number */
214 unsigned short unknown; /* the same as in cp directory */ 211 u16 unknown; /* the same as in cp directory */
215 unsigned char map[128]; /* upcase table for chars 80..ff */ 212 u8 map[128]; /* upcase table for chars 80..ff */
216 unsigned short zero2; 213 u16 zero2;
217 } code_page[3]; 214 } code_page[3];
218 unsigned char incognita[78]; 215 u8 incognita[78];
219}; 216};
220 217
221 218
@@ -255,8 +252,8 @@ struct code_page_data
255#define DNODE_MAGIC 0x77e40aae 252#define DNODE_MAGIC 0x77e40aae
256 253
257struct dnode { 254struct dnode {
258 unsigned magic; /* 77e4 0aae */ 255 u32 magic; /* 77e4 0aae */
259 unsigned first_free; /* offset from start of dnode to 256 u32 first_free; /* offset from start of dnode to
260 first free dir entry */ 257 first free dir entry */
261 unsigned root_dnode:1; /* Is it root dnode? */ 258 unsigned root_dnode:1; /* Is it root dnode? */
262 unsigned increment_me:31; /* some kind of activity counter? 259 unsigned increment_me:31; /* some kind of activity counter?
@@ -265,11 +262,11 @@ struct dnode {
265 secno up; /* (root dnode) directory's fnode 262 secno up; /* (root dnode) directory's fnode
266 (nonroot) parent dnode */ 263 (nonroot) parent dnode */
267 dnode_secno self; /* pointer to this dnode */ 264 dnode_secno self; /* pointer to this dnode */
268 unsigned char dirent[2028]; /* one or more dirents */ 265 u8 dirent[2028]; /* one or more dirents */
269}; 266};
270 267
271struct hpfs_dirent { 268struct hpfs_dirent {
272 unsigned short length; /* offset to next dirent */ 269 u16 length; /* offset to next dirent */
273 unsigned first: 1; /* set on phony ^A^A (".") entry */ 270 unsigned first: 1; /* set on phony ^A^A (".") entry */
274 unsigned has_acl: 1; 271 unsigned has_acl: 1;
275 unsigned down: 1; /* down pointer present (after name) */ 272 unsigned down: 1; /* down pointer present (after name) */
@@ -290,15 +287,15 @@ struct hpfs_dirent {
290 unsigned flag15: 1; 287 unsigned flag15: 1;
291 fnode_secno fnode; /* fnode giving allocation info */ 288 fnode_secno fnode; /* fnode giving allocation info */
292 time32_t write_date; /* mtime */ 289 time32_t write_date; /* mtime */
293 unsigned file_size; /* file length, bytes */ 290 u32 file_size; /* file length, bytes */
294 time32_t read_date; /* atime */ 291 time32_t read_date; /* atime */
295 time32_t creation_date; /* ctime */ 292 time32_t creation_date; /* ctime */
296 unsigned ea_size; /* total EA length, bytes */ 293 u32 ea_size; /* total EA length, bytes */
297 unsigned char no_of_acls : 3; /* number of ACL's */ 294 unsigned char no_of_acls : 3; /* number of ACL's */
298 unsigned char reserver : 5; 295 unsigned char reserver : 5;
299 unsigned char ix; /* code page index (of filename), see 296 u8 ix; /* code page index (of filename), see
300 struct code_page_data */ 297 struct code_page_data */
301 unsigned char namelen, name[1]; /* file name */ 298 u8 namelen, name[1]; /* file name */
302 /* dnode_secno down; btree down pointer, if present, 299 /* dnode_secno down; btree down pointer, if present,
303 follows name on next word boundary, or maybe it 300 follows name on next word boundary, or maybe it
304 precedes next dirent, which is on a word boundary. */ 301 precedes next dirent, which is on a word boundary. */
@@ -318,14 +315,14 @@ struct hpfs_dirent {
318 315
319struct bplus_leaf_node 316struct bplus_leaf_node
320{ 317{
321 unsigned file_secno; /* first file sector in extent */ 318 u32 file_secno; /* first file sector in extent */
322 unsigned length; /* length, sectors */ 319 u32 length; /* length, sectors */
323 secno disk_secno; /* first corresponding disk sector */ 320 secno disk_secno; /* first corresponding disk sector */
324}; 321};
325 322
326struct bplus_internal_node 323struct bplus_internal_node
327{ 324{
328 unsigned file_secno; /* subtree maps sectors < this */ 325 u32 file_secno; /* subtree maps sectors < this */
329 anode_secno down; /* pointer to subtree */ 326 anode_secno down; /* pointer to subtree */
330}; 327};
331 328
@@ -346,10 +343,10 @@ struct bplus_header
346 unsigned binary_search: 1; /* suggest binary search (unused) */ 343 unsigned binary_search: 1; /* suggest binary search (unused) */
347 unsigned internal: 1; /* 1 -> (internal) tree of anodes 344 unsigned internal: 1; /* 1 -> (internal) tree of anodes
348 0 -> (leaf) list of extents */ 345 0 -> (leaf) list of extents */
349 unsigned char fill[3]; 346 u8 fill[3];
350 unsigned char n_free_nodes; /* free nodes in following array */ 347 u8 n_free_nodes; /* free nodes in following array */
351 unsigned char n_used_nodes; /* used nodes in following array */ 348 u8 n_used_nodes; /* used nodes in following array */
352 unsigned short first_free; /* offset from start of header to 349 u16 first_free; /* offset from start of header to
353 first free node in array */ 350 first free node in array */
354 union { 351 union {
355 struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving 352 struct bplus_internal_node internal[0]; /* (internal) 2-word entries giving
@@ -369,19 +366,18 @@ struct bplus_header
369 366
370struct fnode 367struct fnode
371{ 368{
372 unsigned magic; /* f7e4 0aae */ 369 u32 magic; /* f7e4 0aae */
373 unsigned zero1[2]; /* read history */ 370 u32 zero1[2]; /* read history */
374 unsigned char len, name[15]; /* true length, truncated name */ 371 u8 len, name[15]; /* true length, truncated name */
375 fnode_secno up; /* pointer to file's directory fnode */ 372 fnode_secno up; /* pointer to file's directory fnode */
376 /*unsigned zero2[3];*/
377 secno acl_size_l; 373 secno acl_size_l;
378 secno acl_secno; 374 secno acl_secno;
379 unsigned short acl_size_s; 375 u16 acl_size_s;
380 char acl_anode; 376 u8 acl_anode;
381 char zero2; /* history bit count */ 377 u8 zero2; /* history bit count */
382 unsigned ea_size_l; /* length of disk-resident ea's */ 378 u32 ea_size_l; /* length of disk-resident ea's */
383 secno ea_secno; /* first sector of disk-resident ea's*/ 379 secno ea_secno; /* first sector of disk-resident ea's*/
384 unsigned short ea_size_s; /* length of fnode-resident ea's */ 380 u16 ea_size_s; /* length of fnode-resident ea's */
385 381
386 unsigned flag0: 1; 382 unsigned flag0: 1;
387 unsigned ea_anode: 1; /* 1 -> ea_secno is an anode */ 383 unsigned ea_anode: 1; /* 1 -> ea_secno is an anode */
@@ -407,17 +403,16 @@ struct fnode
407 struct bplus_internal_node internal[12]; 403 struct bplus_internal_node internal[12];
408 } u; 404 } u;
409 405
410 unsigned file_size; /* file length, bytes */ 406 u32 file_size; /* file length, bytes */
411 unsigned n_needea; /* number of EA's with NEEDEA set */ 407 u32 n_needea; /* number of EA's with NEEDEA set */
412 char user_id[16]; /* unused */ 408 u8 user_id[16]; /* unused */
413 unsigned short ea_offs; /* offset from start of fnode 409 u16 ea_offs; /* offset from start of fnode
414 to first fnode-resident ea */ 410 to first fnode-resident ea */
415 char dasd_limit_treshhold; 411 u8 dasd_limit_treshhold;
416 char dasd_limit_delta; 412 u8 dasd_limit_delta;
417 unsigned dasd_limit; 413 u32 dasd_limit;
418 unsigned dasd_usage; 414 u32 dasd_usage;
419 /*unsigned zero5[2];*/ 415 u8 ea[316]; /* zero or more EA's, packed together
420 unsigned char ea[316]; /* zero or more EA's, packed together
421 with no alignment padding. 416 with no alignment padding.
422 (Do not use this name, get here 417 (Do not use this name, get here
423 via fnode + ea_offs. I think.) */ 418 via fnode + ea_offs. I think.) */
@@ -430,7 +425,7 @@ struct fnode
430 425
431struct anode 426struct anode
432{ 427{
433 unsigned magic; /* 37e4 0aae */ 428 u32 magic; /* 37e4 0aae */
434 anode_secno self; /* pointer to this anode */ 429 anode_secno self; /* pointer to this anode */
435 secno up; /* parent anode or fnode */ 430 secno up; /* parent anode or fnode */
436 431
@@ -440,7 +435,7 @@ struct anode
440 struct bplus_internal_node internal[60]; 435 struct bplus_internal_node internal[60];
441 } u; 436 } u;
442 437
443 unsigned fill[3]; /* unused */ 438 u32 fill[3]; /* unused */
444}; 439};
445 440
446 441
@@ -471,15 +466,15 @@ struct extended_attribute
471 unsigned flag5: 1; 466 unsigned flag5: 1;
472 unsigned flag6: 1; 467 unsigned flag6: 1;
473 unsigned needea: 1; /* required ea */ 468 unsigned needea: 1; /* required ea */
474 unsigned char namelen; /* length of name, bytes */ 469 u8 namelen; /* length of name, bytes */
475 unsigned short valuelen; /* length of value, bytes */ 470 u16 valuelen; /* length of value, bytes */
476 unsigned char name[0]; 471 u8 name[0];
477 /* 472 /*
478 unsigned char name[namelen]; ascii attrib name 473 u8 name[namelen]; ascii attrib name
479 unsigned char nul; terminating '\0', not counted 474 u8 nul; terminating '\0', not counted
480 unsigned char value[valuelen]; value, arbitrary 475 u8 value[valuelen]; value, arbitrary
481 if this.indirect, valuelen is 8 and the value is 476 if this.indirect, valuelen is 8 and the value is
482 unsigned length; real length of value, bytes 477 u32 length; real length of value, bytes
483 secno secno; sector address where it starts 478 secno secno; sector address where it starts
484 if this.anode, the above sector number is the root of an anode tree 479 if this.anode, the above sector number is the root of an anode tree
485 which points to the value. 480 which points to the value.