Commit 28fe3c1963b0bafa56ec92df1987828090151d87

Authored by Al Viro
1 parent 77ee26e44c

hpfs: assorted endianness annotations

Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>

Showing 4 changed files with 60 additions and 60 deletions Side-by-side Diff

... ... @@ -51,11 +51,11 @@
51 51 u8 n_rootdir_entries[2];
52 52 u8 n_sectors_s[2];
53 53 u8 media_byte;
54   - u16 sectors_per_fat;
55   - u16 sectors_per_track;
56   - u16 heads_per_cyl;
57   - u32 n_hidden_sectors;
58   - u32 n_sectors_l; /* size of partition */
  54 + __le16 sectors_per_fat;
  55 + __le16 sectors_per_track;
  56 + __le16 heads_per_cyl;
  57 + __le32 n_hidden_sectors;
  58 + __le32 n_sectors_l; /* size of partition */
59 59 u8 drive_number;
60 60 u8 mbz;
61 61 u8 sig_28h; /* 28h */
... ... @@ -63,7 +63,7 @@
63 63 u8 vol_label[11];
64 64 u8 sig_hpfs[8]; /* "HPFS " */
65 65 u8 pad[448];
66   - u16 magic; /* aa55 */
  66 + __le16 magic; /* aa55 */
67 67 };
68 68  
69 69  
70 70  
71 71  
... ... @@ -75,28 +75,28 @@
75 75  
76 76 struct hpfs_super_block
77 77 {
78   - u32 magic; /* f995 e849 */
79   - u32 magic1; /* fa53 e9c5, more magic? */
  78 + __le32 magic; /* f995 e849 */
  79 + __le32 magic1; /* fa53 e9c5, more magic? */
80 80 u8 version; /* version of a filesystem usually 2 */
81 81 u8 funcversion; /* functional version - oldest version
82 82 of filesystem that can understand
83 83 this disk */
84   - u16 zero; /* 0 */
85   - fnode_secno root; /* fnode of root directory */
86   - secno n_sectors; /* size of filesystem */
87   - u32 n_badblocks; /* number of bad blocks */
88   - secno bitmaps; /* pointers to free space bit maps */
89   - u32 zero1; /* 0 */
90   - secno badblocks; /* bad block list */
91   - u32 zero3; /* 0 */
92   - time32_t last_chkdsk; /* date last checked, 0 if never */
93   - time32_t last_optimize; /* date last optimized, 0 if never */
94   - secno n_dir_band; /* number of sectors in dir band */
95   - secno dir_band_start; /* first sector in dir band */
96   - secno dir_band_end; /* last sector in dir band */
97   - secno dir_band_bitmap; /* free space map, 1 dnode per bit */
  84 + __le16 zero; /* 0 */
  85 + __le32 root; /* fnode of root directory */
  86 + __le32 n_sectors; /* size of filesystem */
  87 + __le32 n_badblocks; /* number of bad blocks */
  88 + __le32 bitmaps; /* pointers to free space bit maps */
  89 + __le32 zero1; /* 0 */
  90 + __le32 badblocks; /* bad block list */
  91 + __le32 zero3; /* 0 */
  92 + __le32 last_chkdsk; /* date last checked, 0 if never */
  93 + __le32 last_optimize; /* date last optimized, 0 if never */
  94 + __le32 n_dir_band; /* number of sectors in dir band */
  95 + __le32 dir_band_start; /* first sector in dir band */
  96 + __le32 dir_band_end; /* last sector in dir band */
  97 + __le32 dir_band_bitmap; /* free space map, 1 dnode per bit */
98 98 u8 volume_name[32]; /* not used */
99   - secno user_id_table; /* 8 preallocated sectors - user id */
  99 + __le32 user_id_table; /* 8 preallocated sectors - user id */
100 100 u32 zero6[103]; /* 0 */
101 101 };
102 102  
... ... @@ -109,8 +109,8 @@
109 109  
110 110 struct hpfs_spare_block
111 111 {
112   - u32 magic; /* f991 1849 */
113   - u32 magic1; /* fa52 29c5, more magic? */
  112 + __le32 magic; /* f991 1849 */
  113 + __le32 magic1; /* fa52 29c5, more magic? */
114 114  
115 115 #ifdef __LITTLE_ENDIAN
116 116 u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */
117 117  
118 118  
... ... @@ -153,21 +153,21 @@
153 153 u8 mm_contlgulty;
154 154 u8 unused;
155 155  
156   - secno hotfix_map; /* info about remapped bad sectors */
157   - u32 n_spares_used; /* number of hotfixes */
158   - u32 n_spares; /* number of spares in hotfix map */
159   - u32 n_dnode_spares_free; /* spare dnodes unused */
160   - u32 n_dnode_spares; /* length of spare_dnodes[] list,
  156 + __le32 hotfix_map; /* info about remapped bad sectors */
  157 + __le32 n_spares_used; /* number of hotfixes */
  158 + __le32 n_spares; /* number of spares in hotfix map */
  159 + __le32 n_dnode_spares_free; /* spare dnodes unused */
  160 + __le32 n_dnode_spares; /* length of spare_dnodes[] list,
161 161 follows in this block*/
162   - secno code_page_dir; /* code page directory block */
163   - u32 n_code_pages; /* number of code pages */
164   - u32 super_crc; /* on HPFS386 and LAN Server this is
  162 + __le32 code_page_dir; /* code page directory block */
  163 + __le32 n_code_pages; /* number of code pages */
  164 + __le32 super_crc; /* on HPFS386 and LAN Server this is
165 165 checksum of superblock, on normal
166 166 OS/2 unused */
167   - u32 spare_crc; /* on HPFS386 checksum of spareblock */
168   - u32 zero1[15]; /* unused */
169   - dnode_secno spare_dnodes[100]; /* emergency free dnode list */
170   - u32 zero2[1]; /* room for more? */
  167 + __le32 spare_crc; /* on HPFS386 checksum of spareblock */
  168 + __le32 zero1[15]; /* unused */
  169 + __le32 spare_dnodes[100]; /* emergency free dnode list */
  170 + __le32 zero2[1]; /* room for more? */
171 171 };
172 172  
173 173 /* The bad block list is 4 sectors long. The first word must be zero,
174 174  
175 175  
176 176  
... ... @@ -202,18 +202,18 @@
202 202  
203 203 struct code_page_directory
204 204 {
205   - u32 magic; /* 4945 21f7 */
206   - u32 n_code_pages; /* number of pointers following */
207   - u32 zero1[2];
  205 + __le32 magic; /* 4945 21f7 */
  206 + __le32 n_code_pages; /* number of pointers following */
  207 + __le32 zero1[2];
