diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2012-04-17 15:28:51 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2012-05-29 23:28:37 -0400 |
commit | 52576da3545e78c534d901a39f6f2391665c641b (patch) | |
tree | 349a87013bdda071fcf3644521b3147e95ddaa2f /fs/hpfs | |
parent | c4c995430a94e7d94526fcb347c4ba4b2ae82500 (diff) |
hpfs: bitmaps are little-endian
annotate properly...
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/hpfs')
-rw-r--r-- | fs/hpfs/alloc.c | 14 | ||||
-rw-r--r-- | fs/hpfs/hpfs_fn.h | 6 | ||||
-rw-r--r-- | fs/hpfs/map.c | 4 |
3 files changed, 12 insertions, 12 deletions
diff --git a/fs/hpfs/alloc.c b/fs/hpfs/alloc.c index 7a5eb2c718c..cdb84a83806 100644 --- a/fs/hpfs/alloc.c +++ b/fs/hpfs/alloc.c | |||
@@ -16,9 +16,9 @@ | |||
16 | static int chk_if_allocated(struct super_block *s, secno sec, char *msg) | 16 | static int chk_if_allocated(struct super_block *s, secno sec, char *msg) |
17 | { | 17 | { |
18 | struct quad_buffer_head qbh; | 18 | struct quad_buffer_head qbh; |
19 | u32 *bmp; | 19 | __le32 *bmp; |
20 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; | 20 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "chk"))) goto fail; |
21 | if ((cpu_to_le32(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) { | 21 | if ((le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) >> (sec & 0x1f)) & 1) { |
22 | hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); | 22 | hpfs_error(s, "sector '%s' - %08x not allocated in bitmap", msg, sec); |
23 | goto fail1; | 23 | goto fail1; |
24 | } | 24 | } |
@@ -62,7 +62,7 @@ int hpfs_chk_sectors(struct super_block *s, secno start, int len, char *msg) | |||
62 | static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigned forward) | 62 | static secno alloc_in_bmp(struct super_block *s, secno near, unsigned n, unsigned forward) |
63 | { | 63 | { |
64 | struct quad_buffer_head qbh; | 64 | struct quad_buffer_head qbh; |
65 | unsigned *bmp; | 65 | __le32 *bmp; |
66 | unsigned bs = near & ~0x3fff; | 66 | unsigned bs = near & ~0x3fff; |
67 | unsigned nr = (near & 0x3fff) & ~(n - 1); | 67 | unsigned nr = (near & 0x3fff) & ~(n - 1); |
68 | /*unsigned mnr;*/ | 68 | /*unsigned mnr;*/ |
@@ -236,7 +236,7 @@ static secno alloc_in_dirband(struct super_block *s, secno near) | |||
236 | int hpfs_alloc_if_possible(struct super_block *s, secno sec) | 236 | int hpfs_alloc_if_possible(struct super_block *s, secno sec) |
237 | { | 237 | { |
238 | struct quad_buffer_head qbh; | 238 | struct quad_buffer_head qbh; |
239 | u32 *bmp; | 239 | __le32 *bmp; |
240 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; | 240 | if (!(bmp = hpfs_map_bitmap(s, sec >> 14, &qbh, "aip"))) goto end; |
241 | if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) { | 241 | if (le32_to_cpu(bmp[(sec & 0x3fff) >> 5]) & (1 << (sec & 0x1f))) { |
242 | bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f))); | 242 | bmp[(sec & 0x3fff) >> 5] &= cpu_to_le32(~(1 << (sec & 0x1f))); |
@@ -254,7 +254,7 @@ int hpfs_alloc_if_possible(struct super_block *s, secno sec) | |||
254 | void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) | 254 | void hpfs_free_sectors(struct super_block *s, secno sec, unsigned n) |
255 | { | 255 | { |
256 | struct quad_buffer_head qbh; | 256 | struct quad_buffer_head qbh; |
257 | u32 *bmp; | 257 | __le32 *bmp; |
258 | struct hpfs_sb_info *sbi = hpfs_sb(s); | 258 | struct hpfs_sb_info *sbi = hpfs_sb(s); |
259 | /*printk("2 - ");*/ | 259 | /*printk("2 - ");*/ |
260 | if (!n) return; | 260 | if (!n) return; |
@@ -299,7 +299,7 @@ int hpfs_check_free_dnodes(struct super_block *s, int n) | |||
299 | int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; | 299 | int n_bmps = (hpfs_sb(s)->sb_fs_size + 0x4000 - 1) >> 14; |
300 | int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; | 300 | int b = hpfs_sb(s)->sb_c_bitmap & 0x0fffffff; |
301 | int i, j; | 301 | int i, j; |
302 | u32 *bmp; | 302 | __le32 *bmp; |
303 | struct quad_buffer_head qbh; | 303 | struct quad_buffer_head qbh; |
304 | if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { | 304 | if ((bmp = hpfs_map_dnode_bitmap(s, &qbh))) { |
305 | for (j = 0; j < 512; j++) { | 305 | for (j = 0; j < 512; j++) { |
@@ -351,7 +351,7 @@ void hpfs_free_dnode(struct super_block *s, dnode_secno dno) | |||
351 | hpfs_free_sectors(s, dno, 4); | 351 | hpfs_free_sectors(s, dno, 4); |
352 | } else { | 352 | } else { |
353 | struct quad_buffer_head qbh; | 353 | struct quad_buffer_head qbh; |
354 | u32 *bmp; | 354 | __le32 *bmp; |
355 | unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; | 355 | unsigned ssec = (dno - hpfs_sb(s)->sb_dirband_start) / 4; |
356 | if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { | 356 | if (!(bmp = hpfs_map_dnode_bitmap(s, &qbh))) { |
357 | return; | 357 | return; |
diff --git a/fs/hpfs/hpfs_fn.h b/fs/hpfs/hpfs_fn.h index de946170ebb..88f096d9dbe 100644 --- a/fs/hpfs/hpfs_fn.h +++ b/fs/hpfs/hpfs_fn.h | |||
@@ -178,7 +178,7 @@ static inline void copy_de(struct hpfs_dirent *dst, struct hpfs_dirent *src) | |||
178 | dst->not_8x3 = n; | 178 | dst->not_8x3 = n; |
179 | } | 179 | } |
180 | 180 | ||
181 | static inline unsigned tstbits(u32 *bmp, unsigned b, unsigned n) | 181 | static inline unsigned tstbits(__le32 *bmp, unsigned b, unsigned n) |
182 | { | 182 | { |
183 | int i; | 183 | int i; |
184 | if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n; | 184 | if ((b >= 0x4000) || (b + n - 1 >= 0x4000)) return n; |
@@ -275,8 +275,8 @@ void hpfs_evict_inode(struct inode *); | |||
275 | 275 | ||
276 | /* map.c */ | 276 | /* map.c */ |
277 | 277 | ||
278 | unsigned *hpfs_map_dnode_bitmap(struct super_block *, struct quad_buffer_head *); | 278 | __le32 *hpfs_map_dnode_bitmap(struct super_block *, struct quad_buffer_head *); |
279 | unsigned *hpfs_map_bitmap(struct super_block *, unsigned, struct quad_buffer_head *, char *); | 279 | __le32 *hpfs_map_bitmap(struct super_block *, unsigned, struct quad_buffer_head *, char *); |
280 | unsigned char *hpfs_load_code_page(struct super_block *, secno); | 280 | unsigned char *hpfs_load_code_page(struct super_block *, secno); |
281 | secno *hpfs_load_bitmap_directory(struct super_block *, secno bmp); | 281 | secno *hpfs_load_bitmap_directory(struct super_block *, secno bmp); |
282 | struct fnode *hpfs_map_fnode(struct super_block *s, ino_t, struct buffer_head **); | 282 | struct fnode *hpfs_map_fnode(struct super_block *s, ino_t, struct buffer_head **); |
diff --git a/fs/hpfs/map.c b/fs/hpfs/map.c index fffcb330694..bbb174df7f9 100644 --- a/fs/hpfs/map.c +++ b/fs/hpfs/map.c | |||
@@ -8,12 +8,12 @@ | |||
8 | 8 | ||
9 | #include "hpfs_fn.h" | 9 | #include "hpfs_fn.h" |
10 | 10 | ||
11 | unsigned *hpfs_map_dnode_bitmap(struct super_block *s, struct quad_buffer_head *qbh) | 11 | __le32 *hpfs_map_dnode_bitmap(struct super_block *s, struct quad_buffer_head *qbh) |
12 | { | 12 | { |
13 | return hpfs_map_4sectors(s, hpfs_sb(s)->sb_dmap, qbh, 0); | 13 | return hpfs_map_4sectors(s, hpfs_sb(s)->sb_dmap, qbh, 0); |
14 | } | 14 | } |
15 | 15 | ||
16 | unsigned int *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block, | 16 | __le32 *hpfs_map_bitmap(struct super_block *s, unsigned bmp_block, |
17 | struct quad_buffer_head *qbh, char *id) | 17 | struct quad_buffer_head *qbh, char *id) |
18 | { | 18 | { |
19 | secno sec; | 19 | secno sec; |