aboutsummaryrefslogtreecommitdiffstats
path: root/fs/befs
diff options
context:
space:
mode:
Diffstat (limited to 'fs/befs')
-rw-r--r--fs/befs/befs.h6
-rw-r--r--fs/befs/befs_fs_types.h112
-rw-r--r--fs/befs/btree.c29
-rw-r--r--fs/befs/datastream.c11
-rw-r--r--fs/befs/debug.c12
-rw-r--r--fs/befs/endian.h57
-rw-r--r--fs/befs/inode.c1
-rw-r--r--fs/befs/linuxvfs.c1
-rw-r--r--fs/befs/super.c1
9 files changed, 131 insertions, 99 deletions
diff --git a/fs/befs/befs.h b/fs/befs/befs.h
index 057a2c3d73b7..d9a40abda6b7 100644
--- a/fs/befs/befs.h
+++ b/fs/befs/befs.h
@@ -94,7 +94,7 @@ void befs_debug(const struct super_block *sb, const char *fmt, ...);
94 94
95void befs_dump_super_block(const struct super_block *sb, befs_super_block *); 95void befs_dump_super_block(const struct super_block *sb, befs_super_block *);
96void befs_dump_inode(const struct super_block *sb, befs_inode *); 96void befs_dump_inode(const struct super_block *sb, befs_inode *);
97void befs_dump_index_entry(const struct super_block *sb, befs_btree_super *); 97void befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super *);
98void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *); 98void befs_dump_index_node(const struct super_block *sb, befs_btree_nodehead *);
99/****************************/ 99/****************************/
100 100
@@ -136,7 +136,7 @@ blockno2iaddr(struct super_block *sb, befs_blocknr_t blockno)
136static inline unsigned int 136static inline unsigned int
137befs_iaddrs_per_block(struct super_block *sb) 137befs_iaddrs_per_block(struct super_block *sb)
138{ 138{
139 return BEFS_SB(sb)->block_size / sizeof (befs_inode_addr); 139 return BEFS_SB(sb)->block_size / sizeof (befs_disk_inode_addr);
140} 140}
141 141
142static inline int 142static inline int
@@ -151,4 +151,6 @@ befs_brun_size(struct super_block *sb, befs_block_run run)
151 return BEFS_SB(sb)->block_size * run.len; 151 return BEFS_SB(sb)->block_size * run.len;
152} 152}
153 153
154#include "endian.h"
155
154#endif /* _LINUX_BEFS_H */ 156#endif /* _LINUX_BEFS_H */
diff --git a/fs/befs/befs_fs_types.h b/fs/befs/befs_fs_types.h
index 63ef1e18fb84..e2595c2c403a 100644
--- a/fs/befs/befs_fs_types.h
+++ b/fs/befs/befs_fs_types.h
@@ -79,17 +79,27 @@ enum inode_flags {
79 * On-Disk datastructures of BeFS 79 * On-Disk datastructures of BeFS
80 */ 80 */
81 81
82typedef u64 __bitwise fs64;
83typedef u32 __bitwise fs32;
84typedef u16 __bitwise fs16;
85
82typedef u64 befs_off_t; 86typedef u64 befs_off_t;
83typedef u64 befs_time_t; 87typedef fs64 befs_time_t;
84typedef void befs_binode_etc;
85 88
86/* Block runs */ 89/* Block runs */
87typedef struct { 90typedef struct {
91 fs32 allocation_group;
92 fs16 start;
93 fs16 len;
94} PACKED befs_disk_block_run;
95
96typedef struct {
88 u32 allocation_group; 97 u32 allocation_group;
89 u16 start; 98 u16 start;
90 u16 len; 99 u16 len;
91} PACKED befs_block_run; 100} PACKED befs_block_run;
92 101
102typedef befs_disk_block_run befs_disk_inode_addr;
93typedef befs_block_run befs_inode_addr; 103typedef befs_block_run befs_inode_addr;
94 104
95/* 105/*
@@ -97,31 +107,31 @@ typedef befs_block_run befs_inode_addr;
97 */ 107 */
98typedef struct { 108typedef struct {
99 char name[B_OS_NAME_LENGTH]; 109 char name[B_OS_NAME_LENGTH];
100 u32 magic1; 110 fs32 magic1;
101 u32 fs_byte_order; 111 fs32 fs_byte_order;
102 112
103 u32 block_size; 113 fs32 block_size;
104 u32 block_shift; 114 fs32 block_shift;
105 115
106 befs_off_t num_blocks; 116 fs64 num_blocks;
107 befs_off_t used_blocks; 117 fs64 used_blocks;
108 118
109 u32 inode_size; 119 fs32 inode_size;
110 120
111 u32 magic2; 121 fs32 magic2;
112 u32 blocks_per_ag; 122 fs32 blocks_per_ag;
113 u32 ag_shift; 123 fs32 ag_shift;
114 u32 num_ags; 124 fs32 num_ags;
115 125
116 u32 flags; 126 fs32 flags;
117 127
118 befs_block_run log_blocks; 128 befs_disk_block_run log_blocks;
119 befs_off_t log_start; 129 fs64 log_start;
120 befs_off_t log_end; 130 fs64 log_end;
121 131
122 u32 magic3; 132 fs32 magic3;
123 befs_inode_addr root_dir; 133 befs_disk_inode_addr root_dir;
124 befs_inode_addr indices; 134 befs_disk_inode_addr indices;
125 135
126} PACKED befs_super_block; 136} PACKED befs_super_block;
127 137
@@ -130,6 +140,16 @@ typedef struct {
130 * be longer than one block! 140 * be longer than one block!
131 */ 141 */
132typedef struct { 142typedef struct {
143 befs_disk_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
144 fs64 max_direct_range;
145 befs_disk_block_run indirect;
146 fs64 max_indirect_range;
147 befs_disk_block_run double_indirect;
148 fs64 max_double_indirect_range;
149 fs64 size;
150} PACKED befs_disk_data_stream;
151
152typedef struct {
133 befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS]; 153 befs_block_run direct[BEFS_NUM_DIRECT_BLOCKS];
134 befs_off_t max_direct_range; 154 befs_off_t max_direct_range;
135 befs_block_run indirect; 155 befs_block_run indirect;
@@ -141,35 +161,35 @@ typedef struct {
141 161
142/* Attribute */ 162/* Attribute */
143typedef struct { 163typedef struct {
144 u32 type; 164 fs32 type;
145 u16 name_size; 165 fs16 name_size;
146 u16 data_size; 166 fs16 data_size;
147 char name[1]; 167 char name[1];
148} PACKED befs_small_data; 168} PACKED befs_small_data;
149 169
150/* Inode structure */ 170/* Inode structure */
151typedef struct { 171typedef struct {
152 u32 magic1; 172 fs32 magic1;
153 befs_inode_addr inode_num; 173 befs_disk_inode_addr inode_num;
154 u32 uid; 174 fs32 uid;
155 u32 gid; 175 fs32 gid;
156 u32 mode; 176 fs32 mode;
157 u32 flags; 177 fs32 flags;
158 befs_time_t create_time; 178 befs_time_t create_time;
159 befs_time_t last_modified_time; 179 befs_time_t last_modified_time;
160 befs_inode_addr parent; 180 befs_disk_inode_addr parent;
161 befs_inode_addr attributes; 181 befs_disk_inode_addr attributes;
162 u32 type; 182 fs32 type;
163 183
164 u32 inode_size; 184 fs32 inode_size;
165 u32 etc; /* not use */ 185 fs32 etc; /* not use */
166 186
167 union { 187 union {
168 befs_data_stream datastream; 188 befs_disk_data_stream datastream;
169 char symlink[BEFS_SYMLINK_LEN]; 189 char symlink[BEFS_SYMLINK_LEN];
170 } data; 190 } data;
171 191
172 u32 pad[4]; /* not use */ 192 fs32 pad[4]; /* not use */
173 befs_small_data small_data[1]; 193 befs_small_data small_data[1];
174} PACKED befs_inode; 194} PACKED befs_inode;
175 195
@@ -190,6 +210,16 @@ enum btree_types {
190}; 210};
191 211
192typedef struct { 212typedef struct {
213 fs32 magic;
214 fs32 node_size;
215 fs32 max_depth;
216 fs32 data_type;
217 fs64 root_node_ptr;
218 fs64 free_node_ptr;
219 fs64 max_size;
220} PACKED befs_disk_btree_super;
221
222typedef struct {
193 u32 magic; 223 u32 magic;
194 u32 node_size; 224 u32 node_size;
195 u32 max_depth; 225 u32 max_depth;
@@ -203,11 +233,19 @@ typedef struct {
203 * Header stucture of each btree node 233 * Header stucture of each btree node
204 */ 234 */
205typedef struct { 235typedef struct {
236 fs64 left;
237 fs64 right;
238 fs64 overflow;
239 fs16 all_key_count;
240 fs16 all_key_length;
241} PACKED befs_btree_nodehead;
242
243typedef struct {
206 befs_off_t left; 244 befs_off_t left;
207 befs_off_t right; 245 befs_off_t right;
208 befs_off_t overflow; 246 befs_off_t overflow;
209 u16 all_key_count; 247 u16 all_key_count;
210 u16 all_key_length; 248 u16 all_key_length;
211} PACKED befs_btree_nodehead; 249} PACKED befs_host_btree_nodehead;
212 250
213#endif /* _LINUX_BEFS_FS_TYPES */ 251#endif /* _LINUX_BEFS_FS_TYPES */
diff --git a/fs/befs/btree.c b/fs/befs/btree.c
index 76e219799409..81b042ee24e6 100644
--- a/fs/befs/btree.c
+++ b/fs/befs/btree.c
@@ -30,7 +30,6 @@
30#include "befs.h" 30#include "befs.h"
31#include "btree.h" 31#include "btree.h"
32#include "datastream.h" 32#include "datastream.h"
33#include "endian.h"
34 33
35/* 34/*
36 * The btree functions in this file are built on top of the 35 * The btree functions in this file are built on top of the
@@ -80,7 +79,7 @@
80 * In memory structure of each btree node 79 * In memory structure of each btree node
81 */ 80 */
82typedef struct { 81typedef struct {
83 befs_btree_nodehead head; /* head of node converted to cpu byteorder */ 82 befs_host_btree_nodehead head; /* head of node converted to cpu byteorder */
84 struct buffer_head *bh; 83 struct buffer_head *bh;
85 befs_btree_nodehead *od_node; /* on disk node */ 84 befs_btree_nodehead *od_node; /* on disk node */
86} befs_btree_node; 85} befs_btree_node;
@@ -102,9 +101,9 @@ static int befs_bt_read_node(struct super_block *sb, befs_data_stream * ds,
102 101
103static int befs_leafnode(befs_btree_node * node); 102static int befs_leafnode(befs_btree_node * node);
104 103
105static u16 *befs_bt_keylen_index(befs_btree_node * node); 104static fs16 *befs_bt_keylen_index(befs_btree_node * node);
106 105
107static befs_off_t *befs_bt_valarray(befs_btree_node * node); 106static fs64 *befs_bt_valarray(befs_btree_node * node);
108 107
109static char *befs_bt_keydata(befs_btree_node * node); 108static char *befs_bt_keydata(befs_btree_node * node);
110 109
@@ -136,7 +135,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
136 befs_btree_super * sup) 135 befs_btree_super * sup)
137{ 136{
138 struct buffer_head *bh = NULL; 137 struct buffer_head *bh = NULL;
139 befs_btree_super *od_sup = NULL; 138 befs_disk_btree_super *od_sup = NULL;
140 139
141 befs_debug(sb, "---> befs_btree_read_super()"); 140 befs_debug(sb, "---> befs_btree_read_super()");
142 141
@@ -146,7 +145,7 @@ befs_bt_read_super(struct super_block *sb, befs_data_stream * ds,
146 befs_error(sb, "Couldn't read index header."); 145 befs_error(sb, "Couldn't read index header.");
147 goto error; 146 goto error;
148 } 147 }
149 od_sup = (befs_btree_super *) bh->b_data; 148 od_sup = (befs_disk_btree_super *) bh->b_data;
150 befs_dump_index_entry(sb, od_sup); 149 befs_dump_index_entry(sb, od_sup);
151 150
152 sup->magic = fs32_to_cpu(sb, od_sup->magic); 151 sup->magic = fs32_to_cpu(sb, od_sup->magic);
@@ -342,7 +341,7 @@ befs_find_key(struct super_block *sb, befs_btree_node * node,
342 u16 keylen; 341 u16 keylen;
343 int findkey_len; 342 int findkey_len;
344 char *thiskey; 343 char *thiskey;
345 befs_off_t *valarray; 344 fs64 *valarray;
346 345
347 befs_debug(sb, "---> befs_find_key() %s", findkey); 346 befs_debug(sb, "---> befs_find_key() %s", findkey);
348 347
@@ -422,7 +421,7 @@ befs_btree_read(struct super_block *sb, befs_data_stream * ds,
422 befs_btree_super bt_super; 421 befs_btree_super bt_super;
423 befs_off_t node_off = 0; 422 befs_off_t node_off = 0;
424 int cur_key; 423 int cur_key;
425 befs_off_t *valarray; 424 fs64 *valarray;
426 char *keystart; 425 char *keystart;
427 u16 keylen; 426 u16 keylen;
428 int res; 427 int res;
@@ -572,7 +571,7 @@ befs_btree_seekleaf(struct super_block *sb, befs_data_stream * ds,
572 this_node->head.overflow); 571 this_node->head.overflow);
573 *node_off = this_node->head.overflow; 572 *node_off = this_node->head.overflow;
574 } else { 573 } else {
575 befs_off_t *valarray = befs_bt_valarray(this_node); 574 fs64 *valarray = befs_bt_valarray(this_node);
576 *node_off = fs64_to_cpu(sb, valarray[0]); 575 *node_off = fs64_to_cpu(sb, valarray[0]);
577 } 576 }
578 if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) { 577 if (befs_bt_read_node(sb, ds, this_node, *node_off) != BEFS_OK) {
@@ -622,7 +621,7 @@ befs_leafnode(befs_btree_node * node)
622 * 621 *
623 * Except that rounding up to 8 works, and rounding up to 4 doesn't. 622 * Except that rounding up to 8 works, and rounding up to 4 doesn't.
624 */ 623 */
625static u16 * 624static fs16 *
626befs_bt_keylen_index(befs_btree_node * node) 625befs_bt_keylen_index(befs_btree_node * node)
627{ 626{
628 const int keylen_align = 8; 627 const int keylen_align = 8;
@@ -633,7 +632,7 @@ befs_bt_keylen_index(befs_btree_node * node)
633 if (tmp) 632 if (tmp)
634 off += keylen_align - tmp; 633 off += keylen_align - tmp;
635 634
636 return (u16 *) ((void *) node->od_node + off); 635 return (fs16 *) ((void *) node->od_node + off);
637} 636}
638 637
639/** 638/**
@@ -643,13 +642,13 @@ befs_bt_keylen_index(befs_btree_node * node)
643 * Returns a pointer to the start of the value array 642 * Returns a pointer to the start of the value array
644 * of the node pointed to by the node header 643 * of the node pointed to by the node header
645 */ 644 */
646static befs_off_t * 645static fs64 *
647befs_bt_valarray(befs_btree_node * node) 646befs_bt_valarray(befs_btree_node * node)
648{ 647{
649 void *keylen_index_start = (void *) befs_bt_keylen_index(node); 648 void *keylen_index_start = (void *) befs_bt_keylen_index(node);
650 size_t keylen_index_size = node->head.all_key_count * sizeof (u16); 649 size_t keylen_index_size = node->head.all_key_count * sizeof (fs16);
651 650
652 return (befs_off_t *) (keylen_index_start + keylen_index_size); 651 return (fs64 *) (keylen_index_start + keylen_index_size);
653} 652}
654 653
655/** 654/**
@@ -681,7 +680,7 @@ befs_bt_get_key(struct super_block *sb, befs_btree_node * node,
681{ 680{
682 int prev_key_end; 681 int prev_key_end;
683 char *keystart; 682 char *keystart;
684 u16 *keylen_index; 683 fs16 *keylen_index;
685 684
686 if (index < 0 || index > node->head.all_key_count) { 685 if (index < 0 || index > node->head.all_key_count) {
687 *keylen = 0; 686 *keylen = 0;
diff --git a/fs/befs/datastream.c b/fs/befs/datastream.c
index b7d6b920f65f..aacb4da6298a 100644
--- a/fs/befs/datastream.c
+++ b/fs/befs/datastream.c
@@ -18,7 +18,6 @@
18#include "befs.h" 18#include "befs.h"
19#include "datastream.h" 19#include "datastream.h"
20#include "io.h" 20#include "io.h"
21#include "endian.h"
22 21
23const befs_inode_addr BAD_IADDR = { 0, 0, 0 }; 22const befs_inode_addr BAD_IADDR = { 0, 0, 0 };
24 23
@@ -312,7 +311,7 @@ befs_find_brun_indirect(struct super_block *sb,
312 befs_blocknr_t indir_start_blk; 311 befs_blocknr_t indir_start_blk;
313 befs_blocknr_t search_blk; 312 befs_blocknr_t search_blk;
314 struct buffer_head *indirblock; 313 struct buffer_head *indirblock;
315 befs_block_run *array; 314 befs_disk_block_run *array;
316 315
317 befs_block_run indirect = data->indirect; 316 befs_block_run indirect = data->indirect;
318 befs_blocknr_t indirblockno = iaddr2blockno(sb, &indirect); 317 befs_blocknr_t indirblockno = iaddr2blockno(sb, &indirect);
@@ -334,7 +333,7 @@ befs_find_brun_indirect(struct super_block *sb,
334 return BEFS_ERR; 333 return BEFS_ERR;
335 } 334 }
336 335
337 array = (befs_block_run *) indirblock->b_data; 336 array = (befs_disk_block_run *) indirblock->b_data;
338 337
339 for (j = 0; j < arraylen; ++j) { 338 for (j = 0; j < arraylen; ++j) {
340 int len = fs16_to_cpu(sb, array[j].len); 339 int len = fs16_to_cpu(sb, array[j].len);
@@ -427,7 +426,7 @@ befs_find_brun_dblindirect(struct super_block *sb,
427 struct buffer_head *dbl_indir_block; 426 struct buffer_head *dbl_indir_block;
428 struct buffer_head *indir_block; 427 struct buffer_head *indir_block;
429 befs_block_run indir_run; 428 befs_block_run indir_run;
430 befs_inode_addr *iaddr_array = NULL; 429 befs_disk_inode_addr *iaddr_array = NULL;
431 befs_sb_info *befs_sb = BEFS_SB(sb); 430 befs_sb_info *befs_sb = BEFS_SB(sb);
432 431
433 befs_blocknr_t indir_start_blk = 432 befs_blocknr_t indir_start_blk =
@@ -482,7 +481,7 @@ befs_find_brun_dblindirect(struct super_block *sb,
482 481
483 dbl_block_indx = 482 dbl_block_indx =
484 dblindir_indx - (dbl_which_block * befs_iaddrs_per_block(sb)); 483 dblindir_indx - (dbl_which_block * befs_iaddrs_per_block(sb));
485 iaddr_array = (befs_inode_addr *) dbl_indir_block->b_data; 484 iaddr_array = (befs_disk_inode_addr *) dbl_indir_block->b_data;
486 indir_run = fsrun_to_cpu(sb, iaddr_array[dbl_block_indx]); 485 indir_run = fsrun_to_cpu(sb, iaddr_array[dbl_block_indx]);
487 brelse(dbl_indir_block); 486 brelse(dbl_indir_block);
488 iaddr_array = NULL; 487 iaddr_array = NULL;
@@ -507,7 +506,7 @@ befs_find_brun_dblindirect(struct super_block *sb,
507 } 506 }
508 507
509 block_indx = indir_indx - (which_block * befs_iaddrs_per_block(sb)); 508 block_indx = indir_indx - (which_block * befs_iaddrs_per_block(sb));
510 iaddr_array = (befs_inode_addr *) indir_block->b_data; 509 iaddr_array = (befs_disk_inode_addr *) indir_block->b_data;
511 *run = fsrun_to_cpu(sb, iaddr_array[block_indx]); 510 *run = fsrun_to_cpu(sb, iaddr_array[block_indx]);
512 brelse(indir_block); 511 brelse(indir_block);
513 iaddr_array = NULL; 512 iaddr_array = NULL;
diff --git a/fs/befs/debug.c b/fs/befs/debug.c
index 875cc0aa318c..e831a8f30849 100644
--- a/fs/befs/debug.c
+++ b/fs/befs/debug.c
@@ -21,7 +21,6 @@
21#endif /* __KERNEL__ */ 21#endif /* __KERNEL__ */
22 22
23#include "befs.h" 23#include "befs.h"
24#include "endian.h"
25 24
26#define ERRBUFSIZE 1024 25#define ERRBUFSIZE 1024
27 26
@@ -125,7 +124,7 @@ befs_dump_inode(const struct super_block *sb, befs_inode * inode)
125 befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type)); 124 befs_debug(sb, " type %08x", fs32_to_cpu(sb, inode->type));
126 befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size)); 125 befs_debug(sb, " inode_size %u", fs32_to_cpu(sb, inode->inode_size));
127 126
128 if (S_ISLNK(inode->mode)) { 127 if (S_ISLNK(fs32_to_cpu(sb, inode->mode))) {
129 befs_debug(sb, " Symbolic link [%s]", inode->data.symlink); 128 befs_debug(sb, " Symbolic link [%s]", inode->data.symlink);
130 } else { 129 } else {
131 int i; 130 int i;
@@ -231,21 +230,20 @@ befs_dump_small_data(const struct super_block *sb, befs_small_data * sd)
231 230
232/* unused */ 231/* unused */
233void 232void
234befs_dump_run(const struct super_block *sb, befs_block_run run) 233befs_dump_run(const struct super_block *sb, befs_disk_block_run run)
235{ 234{
236#ifdef CONFIG_BEFS_DEBUG 235#ifdef CONFIG_BEFS_DEBUG
237 236
238 run = fsrun_to_cpu(sb, run); 237 befs_block_run n = fsrun_to_cpu(sb, run);
239 238
240 befs_debug(sb, "[%u, %hu, %hu]", 239 befs_debug(sb, "[%u, %hu, %hu]", n.allocation_group, n.start, n.len);
241 run.allocation_group, run.start, run.len);
242 240
243#endif //CONFIG_BEFS_DEBUG 241#endif //CONFIG_BEFS_DEBUG
244} 242}
245#endif /* 0 */ 243#endif /* 0 */
246 244
247void 245void
248befs_dump_index_entry(const struct super_block *sb, befs_btree_super * super) 246befs_dump_index_entry(const struct super_block *sb, befs_disk_btree_super * super)
249{ 247{
250#ifdef CONFIG_BEFS_DEBUG 248#ifdef CONFIG_BEFS_DEBUG
251 249
diff --git a/fs/befs/endian.h b/fs/befs/endian.h
index 9ecaea4e3325..e254a20869f4 100644
--- a/fs/befs/endian.h
+++ b/fs/befs/endian.h
@@ -10,85 +10,84 @@
10#define LINUX_BEFS_ENDIAN 10#define LINUX_BEFS_ENDIAN
11 11
12#include <linux/byteorder/generic.h> 12#include <linux/byteorder/generic.h>
13#include "befs.h"
14 13
15static inline u64 14static inline u64
16fs64_to_cpu(const struct super_block *sb, u64 n) 15fs64_to_cpu(const struct super_block *sb, fs64 n)
17{ 16{
18 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 17 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
19 return le64_to_cpu(n); 18 return le64_to_cpu((__force __le64)n);
20 else 19 else
21 return be64_to_cpu(n); 20 return be64_to_cpu((__force __be64)n);
22} 21}
23 22
24static inline u64 23static inline fs64
25cpu_to_fs64(const struct super_block *sb, u64 n) 24cpu_to_fs64(const struct super_block *sb, u64 n)
26{ 25{
27 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 26 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
28 return cpu_to_le64(n); 27 return (__force fs64)cpu_to_le64(n);
29 else 28 else
30 return cpu_to_be64(n); 29 return (__force fs64)cpu_to_be64(n);
31} 30}
32 31
33static inline u32 32static inline u32
34fs32_to_cpu(const struct super_block *sb, u32 n) 33fs32_to_cpu(const struct super_block *sb, fs32 n)
35{ 34{
36 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 35 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
37 return le32_to_cpu(n); 36 return le32_to_cpu((__force __le32)n);
38 else 37 else
39 return be32_to_cpu(n); 38 return be32_to_cpu((__force __be32)n);
40} 39}
41 40
42static inline u32 41static inline fs32
43cpu_to_fs32(const struct super_block *sb, u32 n) 42cpu_to_fs32(const struct super_block *sb, u32 n)
44{ 43{
45 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 44 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
46 return cpu_to_le32(n); 45 return (__force fs32)cpu_to_le32(n);
47 else 46 else
48 return cpu_to_be32(n); 47 return (__force fs32)cpu_to_be32(n);
49} 48}
50 49
51static inline u16 50static inline u16
52fs16_to_cpu(const struct super_block *sb, u16 n) 51fs16_to_cpu(const struct super_block *sb, fs16 n)
53{ 52{
54 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 53 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
55 return le16_to_cpu(n); 54 return le16_to_cpu((__force __le16)n);
56 else 55 else
57 return be16_to_cpu(n); 56 return be16_to_cpu((__force __be16)n);
58} 57}
59 58
60static inline u16 59static inline fs16
61cpu_to_fs16(const struct super_block *sb, u16 n) 60cpu_to_fs16(const struct super_block *sb, u16 n)
62{ 61{
63 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) 62 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE)
64 return cpu_to_le16(n); 63 return (__force fs16)cpu_to_le16(n);
65 else 64 else
66 return cpu_to_be16(n); 65 return (__force fs16)cpu_to_be16(n);
67} 66}
68 67
69/* Composite types below here */ 68/* Composite types below here */
70 69
71static inline befs_block_run 70static inline befs_block_run
72fsrun_to_cpu(const struct super_block *sb, befs_block_run n) 71fsrun_to_cpu(const struct super_block *sb, befs_disk_block_run n)
73{ 72{
74 befs_block_run run; 73 befs_block_run run;
75 74
76 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { 75 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) {
77 run.allocation_group = le32_to_cpu(n.allocation_group); 76 run.allocation_group = le32_to_cpu((__force __le32)n.allocation_group);
78 run.start = le16_to_cpu(n.start); 77 run.start = le16_to_cpu((__force __le16)n.start);
79 run.len = le16_to_cpu(n.len); 78 run.len = le16_to_cpu((__force __le16)n.len);
80 } else { 79 } else {
81 run.allocation_group = be32_to_cpu(n.allocation_group); 80 run.allocation_group = be32_to_cpu((__force __be32)n.allocation_group);
82 run.start = be16_to_cpu(n.start); 81 run.start = be16_to_cpu((__force __be16)n.start);
83 run.len = be16_to_cpu(n.len); 82 run.len = be16_to_cpu((__force __be16)n.len);
84 } 83 }
85 return run; 84 return run;
86} 85}
87 86
88static inline befs_block_run 87static inline befs_disk_block_run
89cpu_to_fsrun(const struct super_block *sb, befs_block_run n) 88cpu_to_fsrun(const struct super_block *sb, befs_block_run n)
90{ 89{
91 befs_block_run run; 90 befs_disk_block_run run;
92 91
93 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) { 92 if (BEFS_SB(sb)->byte_order == BEFS_BYTESEX_LE) {
94 run.allocation_group = cpu_to_le32(n.allocation_group); 93 run.allocation_group = cpu_to_le32(n.allocation_group);
@@ -103,7 +102,7 @@ cpu_to_fsrun(const struct super_block *sb, befs_block_run n)
103} 102}
104 103
105static inline befs_data_stream 104static inline befs_data_stream
106fsds_to_cpu(const struct super_block *sb, befs_data_stream n) 105fsds_to_cpu(const struct super_block *sb, befs_disk_data_stream n)
107{ 106{
108 befs_data_stream data; 107 befs_data_stream data;
109 int i; 108 int i;
diff --git a/fs/befs/inode.c b/fs/befs/inode.c
index d41c9247ae8a..94c17f9a9576 100644
--- a/fs/befs/inode.c
+++ b/fs/befs/inode.c
@@ -8,7 +8,6 @@
8 8
9#include "befs.h" 9#include "befs.h"
10#include "inode.h" 10#include "inode.h"
11#include "endian.h"
12 11
13/* 12/*
14 Validates the correctness of the befs inode 13 Validates the correctness of the befs inode
diff --git a/fs/befs/linuxvfs.c b/fs/befs/linuxvfs.c
index 57020c7a7e65..07f7144f0e2e 100644
--- a/fs/befs/linuxvfs.c
+++ b/fs/befs/linuxvfs.c
@@ -22,7 +22,6 @@
22#include "datastream.h" 22#include "datastream.h"
23#include "super.h" 23#include "super.h"
24#include "io.h" 24#include "io.h"
25#include "endian.h"
26 25
27MODULE_DESCRIPTION("BeOS File System (BeFS) driver"); 26MODULE_DESCRIPTION("BeOS File System (BeFS) driver");
28MODULE_AUTHOR("Will Dyson"); 27MODULE_AUTHOR("Will Dyson");
diff --git a/fs/befs/super.c b/fs/befs/super.c
index 4557acbac528..8c3401ff6d6a 100644
--- a/fs/befs/super.c
+++ b/fs/befs/super.c
@@ -11,7 +11,6 @@
11 11
12#include "befs.h" 12#include "befs.h"
13#include "super.h" 13#include "super.h"
14#include "endian.h"
15 14
16/** 15/**
17 * load_befs_sb -- Read from disk and properly byteswap all the fields 16 * load_befs_sb -- Read from disk and properly byteswap all the fields