208 208 struct {
209   - u16 ix; /* index */
210   - u16 code_page_number; /* code page number */
211   - u32 bounds; /* matches corresponding word
  209 + __le16 ix; /* index */
  210 + __le16 code_page_number; /* code page number */
  211 + __le32 bounds; /* matches corresponding word
212 212 in data block */
213   - secno code_page_data; /* sector number of a code_page_data
  213 + __le32 code_page_data; /* sector number of a code_page_data
214 214 containing c.p. array */
215   - u16 index; /* index in c.p. array in that sector*/
216   - u16 unknown; /* some unknown value; usually 0;
  215 + __le16 index; /* index in c.p. array in that sector*/
  216 + __le16 unknown; /* some unknown value; usually 0;
217 217 2 in Japanese version */
218 218 } array[31]; /* unknown length */
219 219 };
220 220  
221 221  
222 222  
... ... @@ -224,19 +224,19 @@
224 224  
225 225 struct code_page_data
226 226 {
227   - u32 magic; /* 8945 21f7 */
228   - u32 n_used; /* # elements used in c_p_data[] */
229   - u32 bounds[3]; /* looks a bit like
  227 + __le32 magic; /* 8945 21f7 */
  228 + __le32 n_used; /* # elements used in c_p_data[] */
  229 + __le32 bounds[3]; /* looks a bit like
230 230 (beg1,end1), (beg2,end2)
231 231 one byte each */
232   - u16 offs[3]; /* offsets from start of sector
  232 + __le16 offs[3]; /* offsets from start of sector
233 233 to start of c_p_data[ix] */
234 234 struct {
235   - u16 ix; /* index */
236   - u16 code_page_number; /* code page number */
237   - u16 unknown; /* the same as in cp directory */
  235 + __le16 ix; /* index */
  236 + __le16 code_page_number; /* code page number */
  237 + __le16 unknown; /* the same as in cp directory */
238 238 u8 map[128]; /* upcase table for chars 80..ff */
239   - u16 zero2;
  239 + __le16 zero2;
240 240 } code_page[3];
241 241 u8 incognita[78];
242 242 };
... ... @@ -82,7 +82,7 @@
82 82 unsigned char *sb_cp_table; /* code page tables: */
83 83 /* 128 bytes uppercasing table & */
84 84 /* 128 bytes lowercasing table */
85   - unsigned *sb_bmp_dir; /* main bitmap directory */
  85 + __le32 *sb_bmp_dir; /* main bitmap directory */
