Commit 306a3b89 authored by Alexander Viro's avatar Alexander Viro Committed by Linus Torvalds

[PATCH] hfsplus endianness annotations

Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.org.uk>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent df5acb11
...@@ -85,7 +85,8 @@ int hfs_brec_find(struct hfs_find_data *fd) ...@@ -85,7 +85,8 @@ int hfs_brec_find(struct hfs_find_data *fd)
{ {
struct hfs_btree *tree; struct hfs_btree *tree;
struct hfs_bnode *bnode; struct hfs_bnode *bnode;
u32 data, nidx, parent; u32 nidx, parent;
__be32 data;
int height, res; int height, res;
tree = fd->tree; tree = fd->tree;
......
...@@ -19,8 +19,9 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma ...@@ -19,8 +19,9 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
{ {
struct page *page; struct page *page;
struct address_space *mapping; struct address_space *mapping;
u32 *pptr, *curr, *end; __be32 *pptr, *curr, *end;
u32 val, mask, start, len; u32 mask, start, len, n;
__be32 val;
int i; int i;
len = *max; len = *max;
...@@ -44,10 +45,10 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma ...@@ -44,10 +45,10 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
/* scan the first partial u32 for zero bits */ /* scan the first partial u32 for zero bits */
val = *curr; val = *curr;
if (~val) { if (~val) {
val = be32_to_cpu(val); n = be32_to_cpu(val);
mask = (1U << 31) >> i; mask = (1U << 31) >> i;
for (; i < 32; mask >>= 1, i++) { for (; i < 32; mask >>= 1, i++) {
if (!(val & mask)) if (!(n & mask))
goto found; goto found;
} }
} }
...@@ -58,10 +59,10 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma ...@@ -58,10 +59,10 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
while (curr < end) { while (curr < end) {
val = *curr; val = *curr;
if (~val) { if (~val) {
val = be32_to_cpu(val); n = be32_to_cpu(val);
mask = 1 << 31; mask = 1 << 31;
for (i = 0; i < 32; mask >>= 1, i++) { for (i = 0; i < 32; mask >>= 1, i++) {
if (!(val & mask)) if (!(n & mask))
goto found; goto found;
} }
} }
...@@ -92,27 +93,27 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma ...@@ -92,27 +93,27 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
/* do any partial u32 at the start */ /* do any partial u32 at the start */
len = min(size - start, len); len = min(size - start, len);
while (1) { while (1) {
val |= mask; n |= mask;
if (++i >= 32) if (++i >= 32)
break; break;
mask >>= 1; mask >>= 1;
if (!--len || val & mask) if (!--len || n & mask)
goto done; goto done;
} }
if (!--len) if (!--len)
goto done; goto done;
*curr++ = cpu_to_be32(val); *curr++ = cpu_to_be32(n);
/* do full u32s */ /* do full u32s */
while (1) { while (1) {
while (curr < end) { while (curr < end) {
val = be32_to_cpu(*curr); n = be32_to_cpu(*curr);
if (len < 32) if (len < 32)
goto last; goto last;
if (val) { if (n) {
len = 32; len = 32;
goto last; goto last;
} }
*curr++ = 0xffffffffU; *curr++ = cpu_to_be32(0xffffffff);
len -= 32; len -= 32;
} }
set_page_dirty(page); set_page_dirty(page);
...@@ -128,13 +129,13 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma ...@@ -128,13 +129,13 @@ int hfsplus_block_allocate(struct super_block *sb, u32 size, u32 offset, u32 *ma
/* do any partial u32 at end */ /* do any partial u32 at end */
mask = 1U << 31; mask = 1U << 31;
for (i = 0; i < len; i++) { for (i = 0; i < len; i++) {
if (val & mask) if (n & mask)
break; break;
val |= mask; n |= mask;
mask >>= 1; mask >>= 1;
} }
done: done:
*curr = cpu_to_be32(val); *curr = cpu_to_be32(n);
set_page_dirty(page); set_page_dirty(page);
kunmap(page); kunmap(page);
*max = offset + (curr - pptr) * 32 + i - start; *max = offset + (curr - pptr) * 32 + i - start;
...@@ -150,7 +151,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count) ...@@ -150,7 +151,7 @@ int hfsplus_block_free(struct super_block *sb, u32 offset, u32 count)
{ {
struct page *page; struct page *page;
struct address_space *mapping; struct address_space *mapping;
u32 *pptr, *curr, *end; __be32 *pptr, *curr, *end;
u32 mask, len, pnr; u32 mask, len, pnr;
int i; int i;
......
...@@ -44,7 +44,7 @@ void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len) ...@@ -44,7 +44,7 @@ void hfs_bnode_read(struct hfs_bnode *node, void *buf, int off, int len)
u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off) u16 hfs_bnode_read_u16(struct hfs_bnode *node, int off)
{ {
u16 data; __be16 data;
// optimize later... // optimize later...
hfs_bnode_read(node, &data, off, 2); hfs_bnode_read(node, &data, off, 2);
return be16_to_cpu(data); return be16_to_cpu(data);
...@@ -98,9 +98,9 @@ void hfs_bnode_write(struct hfs_bnode *node, void *buf, int off, int len) ...@@ -98,9 +98,9 @@ void hfs_bnode_write(struct hfs_bnode *node, void *buf, int off, int len)
void hfs_bnode_write_u16(struct hfs_bnode *node, int off, u16 data) void hfs_bnode_write_u16(struct hfs_bnode *node, int off, u16 data)
{ {
data = cpu_to_be16(data); __be16 v = cpu_to_be16(data);
// optimize later... // optimize later...
hfs_bnode_write(node, &data, off, 2); hfs_bnode_write(node, &v, off, 2);
} }
void hfs_bnode_clear(struct hfs_bnode *node, int off, int len) void hfs_bnode_clear(struct hfs_bnode *node, int off, int len)
...@@ -297,7 +297,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len) ...@@ -297,7 +297,7 @@ void hfs_bnode_move(struct hfs_bnode *node, int dst, int src, int len)
void hfs_bnode_dump(struct hfs_bnode *node) void hfs_bnode_dump(struct hfs_bnode *node)
{ {
struct hfs_bnode_desc desc; struct hfs_bnode_desc desc;
u32 cnid; __be32 cnid;
int i, off, key_off; int i, off, key_off;
dprint(DBG_BNODE_MOD, "bnode: %d\n", node->this); dprint(DBG_BNODE_MOD, "bnode: %d\n", node->this);
...@@ -334,7 +334,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node) ...@@ -334,7 +334,7 @@ void hfs_bnode_unlink(struct hfs_bnode *node)
{ {
struct hfs_btree *tree; struct hfs_btree *tree;
struct hfs_bnode *tmp; struct hfs_bnode *tmp;
u32 cnid; __be32 cnid;
tree = node->tree; tree = node->tree;
if (node->prev) { if (node->prev) {
......
...@@ -14,7 +14,7 @@ ...@@ -14,7 +14,7 @@
/* Get the length and offset of the given record in the given node */ /* Get the length and offset of the given record in the given node */
u16 hfs_brec_lenoff(struct hfs_bnode *node, u16 rec, u16 *off) u16 hfs_brec_lenoff(struct hfs_bnode *node, u16 rec, u16 *off)
{ {
u16 retval[2]; __be16 retval[2];
u16 dataoff; u16 dataoff;
dataoff = node->tree->node_size - (rec + 2) * 2; dataoff = node->tree->node_size - (rec + 2) * 2;
...@@ -53,7 +53,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len) ...@@ -53,7 +53,7 @@ int hfs_brec_insert(struct hfs_find_data *fd, void *entry, int entry_len)
int size, key_len, rec; int size, key_len, rec;
int data_off, end_off; int data_off, end_off;
int idx_rec_off, data_rec_off, end_rec_off; int idx_rec_off, data_rec_off, end_rec_off;
u32 cnid; __be32 cnid;
tree = fd->tree; tree = fd->tree;
if (!fd->bnode) { if (!fd->bnode) {
...@@ -387,7 +387,7 @@ int hfs_brec_update_parent(struct hfs_find_data *fd) ...@@ -387,7 +387,7 @@ int hfs_brec_update_parent(struct hfs_find_data *fd)
node = parent; node = parent;
if (new_node) { if (new_node) {
u32 cnid; __be32 cnid;
fd->bnode = hfs_bnode_find(tree, new_node->parent); fd->bnode = hfs_bnode_find(tree, new_node->parent);
/* create index key and entry */ /* create index key and entry */
...@@ -419,7 +419,7 @@ int hfs_btree_inc_height(struct hfs_btree *tree) ...@@ -419,7 +419,7 @@ int hfs_btree_inc_height(struct hfs_btree *tree)
struct hfs_bnode *node, *new_node; struct hfs_bnode *node, *new_node;
struct hfs_bnode_desc node_desc; struct hfs_bnode_desc node_desc;
int key_size, rec; int key_size, rec;
u32 cnid; __be32 cnid;
node = NULL; node = NULL;
if (tree->root) { if (tree->root) {
......
...@@ -142,7 +142,7 @@ static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx) ...@@ -142,7 +142,7 @@ static struct hfs_bnode *hfs_bmap_new_bmap(struct hfs_bnode *prev, u32 idx)
struct hfs_btree *tree = prev->tree; struct hfs_btree *tree = prev->tree;
struct hfs_bnode *node; struct hfs_bnode *node;
struct hfs_bnode_desc desc; struct hfs_bnode_desc desc;
u32 cnid; __be32 cnid;
node = hfs_bnode_create(tree, idx); node = hfs_bnode_create(tree, idx);
if (IS_ERR(node)) if (IS_ERR(node))
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
int hfsplus_cat_cmp_key(hfsplus_btree_key *k1, hfsplus_btree_key *k2) int hfsplus_cat_cmp_key(hfsplus_btree_key *k1, hfsplus_btree_key *k2)
{ {
u32 k1p, k2p; __be32 k1p, k2p;
k1p = k1->cat.parent; k1p = k1->cat.parent;
k2p = k2->cat.parent; k2p = k2->cat.parent;
...@@ -34,8 +34,10 @@ void hfsplus_cat_build_key(hfsplus_btree_key *key, u32 parent, ...@@ -34,8 +34,10 @@ void hfsplus_cat_build_key(hfsplus_btree_key *key, u32 parent,
if (str) { if (str) {
hfsplus_asc2uni(&key->cat.name, str->name, str->len); hfsplus_asc2uni(&key->cat.name, str->name, str->len);
len = be16_to_cpu(key->cat.name.length); len = be16_to_cpu(key->cat.name.length);
} else } else {
len = key->cat.name.length = 0; key->cat.name.length = 0;
len = 0;
}
key->key_len = cpu_to_be16(6 + 2 * len); key->key_len = cpu_to_be16(6 + 2 * len);
} }
......
...@@ -19,8 +19,8 @@ ...@@ -19,8 +19,8 @@
/* Compare two extents keys, returns 0 on same, pos/neg for difference */ /* Compare two extents keys, returns 0 on same, pos/neg for difference */
int hfsplus_ext_cmp_key(hfsplus_btree_key *k1, hfsplus_btree_key *k2) int hfsplus_ext_cmp_key(hfsplus_btree_key *k1, hfsplus_btree_key *k2)
{ {
u32 k1id, k2id; __be32 k1id, k2id;
u32 k1s, k2s; __be32 k1s, k2s;
k1id = k1->ext.cnid; k1id = k1->ext.cnid;
k2id = k2->ext.cnid; k2id = k2->ext.cnid;
......
...@@ -45,12 +45,12 @@ ...@@ -45,12 +45,12 @@
/* Structures used on disk */ /* Structures used on disk */
typedef u32 hfsplus_cnid; typedef __be32 hfsplus_cnid;
typedef u16 hfsplus_unichr; typedef __be16 hfsplus_unichr;
/* A "string" as used in filenames, etc. */ /* A "string" as used in filenames, etc. */
struct hfsplus_unistr { struct hfsplus_unistr {
u16 length; __be16 length;
hfsplus_unichr unicode[255]; hfsplus_unichr unicode[255];
} __packed; } __packed;
...@@ -58,12 +58,12 @@ struct hfsplus_unistr { ...@@ -58,12 +58,12 @@ struct hfsplus_unistr {
/* POSIX permissions */ /* POSIX permissions */
struct hfsplus_perm { struct hfsplus_perm {
u32 owner; __be32 owner;
u32 group; __be32 group;
u8 rootflags; u8 rootflags;
u8 userflags; u8 userflags;
u16 mode; __be16 mode;
u32 dev; __be32 dev;
} __packed; } __packed;
#define HFSPLUS_FLG_NODUMP 0x01 #define HFSPLUS_FLG_NODUMP 0x01
...@@ -72,46 +72,46 @@ struct hfsplus_perm { ...@@ -72,46 +72,46 @@ struct hfsplus_perm {
/* A single contiguous area of a file */ /* A single contiguous area of a file */
struct hfsplus_extent { struct hfsplus_extent {
u32 start_block; __be32 start_block;
u32 block_count; __be32 block_count;
} __packed; } __packed;
typedef struct hfsplus_extent hfsplus_extent_rec[8]; typedef struct hfsplus_extent hfsplus_extent_rec[8];
/* Information for a "Fork" in a file */ /* Information for a "Fork" in a file */
struct hfsplus_fork_raw { struct hfsplus_fork_raw {
u64 total_size; __be64 total_size;
u32 clump_size; __be32 clump_size;
u32 total_blocks; __be32 total_blocks;
hfsplus_extent_rec extents; hfsplus_extent_rec extents;
} __packed; } __packed;
/* HFS+ Volume Header */ /* HFS+ Volume Header */
struct hfsplus_vh { struct hfsplus_vh {
u16 signature; __be16 signature;
u16 version; __be16 version;
u32 attributes; __be32 attributes;
u32 last_mount_vers; __be32 last_mount_vers;
u32 reserved; u32 reserved;
u32 create_date; __be32 create_date;
u32 modify_date; __be32 modify_date;
u32 backup_date; __be32 backup_date;
u32 checked_date; __be32 checked_date;
u32 file_count; __be32 file_count;
u32 folder_count; __be32 folder_count;
u32 blocksize; __be32 blocksize;
u32 total_blocks; __be32 total_blocks;
u32 free_blocks; __be32 free_blocks;
u32 next_alloc; __be32 next_alloc;
u32 rsrc_clump_sz; __be32 rsrc_clump_sz;
u32 data_clump_sz; __be32 data_clump_sz;
hfsplus_cnid next_cnid; hfsplus_cnid next_cnid;
u32 write_count; __be32 write_count;
u64 encodings_bmp; __be64 encodings_bmp;
u8 finder_info[32]; u8 finder_info[32];
...@@ -131,11 +131,11 @@ struct hfsplus_vh { ...@@ -131,11 +131,11 @@ struct hfsplus_vh {
/* HFS+ BTree node descriptor */ /* HFS+ BTree node descriptor */
struct hfs_bnode_desc { struct hfs_bnode_desc {
u32 next; __be32 next;
u32 prev; __be32 prev;
s8 type; s8 type;
u8 height; u8 height;
u16 num_recs; __be16 num_recs;
u16 reserved; u16 reserved;
} __packed; } __packed;
...@@ -147,20 +147,20 @@ struct hfs_bnode_desc { ...@@ -147,20 +147,20 @@ struct hfs_bnode_desc {
/* HFS+ BTree header */ /* HFS+ BTree header */
struct hfs_btree_header_rec { struct hfs_btree_header_rec {
u16 depth; __be16 depth;
u32 root; __be32 root;
u32 leaf_count; __be32 leaf_count;
u32 leaf_head; __be32 leaf_head;
u32 leaf_tail; __be32 leaf_tail;
u16 node_size; __be16 node_size;
u16 max_key_len; __be16 max_key_len;
u32 node_count; __be32 node_count;
u32 free_nodes; __be32 free_nodes;
u16 reserved1; u16 reserved1;
u32 clump_size; __be32 clump_size;
u8 btree_type; u8 btree_type;
u8 reserved2; u8 reserved2;
u32 attributes; __be32 attributes;
u32 reserved3[16]; u32 reserved3[16];
} __packed; } __packed;
...@@ -186,7 +186,7 @@ struct hfs_btree_header_rec { ...@@ -186,7 +186,7 @@ struct hfs_btree_header_rec {
/* HFS+ catalog entry key */ /* HFS+ catalog entry key */
struct hfsplus_cat_key { struct hfsplus_cat_key {
u16 key_len; __be16 key_len;
hfsplus_cnid parent; hfsplus_cnid parent;
struct hfsplus_unistr name; struct hfsplus_unistr name;
} __packed; } __packed;
...@@ -194,83 +194,83 @@ struct hfsplus_cat_key { ...@@ -194,83 +194,83 @@ struct hfsplus_cat_key {
/* Structs from hfs.h */ /* Structs from hfs.h */
struct hfsp_point { struct hfsp_point {
u16 v; __be16 v;
u16 h; __be16 h;
} __packed; } __packed;
struct hfsp_rect { struct hfsp_rect {
u16 top; __be16 top;
u16 left; __be16 left;
u16 bottom; __be16 bottom;
u16 right; __be16 right;
} __packed; } __packed;
/* HFS directory info (stolen from hfs.h */ /* HFS directory info (stolen from hfs.h */
struct DInfo { struct DInfo {
struct hfsp_rect frRect; struct hfsp_rect frRect;
u16 frFlags; __be16 frFlags;
struct hfsp_point frLocation; struct hfsp_point frLocation;
u16 frView; __be16 frView;
} __packed; } __packed;
struct DXInfo { struct DXInfo {
struct hfsp_point frScroll; struct hfsp_point frScroll;
u32 frOpenChain; __be32 frOpenChain;
u16 frUnused; __be16 frUnused;
u16 frComment; __be16 frComment;
u32 frPutAway; __be32 frPutAway;
} __packed; } __packed;
/* HFS+ folder data (part of an hfsplus_cat_entry) */ /* HFS+ folder data (part of an hfsplus_cat_entry) */
struct hfsplus_cat_folder { struct hfsplus_cat_folder {
s16 type; __be16 type;
u16 flags; __be16 flags;
u32 valence; __be32 valence;
hfsplus_cnid id; hfsplus_cnid id;
u32 create_date; __be32 create_date;
u32 content_mod_date; __be32 content_mod_date;
u32 attribute_mod_date; __be32 attribute_mod_date;
u32 access_date; __be32 access_date;
u32 backup_date; __be32 backup_date;
struct hfsplus_perm permissions; struct hfsplus_perm permissions;
struct DInfo user_info; struct DInfo user_info;
struct DXInfo finder_info; struct DXInfo finder_info;
u32 text_encoding; __be32 text_encoding;
u32 reserved; u32 reserved;
} __packed; } __packed;
/* HFS file info (stolen from hfs.h) */ /* HFS file info (stolen from hfs.h) */
struct FInfo { struct FInfo {
u32 fdType; __be32 fdType;
u32 fdCreator; __be32 fdCreator;
u16 fdFlags; __be16 fdFlags;
struct hfsp_point fdLocation; struct hfsp_point fdLocation;
u16 fdFldr; __be16 fdFldr;
} __packed; } __packed;
struct FXInfo { struct FXInfo {
u16 fdIconID; __be16 fdIconID;
u8 fdUnused[8]; u8 fdUnused[8];
u16 fdComment; __be16 fdComment;
u32 fdPutAway; __be32 fdPutAway;
} __packed; } __packed;
/* HFS+ file data (part of a cat_entry) */ /* HFS+ file data (part of a cat_entry) */
struct hfsplus_cat_file { struct hfsplus_cat_file {
s16 type; __be16 type;
u16 flags; __be16 flags;
u32 reserved1; u32 reserved1;
hfsplus_cnid id; hfsplus_cnid id;
u32 create_date; __be32 create_date;
u32 content_mod_date; __be32 content_mod_date;
u32 attribute_mod_date; __be32 attribute_mod_date;
u32 access_date; __be32 access_date;
u32 backup_date; __be32 backup_date;
struct hfsplus_perm permissions; struct hfsplus_perm permissions;
struct FInfo user_info; struct FInfo user_info;
struct FXInfo finder_info; struct FXInfo finder_info;
u32 text_encoding; __be32 text_encoding;
u32 reserved2; u32 reserved2;
struct hfsplus_fork_raw data_fork; struct hfsplus_fork_raw data_fork;
...@@ -283,7 +283,7 @@ struct hfsplus_cat_file { ...@@ -283,7 +283,7 @@ struct hfsplus_cat_file {
/* HFS+ catalog thread (part of a cat_entry) */ /* HFS+ catalog thread (part of a cat_entry) */
struct hfsplus_cat_thread { struct hfsplus_cat_thread {
s16 type; __be16 type;
s16 reserved; s16 reserved;
hfsplus_cnid parentID; hfsplus_cnid parentID;
struct hfsplus_unistr nodeName; struct hfsplus_unistr nodeName;
...@@ -293,7 +293,7 @@ struct hfsplus_cat_thread { ...@@ -293,7 +293,7 @@ struct hfsplus_cat_thread {
/* A data record in the catalog tree */ /* A data record in the catalog tree */
typedef union { typedef union {
s16 type; __be16 type;
struct hfsplus_cat_folder folder; struct hfsplus_cat_folder folder;
struct hfsplus_cat_file file; struct hfsplus_cat_file file;
struct hfsplus_cat_thread thread; struct hfsplus_cat_thread thread;
...@@ -307,18 +307,18 @@ typedef union { ...@@ -307,18 +307,18 @@ typedef union {
/* HFS+ extents tree key */ /* HFS+ extents tree key */
struct hfsplus_ext_key { struct hfsplus_ext_key {
u16 key_len; __be16 key_len;
u8 fork_type; u8 fork_type;
u8 pad; u8 pad;
hfsplus_cnid cnid; hfsplus_cnid cnid;
u32 start_block; __be32 start_block;
} __packed; } __packed;
#define HFSPLUS_EXT_KEYLEN 12 #define HFSPLUS_EXT_KEYLEN 12
/* HFS+ generic BTree key */ /* HFS+ generic BTree key */
typedef union { typedef union {
u16 key_len; __be16 key_len;
struct hfsplus_cat_key cat; struct hfsplus_cat_key cat;
struct hfsplus_ext_key ext; struct hfsplus_ext_key ext;
} __packed hfsplus_btree_key; } __packed hfsplus_btree_key;
......
...@@ -35,11 +35,11 @@ ...@@ -35,11 +35,11 @@
* contiguous starting at block 1. * contiguous starting at block 1.
*/ */
struct new_pmap { struct new_pmap {
u16 pmSig; /* signature */ __be16 pmSig; /* signature */
u16 reSigPad; /* padding */ __be16 reSigPad; /* padding */
u32 pmMapBlkCnt; /* partition blocks count */ __be32 pmMapBlkCnt; /* partition blocks count */
u32 pmPyPartStart; /* physical block start of partition */ __be32 pmPyPartStart; /* physical block start of partition */
u32 pmPartBlkCnt; /* physical block count of partition */ __be32 pmPartBlkCnt; /* physical block count of partition */
u8 pmPartName[32]; /* (null terminated?) string u8 pmPartName[32]; /* (null terminated?) string
giving the name of this giving the name of this
partition */ partition */
...@@ -57,11 +57,11 @@ struct new_pmap { ...@@ -57,11 +57,11 @@ struct new_pmap {
* one of these. * one of these.
*/ */
struct old_pmap { struct old_pmap {
u16 pdSig; /* Signature bytes */ __be16 pdSig; /* Signature bytes */
struct old_pmap_entry { struct old_pmap_entry {
u32 pdStart; __be32 pdStart;
u32 pdSize; __be32 pdSize;
u32 pdFSID; __be32 pdFSID;
} pdEntry[42]; } pdEntry[42];
} __packed; } __packed;
...@@ -75,7 +75,7 @@ int hfs_part_find(struct super_block *sb, ...@@ -75,7 +75,7 @@ int hfs_part_find(struct super_block *sb,
sector_t *part_start, sector_t *part_size) sector_t *part_start, sector_t *part_size)
{ {
struct buffer_head *bh; struct buffer_head *bh;
u16 *data; __be16 *data;
int i, size, res; int i, size, res;
res = -ENOENT; res = -ENOENT;
......
...@@ -30,22 +30,22 @@ static int hfsplus_read_mdb(void *bufptr, struct hfsplus_wd *wd) ...@@ -30,22 +30,22 @@ static int hfsplus_read_mdb(void *bufptr, struct hfsplus_wd *wd)
u32 extent; u32 extent;
u16 attrib; u16 attrib;
if (be16_to_cpu(*(u16 *)(bufptr + HFSP_WRAPOFF_EMBEDSIG)) != HFSPLUS_VOLHEAD_SIG) if (be16_to_cpu(*(__be16 *)(bufptr + HFSP_WRAPOFF_EMBEDSIG)) != HFSPLUS_VOLHEAD_SIG)
return 0; return 0;
attrib = be16_to_cpu(*(u16 *)(bufptr + HFSP_WRAPOFF_ATTRIB)); attrib = be16_to_cpu(*(__be16 *)(bufptr + HFSP_WRAPOFF_ATTRIB));
if (!(attrib & HFSP_WRAP_ATTRIB_SLOCK) || if (!(attrib & HFSP_WRAP_ATTRIB_SLOCK) ||
!(attrib & HFSP_WRAP_ATTRIB_SPARED)) !(attrib & HFSP_WRAP_ATTRIB_SPARED))
return 0; return 0;
wd->ablk_size = be32_to_cpu(*(u32 *)(bufptr + HFSP_WRAPOFF_ABLKSIZE)); wd->ablk_size = be32_to_cpu(*(__be32 *)(bufptr + HFSP_WRAPOFF_ABLKSIZE));
if (wd->ablk_size < HFSPLUS_SECTOR_SIZE) if (wd->ablk_size < HFSPLUS_SECTOR_SIZE)
return 0; return 0;
if (wd->ablk_size % HFSPLUS_SECTOR_SIZE) if (wd->ablk_size % HFSPLUS_SECTOR_SIZE)
return 0; return 0;
wd->ablk_start = be16_to_cpu(*(u16 *)(bufptr + HFSP_WRAPOFF_ABLKSTART)); wd->ablk_start = be16_to_cpu(*(__be16 *)(bufptr + HFSP_WRAPOFF_ABLKSTART));
extent = be32_to_cpu(get_unaligned((u32 *)(bufptr + HFSP_WRAPOFF_EMBEDEXT))); extent = be32_to_cpu(get_unaligned((__be32 *)(bufptr + HFSP_WRAPOFF_EMBEDEXT)));
wd->embed_start = (extent >> 16) & 0xFFFF; wd->embed_start = (extent >> 16) & 0xFFFF;
wd->embed_count = extent & 0xFFFF; wd->embed_count = extent & 0xFFFF;
......
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