Skip to content

Commit 28fe3c1

Browse files
author
Al Viro
committed
hpfs: assorted endianness annotations
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
1 parent 77ee26e commit 28fe3c1

4 files changed

Lines changed: 60 additions & 60 deletions

File tree

‎fs/hpfs/hpfs.h‎

Lines changed: 54 additions & 54 deletions
Original file line numberDiff line numberDiff line change
@@ -51,19 +51,19 @@ struct hpfs_boot_block
5151
u8 n_rootdir_entries[2];
5252
u8 n_sectors_s[2];
5353
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 */
5959
u8 drive_number;
6060
u8 mbz;
6161
u8 sig_28h; /* 28h */
6262
u8 vol_serno[4];
6363
u8 vol_label[11];
6464
u8 sig_hpfs[8]; /* "HPFS " */
6565
u8 pad[448];
66-
u16 magic; /* aa55 */
66+
__le16 magic; /* aa55 */
6767
};
6868

6969

@@ -75,28 +75,28 @@ struct hpfs_boot_block
7575

7676
struct hpfs_super_block
7777
{
78-
u32 magic; /* f995 e849 */
79-
u32 magic1; /* fa53 e9c5, more magic? */
78+
__le32 magic; /* f995 e849 */
79+
__le32 magic1; /* fa53 e9c5, more magic? */
8080
u8 version; /* version of a filesystem usually 2 */
8181
u8 funcversion; /* functional version - oldest version
8282
of filesystem that can understand
8383
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 */
9898
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 */
100100
u32 zero6[103]; /* 0 */
101101
};
102102

@@ -109,8 +109,8 @@ struct hpfs_super_block
109109

110110
struct hpfs_spare_block
111111
{
112-
u32 magic; /* f991 1849 */
113-
u32 magic1; /* fa52 29c5, more magic? */
112+
__le32 magic; /* f991 1849 */
113+
__le32 magic1; /* fa52 29c5, more magic? */
114114

115115
#ifdef __LITTLE_ENDIAN
116116
u8 dirty: 1; /* 0 clean, 1 "improperly stopped" */
@@ -153,21 +153,21 @@ struct hpfs_spare_block
153153
u8 mm_contlgulty;
154154
u8 unused;
155155

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,
161161
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
165165
checksum of superblock, on normal
166166
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? */
171171
};
172172

173173
/* The bad block list is 4 sectors long. The first word must be zero,
@@ -202,18 +202,18 @@ struct hpfs_spare_block
202202

203203
struct code_page_directory
204204
{
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];
208208
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
212212
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
214214
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;
217217
2 in Japanese version */
218218
} array[31]; /* unknown length */
219219
};
@@ -224,19 +224,19 @@ struct code_page_directory
224224

225225
struct code_page_data
226226
{
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
230230
(beg1,end1), (beg2,end2)
231231
one byte each */
232-
u16 offs[3]; /* offsets from start of sector
232+
__le16 offs[3]; /* offsets from start of sector
233233
to start of c_p_data[ix] */
234234
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 */
238238
u8 map[128]; /* upcase table for chars 80..ff */
239-
u16 zero2;
239+
__le16 zero2;
240240
} code_page[3];
241241
u8 incognita[78];
242242
};

‎fs/hpfs/hpfs_fn.h‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ struct hpfs_sb_info {
8282
unsigned char *sb_cp_table; /* code page tables: */
8383
/* 128 bytes uppercasing table & */
8484
/* 128 bytes lowercasing table */
85-
unsigned *sb_bmp_dir; /* main bitmap directory */
85+
__le32 *sb_bmp_dir; /* main bitmap directory */
8686
unsigned sb_c_bitmap; /* current bitmap */
8787
unsigned sb_max_fwd_alloc; /* max forwad allocation */
8888
int sb_timeshift;
@@ -278,7 +278,7 @@ void hpfs_evict_inode(struct inode *);
278278
__le32 *hpfs_map_dnode_bitmap(struct super_block *, struct quad_buffer_head *);
279279
__le32 *hpfs_map_bitmap(struct super_block *, unsigned, struct quad_buffer_head *, char *);
280280
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);
282282
struct fnode *hpfs_map_fnode(struct super_block *s, ino_t, struct buffer_head **);
283283
struct anode *hpfs_map_anode(struct super_block *s, anode_secno, struct buffer_head **);
284284
struct dnode *hpfs_map_dnode(struct super_block *s, dnode_secno, struct quad_buffer_head *);

‎fs/hpfs/map.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,18 +89,18 @@ unsigned char *hpfs_load_code_page(struct super_block *s, secno cps)
8989
return cp_table;
9090
}
9191

92-
secno *hpfs_load_bitmap_directory(struct super_block *s, secno bmp)
92+
__le32 *hpfs_load_bitmap_directory(struct super_block *s, secno bmp)
9393
{
9494
struct buffer_head *bh;
9595
int n = (hpfs_sb(s)->sb_fs_size + 0x200000 - 1) >> 21;
9696
int i;
97-
secno *b;
97+
__le32 *b;
9898
if (!(b = kmalloc(n * 512, GFP_KERNEL))) {
9999
printk("HPFS: can't allocate memory for bitmap directory\n");
100100
return NULL;
101101
}
102102
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);
104104
if (!d) {
105105
kfree(b);
106106
return NULL;

‎fs/hpfs/super.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -572,7 +572,7 @@ static int hpfs_fill_super(struct super_block *s, void *options, int silent)
572572
mark_buffer_dirty(bh2);
573573
}
574574

575-
if (spareblock->hotfixes_used || le32_to_cpu(spareblock->n_spares_used)) {
575+
if (spareblock->hotfixes_used || spareblock->n_spares_used) {
576576
if (errs >= 2) {
577577
printk("HPFS: Hotfixes not supported here, try chkdsk\n");
578578
mark_dirty(s, 0);

0 commit comments

Comments
 (0)