86 86 unsigned sb_c_bitmap; /* current bitmap */
87 87 unsigned sb_max_fwd_alloc; /* max forwad allocation */
88 88 int sb_timeshift;
... ... @@ -278,7 +278,7 @@
278 278 __le32 *hpfs_map_dnode_bitmap(struct super_block *, struct quad_buffer_head *);
279 279 __le32 *hpfs_map_bitmap(struct super_block *, unsigned, struct quad_buffer_head *, char *);
280 280 unsigned char *hpfs_load_code_page(struct super_block *, secno);
281   -secno *hpfs_load_bitmap_directory(struct super_block *, secno bmp);
  281 +__le32 *hpfs_load_bitmap_directory(struct super_block *, secno bmp);
282 282 struct fnode *hpfs_map_fnode(struct super_block *s, ino_t, struct buffer_head **);
283 283 struct anode *hpfs_map_anode(struct super_block *s, anode_secno, struct buffer_head **);
284 284 struct dnode *hpfs_map_dnode(struct super_block *s, dnode_secno, struct quad_buffer_head *);
... ... @@ -89,18 +89,18 @@
89 89 return cp_table;
90 90 }
91 91  
92   -secno *hpfs_load_bitmap_directory(struct super_block *s, secno bmp)
  92 +__le32 *hpfs_load_bitmap_directory(struct super_block *s, secno bmp)
93 93 {
94 94 struct buffer_head *bh;
95 95 int n = (hpfs_sb(s)->sb_fs_size + 0x200000 - 1) >> 21;
96 96 int i;
97   - secno *b;
  97 + __le32 *b;
98 98 if (!(b = kmalloc(n * 512, GFP_KERNEL))) {
99 99 printk("HPFS: can't allocate memory for bitmap directory\n");
100 100 return NULL;
101 101 }
102 102 for (i=0;i<n;i++) {
103   - secno *d = hpfs_map_sector(s, bmp+i, &bh, n - i - 1);
  103 + __le32 *d = hpfs_map_sector(s, bmp+i, &bh, n - i - 1);
104 104 if (!d) {
105 105 kfree(b);
106 106 return NULL;
... ... @@ -572,7 +572,7 @@
572 572 mark_buffer_dirty(bh2);
573 573 }
574 574  
575   - if (spareblock->hotfixes_used || le32_to_cpu(spareblock->n_spares_used)) {
  575 + if (spareblock->hotfixes_used || spareblock->n_spares_used) {
576 576 if (errs >= 2) {
577 577 printk("HPFS: Hotfixes not supported here, try chkdsk\n");
578 578 mark_dirty(s, 0);