Commit 64d7cc85 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] adfs endianness annotations

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 3cae3cfd
...@@ -93,7 +93,7 @@ static inline void adfs_writename(char *to, char *from, int maxlen) ...@@ -93,7 +93,7 @@ static inline void adfs_writename(char *to, char *from, int maxlen)
#define dir_u32(idx) \ #define dir_u32(idx) \
({ int _buf = idx >> blocksize_bits; \ ({ int _buf = idx >> blocksize_bits; \
int _off = idx - (_buf << blocksize_bits);\ int _off = idx - (_buf << blocksize_bits);\
*(u32 *)(bh[_buf]->b_data + _off); \ *(__le32 *)(bh[_buf]->b_data + _off); \
}) })
#define bufoff(_bh,_idx) \ #define bufoff(_bh,_idx) \
...@@ -112,7 +112,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir) ...@@ -112,7 +112,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
{ {
struct buffer_head * const *bh = dir->bh; struct buffer_head * const *bh = dir->bh;
const int blocksize_bits = dir->sb->s_blocksize_bits; const int blocksize_bits = dir->sb->s_blocksize_bits;
union { u32 *ptr32; u8 *ptr8; } ptr, end; union { __le32 *ptr32; u8 *ptr8; } ptr, end;
u32 dircheck = 0; u32 dircheck = 0;
int last = 5 - 26; int last = 5 - 26;
int i = 0; int i = 0;
...@@ -125,7 +125,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir) ...@@ -125,7 +125,7 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
do { do {
last += 26; last += 26;
do { do {
dircheck = cpu_to_le32(dir_u32(i)) ^ ror13(dircheck); dircheck = le32_to_cpu(dir_u32(i)) ^ ror13(dircheck);
i += sizeof(u32); i += sizeof(u32);
} while (i < (last & ~3)); } while (i < (last & ~3));
...@@ -155,8 +155,8 @@ adfs_dir_checkbyte(const struct adfs_dir *dir) ...@@ -155,8 +155,8 @@ adfs_dir_checkbyte(const struct adfs_dir *dir)
end.ptr8 = ptr.ptr8 + 36; end.ptr8 = ptr.ptr8 + 36;
do { do {
unsigned int v = *ptr.ptr32++; __le32 v = *ptr.ptr32++;
dircheck = cpu_to_le32(v) ^ ror13(dircheck); dircheck = le32_to_cpu(v) ^ ror13(dircheck);
} while (ptr.ptr32 < end.ptr32); } while (ptr.ptr32 < end.ptr32);
return (dircheck ^ (dircheck >> 8) ^ (dircheck >> 16) ^ (dircheck >> 24)) & 0xff; return (dircheck ^ (dircheck >> 8) ^ (dircheck >> 16) ^ (dircheck >> 24)) & 0xff;
......
...@@ -18,27 +18,27 @@ ...@@ -18,27 +18,27 @@
struct adfs_bigdirheader { struct adfs_bigdirheader {
__u8 startmasseq; __u8 startmasseq;
__u8 bigdirversion[3]; __u8 bigdirversion[3];
__u32 bigdirstartname; __le32 bigdirstartname;
__u32 bigdirnamelen; __le32 bigdirnamelen;
__u32 bigdirsize; __le32 bigdirsize;
__u32 bigdirentries; __le32 bigdirentries;
__u32 bigdirnamesize; __le32 bigdirnamesize;
__u32 bigdirparent; __le32 bigdirparent;
char bigdirname[1]; char bigdirname[1];
}; };
struct adfs_bigdirentry { struct adfs_bigdirentry {
__u32 bigdirload; __le32 bigdirload;
__u32 bigdirexec; __le32 bigdirexec;
__u32 bigdirlen; __le32 bigdirlen;
__u32 bigdirindaddr; __le32 bigdirindaddr;
__u32 bigdirattr; __le32 bigdirattr;
__u32 bigdirobnamelen; __le32 bigdirobnamelen;
__u32 bigdirobnameptr; __le32 bigdirobnameptr;
}; };
struct adfs_bigdirtail { struct adfs_bigdirtail {
__u32 bigdirendname; __le32 bigdirendname;
__u8 bigdirendmasseq; __u8 bigdirendmasseq;
__u8 reserved[2]; __u8 reserved[2];
__u8 bigdircheckbyte; __u8 bigdircheckbyte;
......
...@@ -92,9 +92,8 @@ lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen, ...@@ -92,9 +92,8 @@ lookup_zone(const struct adfs_discmap *dm, const unsigned int idlen,
* find end of fragment * find end of fragment
*/ */
{ {
u32 v, *_map = (u32 *)map; __le32 *_map = (__le32 *)map;
u32 v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31);
v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31);
while (v == 0) { while (v == 0) {
mapptr = (mapptr & ~31) + 32; mapptr = (mapptr & ~31) + 32;
if (mapptr >= mapsize) if (mapptr >= mapsize)
...@@ -171,9 +170,8 @@ scan_free_map(struct adfs_sb_info *asb, struct adfs_discmap *dm) ...@@ -171,9 +170,8 @@ scan_free_map(struct adfs_sb_info *asb, struct adfs_discmap *dm)
* find end of fragment * find end of fragment
*/ */
{ {
u32 v, *_map = (u32 *)map; __le32 *_map = (__le32 *)map;
u32 v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31);
v = le32_to_cpu(_map[mapptr >> 5]) >> (mapptr & 31);
while (v == 0) { while (v == 0) {
mapptr = (mapptr & ~31) + 32; mapptr = (mapptr & ~31) + 32;
if (mapptr >= mapsize) if (mapptr >= mapsize)
......
...@@ -17,20 +17,20 @@ struct adfs_discrecord { ...@@ -17,20 +17,20 @@ struct adfs_discrecord {
__u8 bootoption; __u8 bootoption;
__u8 lowsector; __u8 lowsector;
__u8 nzones; __u8 nzones;
__u16 zone_spare; __le16 zone_spare;
__u32 root; __le32 root;
__u32 disc_size; __le32 disc_size;
__u16 disc_id; __le16 disc_id;
__u8 disc_name[10]; __u8 disc_name[10];
__u32 disc_type; __le32 disc_type;
__u32 disc_size_high; __le32 disc_size_high;
__u8 log2sharesize:4; __u8 log2sharesize:4;
__u8 unused40:4; __u8 unused40:4;
__u8 big_flag:1; __u8 big_flag:1;
__u8 unused41:1; __u8 unused41:1;
__u8 nzones_high; __u8 nzones_high;
__u32 format_version; __le32 format_version;
__u32 root_size; __le32 root_size;
__u8 unused52[60 - 52]; __u8 unused52[60 - 52];
}; };
......
...@@ -31,7 +31,7 @@ struct adfs_sb_info { ...@@ -31,7 +31,7 @@ struct adfs_sb_info {
unsigned long s_size; /* total size (in blocks) of this fs */ unsigned long s_size; /* total size (in blocks) of this fs */
signed int s_map2blk; /* shift left by this for map->sector */ signed int s_map2blk; /* shift left by this for map->sector */
unsigned int s_log2sharesize;/* log2 share size */ unsigned int s_log2sharesize;/* log2 share size */
unsigned int s_version; /* disc format version */ __le32 s_version; /* disc format version */
unsigned int s_namelen; /* maximum number of characters in name */ unsigned int s_namelen; /* maximum number of characters in name */
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment