Commit 3e8962be authored by Al Viro's avatar Al Viro Committed by Linus Torvalds

[PATCH] reiserfs endianness: annotate little-endian objects

little-endian objects annotated as such; again, obviously no changes of
resulting code, we only replace __u16 with __le16, etc.  in relevant places.
Signed-off-by: default avatarAl Viro <viro@parcelfarce.linux.theplanet.co.uk>
Cc: <reiserfs-dev@namesys.com>
Signed-off-by: default avatarAndrew Morton <akpm@osdl.org>
Signed-off-by: default avatarLinus Torvalds <torvalds@osdl.org>
parent 6a3a16f2
...@@ -260,8 +260,9 @@ static inline int block_group_used(struct super_block *s, u32 id) { ...@@ -260,8 +260,9 @@ static inline int block_group_used(struct super_block *s, u32 id) {
/* /*
* the packing is returned in disk byte order * the packing is returned in disk byte order
*/ */
u32 reiserfs_choose_packing(struct inode *dir) { __le32 reiserfs_choose_packing(struct inode *dir)
u32 packing; {
__le32 packing;
if (TEST_OPTION(packing_groups, dir->i_sb)) { if (TEST_OPTION(packing_groups, dir->i_sb)) {
u32 parent_dir = le32_to_cpu(INODE_PKEY(dir)->k_dir_id); u32 parent_dir = le32_to_cpu(INODE_PKEY(dir)->k_dir_id);
/* /*
...@@ -655,7 +656,7 @@ static int get_left_neighbor(reiserfs_blocknr_hint_t *hint) ...@@ -655,7 +656,7 @@ static int get_left_neighbor(reiserfs_blocknr_hint_t *hint)
struct buffer_head * bh; struct buffer_head * bh;
struct item_head * ih; struct item_head * ih;
int pos_in_item; int pos_in_item;
__u32 * item; __le32 * item;
int ret = 0; int ret = 0;
if (!hint->path) /* reiserfs code can call this function w/o pointer to path if (!hint->path) /* reiserfs code can call this function w/o pointer to path
......
...@@ -209,8 +209,8 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi ...@@ -209,8 +209,8 @@ static int reiserfs_readdir (struct file * filp, void * dirent, filldir_t filldi
/* compose directory item containing "." and ".." entries (entries are /* compose directory item containing "." and ".." entries (entries are
not aligned to 4 byte boundary) */ not aligned to 4 byte boundary) */
/* the last four params are LE */ /* the last four params are LE */
void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid, void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid,
__u32 par_dirid, __u32 par_objid) __le32 par_dirid, __le32 par_objid)
{ {
struct reiserfs_de_head * deh; struct reiserfs_de_head * deh;
...@@ -242,8 +242,8 @@ void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid, ...@@ -242,8 +242,8 @@ void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid,
} }
/* compose directory item containing "." and ".." entries */ /* compose directory item containing "." and ".." entries */
void make_empty_dir_item (char * body, __u32 dirid, __u32 objid, void make_empty_dir_item (char * body, __le32 dirid, __le32 objid,
__u32 par_dirid, __u32 par_objid) __le32 par_dirid, __le32 par_objid)
{ {
struct reiserfs_de_head * deh; struct reiserfs_de_head * deh;
......
...@@ -166,7 +166,7 @@ static int reiserfs_allocate_blocks_for_region( ...@@ -166,7 +166,7 @@ static int reiserfs_allocate_blocks_for_region(
struct cpu_key key; // cpu key of item that we are going to deal with struct cpu_key key; // cpu key of item that we are going to deal with
struct item_head *ih; // pointer to item head that we are going to deal with struct item_head *ih; // pointer to item head that we are going to deal with
struct buffer_head *bh; // Buffer head that contains items that we are going to deal with struct buffer_head *bh; // Buffer head that contains items that we are going to deal with
__u32 * item; // pointer to item we are going to deal with __le32 * item; // pointer to item we are going to deal with
INITIALIZE_PATH(path); // path to item, that we are going to deal with. INITIALIZE_PATH(path); // path to item, that we are going to deal with.
b_blocknr_t *allocated_blocks; // Pointer to a place where allocated blocknumbers would be stored. b_blocknr_t *allocated_blocks; // Pointer to a place where allocated blocknumbers would be stored.
reiserfs_blocknr_hint_t hint; // hint structure for block allocator. reiserfs_blocknr_hint_t hint; // hint structure for block allocator.
...@@ -891,7 +891,7 @@ static int reiserfs_prepare_file_region_for_write( ...@@ -891,7 +891,7 @@ static int reiserfs_prepare_file_region_for_write(
struct item_head *ih = NULL; // pointer to item head that we are going to deal with struct item_head *ih = NULL; // pointer to item head that we are going to deal with
struct buffer_head *itembuf=NULL; // Buffer head that contains items that we are going to deal with struct buffer_head *itembuf=NULL; // Buffer head that contains items that we are going to deal with
INITIALIZE_PATH(path); // path to item, that we are going to deal with. INITIALIZE_PATH(path); // path to item, that we are going to deal with.
__u32 * item=NULL; // pointer to item we are going to deal with __le32 * item=NULL; // pointer to item we are going to deal with
int item_pos=-1; /* Position in indirect item */ int item_pos=-1; /* Position in indirect item */
......
...@@ -173,7 +173,7 @@ static inline void fix_tail_page_for_writing(struct page *page) { ...@@ -173,7 +173,7 @@ static inline void fix_tail_page_for_writing(struct page *page) {
done already or non-hole position has been found in the indirect item */ done already or non-hole position has been found in the indirect item */
static inline int allocation_needed (int retval, b_blocknr_t allocated, static inline int allocation_needed (int retval, b_blocknr_t allocated,
struct item_head * ih, struct item_head * ih,
__u32 * item, int pos_in_item) __le32 * item, int pos_in_item)
{ {
if (allocated) if (allocated)
return 0; return 0;
...@@ -278,7 +278,7 @@ static int _get_block_create_0 (struct inode * inode, long block, ...@@ -278,7 +278,7 @@ static int _get_block_create_0 (struct inode * inode, long block,
bh = get_last_bh (&path); bh = get_last_bh (&path);
ih = get_ih (&path); ih = get_ih (&path);
if (is_indirect_le_ih (ih)) { if (is_indirect_le_ih (ih)) {
__u32 * ind_item = (__u32 *)B_I_PITEM (bh, ih); __le32 * ind_item = (__le32 *)B_I_PITEM (bh, ih);
/* FIXME: here we could cache indirect item or part of it in /* FIXME: here we could cache indirect item or part of it in
the inode to avoid search_by_key in case of subsequent the inode to avoid search_by_key in case of subsequent
...@@ -581,7 +581,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, ...@@ -581,7 +581,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
struct cpu_key key; struct cpu_key key;
struct buffer_head * bh, * unbh = NULL; struct buffer_head * bh, * unbh = NULL;
struct item_head * ih, tmp_ih; struct item_head * ih, tmp_ih;
__u32 * item; __le32 * item;
int done; int done;
int fs_gen; int fs_gen;
struct reiserfs_transaction_handle *th = NULL; struct reiserfs_transaction_handle *th = NULL;
...@@ -746,7 +746,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block, ...@@ -746,7 +746,7 @@ int reiserfs_get_block (struct inode * inode, sector_t block,
done = 0; done = 0;
do { do {
if (is_statdata_le_ih (ih)) { if (is_statdata_le_ih (ih)) {
__u32 unp = 0; __le32 unp = 0;
struct cpu_key tmp_key; struct cpu_key tmp_key;
/* indirect item has to be inserted */ /* indirect item has to be inserted */
...@@ -2067,7 +2067,7 @@ static int map_block_for_writepage(struct inode *inode, ...@@ -2067,7 +2067,7 @@ static int map_block_for_writepage(struct inode *inode,
struct item_head tmp_ih ; struct item_head tmp_ih ;
struct item_head *ih ; struct item_head *ih ;
struct buffer_head *bh ; struct buffer_head *bh ;
__u32 *item ; __le32 *item ;
struct cpu_key key ; struct cpu_key key ;
INITIALIZE_PATH(path) ; INITIALIZE_PATH(path) ;
int pos_in_item ; int pos_in_item ;
......
...@@ -296,10 +296,11 @@ static void print_sequence (__u32 start, int len) ...@@ -296,10 +296,11 @@ static void print_sequence (__u32 start, int len)
static void indirect_print_item (struct item_head * ih, char * item) static void indirect_print_item (struct item_head * ih, char * item)
{ {
int j; int j;
__u32 * unp, prev = INT_MAX; __le32 * unp;
__u32 prev = INT_MAX;
int num; int num;
unp = (__u32 *)item; unp = (__le32 *)item;
if (ih_item_len(ih) % UNFM_P_SIZE) if (ih_item_len(ih) % UNFM_P_SIZE)
reiserfs_warning (NULL, "indirect_print_item: invalid item len"); reiserfs_warning (NULL, "indirect_print_item: invalid item len");
......
...@@ -11,13 +11,13 @@ ...@@ -11,13 +11,13 @@
// find where objectid map starts // find where objectid map starts
#define objectid_map(s,rs) (old_format_only (s) ? \ #define objectid_map(s,rs) (old_format_only (s) ? \
(__u32 *)((struct reiserfs_super_block_v1 *)(rs) + 1) :\ (__le32 *)((struct reiserfs_super_block_v1 *)(rs) + 1) :\
(__u32 *)((rs) + 1)) (__le32 *)((rs) + 1))
#ifdef CONFIG_REISERFS_CHECK #ifdef CONFIG_REISERFS_CHECK
static void check_objectid_map (struct super_block * s, __u32 * map) static void check_objectid_map (struct super_block * s, __le32 * map)
{ {
if (le32_to_cpu (map[0]) != 1) if (le32_to_cpu (map[0]) != 1)
reiserfs_panic (s, "vs-15010: check_objectid_map: map corrupted: %lx", reiserfs_panic (s, "vs-15010: check_objectid_map: map corrupted: %lx",
...@@ -27,7 +27,7 @@ static void check_objectid_map (struct super_block * s, __u32 * map) ...@@ -27,7 +27,7 @@ static void check_objectid_map (struct super_block * s, __u32 * map)
} }
#else #else
static void check_objectid_map (struct super_block * s, __u32 * map) static void check_objectid_map (struct super_block * s, __le32 * map)
{;} {;}
#endif #endif
...@@ -52,7 +52,7 @@ __u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th) ...@@ -52,7 +52,7 @@ __u32 reiserfs_get_unused_objectid (struct reiserfs_transaction_handle *th)
{ {
struct super_block * s = th->t_super; struct super_block * s = th->t_super;
struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
__u32 * map = objectid_map (s, rs); __le32 * map = objectid_map (s, rs);
__u32 unused_objectid; __u32 unused_objectid;
BUG_ON (!th->t_trans_id); BUG_ON (!th->t_trans_id);
...@@ -97,7 +97,7 @@ void reiserfs_release_objectid (struct reiserfs_transaction_handle *th, ...@@ -97,7 +97,7 @@ void reiserfs_release_objectid (struct reiserfs_transaction_handle *th,
{ {
struct super_block * s = th->t_super; struct super_block * s = th->t_super;
struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s); struct reiserfs_super_block * rs = SB_DISK_SUPER_BLOCK (s);
__u32 * map = objectid_map (s, rs); __le32 * map = objectid_map (s, rs);
int i = 0; int i = 0;
BUG_ON (!th->t_trans_id); BUG_ON (!th->t_trans_id);
...@@ -172,12 +172,12 @@ int reiserfs_convert_objectid_map_v1(struct super_block *s) { ...@@ -172,12 +172,12 @@ int reiserfs_convert_objectid_map_v1(struct super_block *s) {
int new_size = (s->s_blocksize - SB_SIZE) / sizeof(__u32) / 2 * 2 ; int new_size = (s->s_blocksize - SB_SIZE) / sizeof(__u32) / 2 * 2 ;
int old_max = sb_oid_maxsize(disk_sb); int old_max = sb_oid_maxsize(disk_sb);
struct reiserfs_super_block_v1 *disk_sb_v1 ; struct reiserfs_super_block_v1 *disk_sb_v1 ;
__u32 *objectid_map, *new_objectid_map ; __le32 *objectid_map, *new_objectid_map ;
int i ; int i ;
disk_sb_v1=(struct reiserfs_super_block_v1 *)(SB_BUFFER_WITH_SB(s)->b_data); disk_sb_v1=(struct reiserfs_super_block_v1 *)(SB_BUFFER_WITH_SB(s)->b_data);
objectid_map = (__u32 *)(disk_sb_v1 + 1) ; objectid_map = (__le32 *)(disk_sb_v1 + 1) ;
new_objectid_map = (__u32 *)(disk_sb + 1) ; new_objectid_map = (__le32 *)(disk_sb + 1) ;
if (cur_size > new_size) { if (cur_size > new_size) {
/* mark everyone used that was listed as free at the end of the objectid /* mark everyone used that was listed as free at the end of the objectid
......
...@@ -73,8 +73,8 @@ int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset, ...@@ -73,8 +73,8 @@ int reiserfs_global_version_in_proc( char *buffer, char **start, off_t offset,
#define DFL( x ) D4C( rs -> s_v1.x ) #define DFL( x ) D4C( rs -> s_v1.x )
#define objectid_map( s, rs ) (old_format_only (s) ? \ #define objectid_map( s, rs ) (old_format_only (s) ? \
(__u32 *)((struct reiserfs_super_block_v1 *)rs + 1) : \ (__le32 *)((struct reiserfs_super_block_v1 *)rs + 1) : \
(__u32 *)(rs + 1)) (__le32 *)(rs + 1))
#define MAP( i ) D4C( objectid_map( sb, rs )[ i ] ) #define MAP( i ) D4C( objectid_map( sb, rs )[ i ] )
#define DJF( x ) le32_to_cpu( rs -> x ) #define DJF( x ) le32_to_cpu( rs -> x )
......
...@@ -87,10 +87,11 @@ inline void copy_item_head(struct item_head * p_v_to, ...@@ -87,10 +87,11 @@ inline void copy_item_head(struct item_head * p_v_to,
inline int comp_short_keys (const struct reiserfs_key * le_key, inline int comp_short_keys (const struct reiserfs_key * le_key,
const struct cpu_key * cpu_key) const struct cpu_key * cpu_key)
{ {
__u32 * p_s_le_u32, * p_s_cpu_u32; __le32 * p_s_le_u32;
__u32 * p_s_cpu_u32;
int n_key_length = REISERFS_SHORT_KEY_LEN; int n_key_length = REISERFS_SHORT_KEY_LEN;
p_s_le_u32 = (__u32 *)le_key; p_s_le_u32 = (__le32 *)le_key;
p_s_cpu_u32 = (__u32 *)&cpu_key->on_disk_key; p_s_cpu_u32 = (__u32 *)&cpu_key->on_disk_key;
for( ; n_key_length--; ++p_s_le_u32, ++p_s_cpu_u32 ) { for( ; n_key_length--; ++p_s_le_u32, ++p_s_cpu_u32 ) {
if ( le32_to_cpu (*p_s_le_u32) < *p_s_cpu_u32 ) if ( le32_to_cpu (*p_s_le_u32) < *p_s_cpu_u32 )
...@@ -228,7 +229,12 @@ extern struct tree_balance * cur_tb; ...@@ -228,7 +229,12 @@ extern struct tree_balance * cur_tb;
const struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}}; const struct reiserfs_key MIN_KEY = {0, 0, {{0, 0},}};
/* Maximal possible key. It is never in the tree. */ /* Maximal possible key. It is never in the tree. */
const struct reiserfs_key MAX_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}}; const struct reiserfs_key MAX_KEY = {
__constant_cpu_to_le32(0xffffffff),
__constant_cpu_to_le32(0xffffffff),
{{__constant_cpu_to_le32(0xffffffff),
__constant_cpu_to_le32(0xffffffff)},}
};
const struct in_core_key MAX_IN_CORE_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}}; const struct in_core_key MAX_IN_CORE_KEY = {0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},}};
...@@ -998,7 +1004,7 @@ static char prepare_for_delete_or_cut( ...@@ -998,7 +1004,7 @@ static char prepare_for_delete_or_cut(
int n_unfm_number, /* Number of the item unformatted nodes. */ int n_unfm_number, /* Number of the item unformatted nodes. */
n_counter, n_counter,
n_blk_size; n_blk_size;
__u32 * p_n_unfm_pointer; /* Pointer to the unformatted node number. */ __le32 * p_n_unfm_pointer; /* Pointer to the unformatted node number. */
__u32 tmp; __u32 tmp;
struct item_head s_ih; /* Item header. */ struct item_head s_ih; /* Item header. */
char c_mode; /* Returned mode of the balance. */ char c_mode; /* Returned mode of the balance. */
...@@ -1060,7 +1066,7 @@ static char prepare_for_delete_or_cut( ...@@ -1060,7 +1066,7 @@ static char prepare_for_delete_or_cut(
/* pointers to be cut */ /* pointers to be cut */
n_unfm_number -= pos_in_item (p_s_path); n_unfm_number -= pos_in_item (p_s_path);
/* Set pointer to the last unformatted node pointer that is to be cut. */ /* Set pointer to the last unformatted node pointer that is to be cut. */
p_n_unfm_pointer = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1 - *p_n_removed; p_n_unfm_pointer = (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1 - *p_n_removed;
/* We go through the unformatted nodes pointers of the indirect /* We go through the unformatted nodes pointers of the indirect
...@@ -1082,8 +1088,8 @@ static char prepare_for_delete_or_cut( ...@@ -1082,8 +1088,8 @@ static char prepare_for_delete_or_cut(
need_research = 1 ; need_research = 1 ;
break; break;
} }
RFALSE( p_n_unfm_pointer < (__u32 *)B_I_PITEM(p_s_bh, &s_ih) || RFALSE( p_n_unfm_pointer < (__le32 *)B_I_PITEM(p_s_bh, &s_ih) ||
p_n_unfm_pointer > (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1, p_n_unfm_pointer > (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + I_UNFM_NUM(&s_ih) - 1,
"vs-5265: pointer out of range"); "vs-5265: pointer out of range");
/* Hole, nothing to remove. */ /* Hole, nothing to remove. */
...@@ -1432,7 +1438,7 @@ int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode ...@@ -1432,7 +1438,7 @@ int reiserfs_delete_object (struct reiserfs_transaction_handle *th, struct inode
#if defined( USE_INODE_GENERATION_COUNTER ) #if defined( USE_INODE_GENERATION_COUNTER )
if( !old_format_only ( th -> t_super ) ) if( !old_format_only ( th -> t_super ) )
{ {
__u32 *inode_generation; __le32 *inode_generation;
inode_generation = inode_generation =
&REISERFS_SB(th -> t_super) -> s_rs -> s_inode_generation; &REISERFS_SB(th -> t_super) -> s_rs -> s_inode_generation;
......
...@@ -216,7 +216,7 @@ static int finish_unfinished (struct super_block * s) ...@@ -216,7 +216,7 @@ static int finish_unfinished (struct super_block * s)
/* reiserfs_iget needs k_dirid and k_objectid only */ /* reiserfs_iget needs k_dirid and k_objectid only */
item = B_I_PITEM (bh, ih); item = B_I_PITEM (bh, ih);
obj_key.on_disk_key.k_dir_id = le32_to_cpu (*(__u32 *)item); obj_key.on_disk_key.k_dir_id = le32_to_cpu (*(__le32 *)item);
obj_key.on_disk_key.k_objectid = le32_to_cpu (ih->ih_key.k_objectid); obj_key.on_disk_key.k_objectid = le32_to_cpu (ih->ih_key.k_objectid);
obj_key.on_disk_key.u.k_offset_v1.k_offset = 0; obj_key.on_disk_key.u.k_offset_v1.k_offset = 0;
obj_key.on_disk_key.u.k_offset_v1.k_uniqueness = 0; obj_key.on_disk_key.u.k_offset_v1.k_uniqueness = 0;
...@@ -304,7 +304,7 @@ void add_save_link (struct reiserfs_transaction_handle * th, ...@@ -304,7 +304,7 @@ void add_save_link (struct reiserfs_transaction_handle * th,
int retval; int retval;
struct cpu_key key; struct cpu_key key;
struct item_head ih; struct item_head ih;
__u32 link; __le32 link;
BUG_ON (!th->t_trans_id); BUG_ON (!th->t_trans_id);
...@@ -1336,7 +1336,7 @@ static int read_super_block (struct super_block * s, int offset) ...@@ -1336,7 +1336,7 @@ static int read_super_block (struct super_block * s, int offset)
return 1; return 1;
} }
if ( rs->s_v1.s_root_block == -1 ) { if ( rs->s_v1.s_root_block == cpu_to_le32(-1) ) {
brelse(bh) ; brelse(bh) ;
reiserfs_warning (s, "Unfinished reiserfsck --rebuild-tree run detected. Please run\n" reiserfs_warning (s, "Unfinished reiserfsck --rebuild-tree run detected. Please run\n"
"reiserfsck --rebuild-tree and wait for a completion. If that fails\n" "reiserfsck --rebuild-tree and wait for a completion. If that fails\n"
......
...@@ -5,18 +5,18 @@ ...@@ -5,18 +5,18 @@
#define REISERFS_ACL_VERSION 0x0001 #define REISERFS_ACL_VERSION 0x0001
typedef struct { typedef struct {
__u16 e_tag; __le16 e_tag;
__u16 e_perm; __le16 e_perm;
__u32 e_id; __le32 e_id;
} reiserfs_acl_entry; } reiserfs_acl_entry;
typedef struct { typedef struct {
__u16 e_tag; __le16 e_tag;
__u16 e_perm; __le16 e_perm;
} reiserfs_acl_entry_short; } reiserfs_acl_entry_short;
typedef struct { typedef struct {
__u32 a_version; __le32 a_version;
} reiserfs_acl_header; } reiserfs_acl_header;
static inline size_t reiserfs_acl_size(int count) static inline size_t reiserfs_acl_size(int count)
......
...@@ -114,47 +114,47 @@ if( !( cond ) ) \ ...@@ -114,47 +114,47 @@ if( !( cond ) ) \
struct journal_params { struct journal_params {
__u32 jp_journal_1st_block; /* where does journal start from on its __le32 jp_journal_1st_block; /* where does journal start from on its
* device */ * device */
__u32 jp_journal_dev; /* journal device st_rdev */ __le32 jp_journal_dev; /* journal device st_rdev */
__u32 jp_journal_size; /* size of the journal */ __le32 jp_journal_size; /* size of the journal */
__u32 jp_journal_trans_max; /* max number of blocks in a transaction. */ __le32 jp_journal_trans_max; /* max number of blocks in a transaction. */
__u32 jp_journal_magic; /* random value made on fs creation (this __le32 jp_journal_magic; /* random value made on fs creation (this
* was sb_journal_block_count) */ * was sb_journal_block_count) */
__u32 jp_journal_max_batch; /* max number of blocks to batch into a __le32 jp_journal_max_batch; /* max number of blocks to batch into a
* trans */ * trans */
__u32 jp_journal_max_commit_age; /* in seconds, how old can an async __le32 jp_journal_max_commit_age; /* in seconds, how old can an async
* commit be */ * commit be */
__u32 jp_journal_max_trans_age; /* in seconds, how old can a transaction __le32 jp_journal_max_trans_age; /* in seconds, how old can a transaction
* be */ * be */
}; };
/* this is the super from 3.5.X, where X >= 10 */ /* this is the super from 3.5.X, where X >= 10 */
struct reiserfs_super_block_v1 struct reiserfs_super_block_v1
{ {
__u32 s_block_count; /* blocks count */ __le32 s_block_count; /* blocks count */
__u32 s_free_blocks; /* free blocks count */ __le32 s_free_blocks; /* free blocks count */
__u32 s_root_block; /* root block number */ __le32 s_root_block; /* root block number */
struct journal_params s_journal; struct journal_params s_journal;
__u16 s_blocksize; /* block size */ __le16 s_blocksize; /* block size */
__u16 s_oid_maxsize; /* max size of object id array, see __le16 s_oid_maxsize; /* max size of object id array, see
* get_objectid() commentary */ * get_objectid() commentary */
__u16 s_oid_cursize; /* current size of object id array */ __le16 s_oid_cursize; /* current size of object id array */
__u16 s_umount_state; /* this is set to 1 when filesystem was __le16 s_umount_state; /* this is set to 1 when filesystem was
* umounted, to 2 - when not */ * umounted, to 2 - when not */
char s_magic[10]; /* reiserfs magic string indicates that char s_magic[10]; /* reiserfs magic string indicates that
* file system is reiserfs: * file system is reiserfs:
* "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */ * "ReIsErFs" or "ReIsEr2Fs" or "ReIsEr3Fs" */
__u16 s_fs_state; /* it is set to used by fsck to mark which __le16 s_fs_state; /* it is set to used by fsck to mark which
* phase of rebuilding is done */ * phase of rebuilding is done */
__u32 s_hash_function_code; /* indicate, what hash function is being use __le32 s_hash_function_code; /* indicate, what hash function is being use
* to sort names in a directory*/ * to sort names in a directory*/
__u16 s_tree_height; /* height of disk tree */ __le16 s_tree_height; /* height of disk tree */
__u16 s_bmap_nr; /* amount of bitmap blocks needed to address __le16 s_bmap_nr; /* amount of bitmap blocks needed to address
* each block of file system */ * each block of file system */
__u16 s_version; /* this field is only reliable on filesystem __le16 s_version; /* this field is only reliable on filesystem
* with non-standard journal */ * with non-standard journal */
__u16 s_reserved_for_journal; /* size in blocks of journal area on main __le16 s_reserved_for_journal; /* size in blocks of journal area on main
* device, we need to keep after * device, we need to keep after
* making fs with non-standard journal */ * making fs with non-standard journal */
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
...@@ -165,8 +165,8 @@ struct reiserfs_super_block_v1 ...@@ -165,8 +165,8 @@ struct reiserfs_super_block_v1
struct reiserfs_super_block struct reiserfs_super_block
{ {
struct reiserfs_super_block_v1 s_v1; struct reiserfs_super_block_v1 s_v1;
__u32 s_inode_generation; __le32 s_inode_generation;
__u32 s_flags; /* Right now used only by inode-attributes, if enabled */ __le32 s_flags; /* Right now used only by inode-attributes, if enabled */
unsigned char s_uuid[16]; /* filesystem unique identifier */ unsigned char s_uuid[16]; /* filesystem unique identifier */
unsigned char s_label[16]; /* filesystem volume label */ unsigned char s_label[16]; /* filesystem volume label */
char s_unused[88] ; /* zero filled by mkreiserfs and char s_unused[88] ; /* zero filled by mkreiserfs and
...@@ -269,7 +269,7 @@ int is_reiserfs_jr (struct reiserfs_super_block * rs); ...@@ -269,7 +269,7 @@ int is_reiserfs_jr (struct reiserfs_super_block * rs);
#define QUOTA_EXCEEDED -6 #define QUOTA_EXCEEDED -6
typedef __u32 b_blocknr_t; typedef __u32 b_blocknr_t;
typedef __u32 unp_t; typedef __le32 unp_t;
struct unfm_nodeinfo { struct unfm_nodeinfo {
unp_t unfm_nodenum; unp_t unfm_nodenum;
...@@ -376,8 +376,8 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb) ...@@ -376,8 +376,8 @@ static inline struct reiserfs_sb_info *REISERFS_SB(const struct super_block *sb)
// directories use this key as well as old files // directories use this key as well as old files
// //
struct offset_v1 { struct offset_v1 {
__u32 k_offset; __le32 k_offset;
__u32 k_uniqueness; __le32 k_uniqueness;
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
struct offset_v2 { struct offset_v2 {
...@@ -453,9 +453,9 @@ struct in_core_offset_v2 { ...@@ -453,9 +453,9 @@ struct in_core_offset_v2 {
/* Key of an item determines its location in the S+tree, and /* Key of an item determines its location in the S+tree, and
is composed of 4 components */ is composed of 4 components */
struct reiserfs_key { struct reiserfs_key {
__u32 k_dir_id; /* packing locality: by default parent __le32 k_dir_id; /* packing locality: by default parent
directory object id */ directory object id */
__u32 k_objectid; /* object identifier */ __le32 k_objectid; /* object identifier */
union { union {
struct offset_v1 k_offset_v1; struct offset_v1 k_offset_v1;
struct offset_v2 k_offset_v2; struct offset_v2 k_offset_v2;
...@@ -534,15 +534,15 @@ struct item_head ...@@ -534,15 +534,15 @@ struct item_head
item. Note that the key, not this field, is used to item. Note that the key, not this field, is used to
determine the item type, and thus which field this determine the item type, and thus which field this
union contains. */ union contains. */
__u16 ih_free_space_reserved; __le16 ih_free_space_reserved;
/* Iff this is a directory item, this field equals the /* Iff this is a directory item, this field equals the
number of directory entries in the directory item. */ number of directory entries in the directory item. */
__u16 ih_entry_count; __le16 ih_entry_count;
} __attribute__ ((__packed__)) u; } __attribute__ ((__packed__)) u;
__u16 ih_item_len; /* total size of the item body */ __le16 ih_item_len; /* total size of the item body */
__u16 ih_item_location; /* an offset to the item body __le16 ih_item_location; /* an offset to the item body
* within the block */ * within the block */
__u16 ih_version; /* 0 for all old items, 2 for new __le16 ih_version; /* 0 for all old items, 2 for new
ones. Highest bit is set by fsck ones. Highest bit is set by fsck
temporary, cleaned after all temporary, cleaned after all
done */ done */
...@@ -778,10 +778,10 @@ extern struct reiserfs_key root_key; ...@@ -778,10 +778,10 @@ extern struct reiserfs_key root_key;
/* Header of a disk block. More precisely, header of a formatted leaf /* Header of a disk block. More precisely, header of a formatted leaf
or internal node, and not the header of an unformatted node. */ or internal node, and not the header of an unformatted node. */
struct block_head { struct block_head {
__u16 blk_level; /* Level of a block in the tree. */ __le16 blk_level; /* Level of a block in the tree. */
__u16 blk_nr_item; /* Number of keys/items in a block. */ __le16 blk_nr_item; /* Number of keys/items in a block. */
__u16 blk_free_space; /* Block free space in bytes. */ __le16 blk_free_space; /* Block free space in bytes. */
__u16 blk_reserved; __le16 blk_reserved;
/* dump this in v4/planA */ /* dump this in v4/planA */
struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */ struct reiserfs_key blk_right_delim_key; /* kept only for compatibility */
}; };
...@@ -845,19 +845,19 @@ struct block_head { ...@@ -845,19 +845,19 @@ struct block_head {
// //
struct stat_data_v1 struct stat_data_v1
{ {
__u16 sd_mode; /* file type, permissions */ __le16 sd_mode; /* file type, permissions */
__u16 sd_nlink; /* number of hard links */ __le16 sd_nlink; /* number of hard links */
__u16 sd_uid; /* owner */ __le16 sd_uid; /* owner */
__u16 sd_gid; /* group */ __le16 sd_gid; /* group */
__u32 sd_size; /* file size */ __le32 sd_size; /* file size */
__u32 sd_atime; /* time of last access */ __le32 sd_atime; /* time of last access */
__u32 sd_mtime; /* time file was last modified */ __le32 sd_mtime; /* time file was last modified */
__u32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
union { union {
__u32 sd_rdev; __le32 sd_rdev;
__u32 sd_blocks; /* number of blocks file uses */ __le32 sd_blocks; /* number of blocks file uses */
} __attribute__ ((__packed__)) u; } __attribute__ ((__packed__)) u;
__u32 sd_first_direct_byte; /* first byte of file which is stored __le32 sd_first_direct_byte; /* first byte of file which is stored
in a direct item: except that if it in a direct item: except that if it
equals 1 it is a symlink and if it equals 1 it is a symlink and if it
equals ~(__u32)0 there is no equals ~(__u32)0 there is no
...@@ -923,20 +923,20 @@ struct stat_data_v1 ...@@ -923,20 +923,20 @@ struct stat_data_v1
/* Stat Data on disk (reiserfs version of UFS disk inode minus the /* Stat Data on disk (reiserfs version of UFS disk inode minus the
address blocks) */ address blocks) */
struct stat_data { struct stat_data {
__u16 sd_mode; /* file type, permissions */ __le16 sd_mode; /* file type, permissions */
__u16 sd_attrs; /* persistent inode flags */ __le16 sd_attrs; /* persistent inode flags */
__u32 sd_nlink; /* number of hard links */ __le32 sd_nlink; /* number of hard links */
__u64 sd_size; /* file size */ __le64 sd_size; /* file size */
__u32 sd_uid; /* owner */ __le32 sd_uid; /* owner */
__u32 sd_gid; /* group */ __le32 sd_gid; /* group */
__u32 sd_atime; /* time of last access */ __le32 sd_atime; /* time of last access */
__u32 sd_mtime; /* time file was last modified */ __le32 sd_mtime; /* time file was last modified */
__u32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */ __le32 sd_ctime; /* time inode (stat data) was last changed (except changes to sd_atime and sd_mtime) */
__u32 sd_blocks; __le32 sd_blocks;
union { union {
__u32 sd_rdev; __le32 sd_rdev;
__u32 sd_generation; __le32 sd_generation;
//__u32 sd_first_direct_byte; //__le32 sd_first_direct_byte;
/* first byte of file which is stored in a /* first byte of file which is stored in a
direct item: except that if it equals 1 direct item: except that if it equals 1
it is a symlink and if it equals it is a symlink and if it equals
...@@ -1019,12 +1019,12 @@ struct stat_data { ...@@ -1019,12 +1019,12 @@ struct stat_data {
struct reiserfs_de_head struct reiserfs_de_head
{ {
__u32 deh_offset; /* third component of the directory entry key */ __le32 deh_offset; /* third component of the directory entry key */
__u32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced __le32 deh_dir_id; /* objectid of the parent directory of the object, that is referenced
by directory entry */ by directory entry */
__u32 deh_objectid; /* objectid of the object, that is referenced by directory entry */ __le32 deh_objectid; /* objectid of the object, that is referenced by directory entry */
__u16 deh_location; /* offset of name in the whole item */ __le16 deh_location; /* offset of name in the whole item */
__u16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether __le16 deh_state; /* whether 1) entry contains stat data (for future), and 2) whether
entry is hidden (unlinked) */ entry is hidden (unlinked) */
} __attribute__ ((__packed__)); } __attribute__ ((__packed__));
#define DEH_SIZE sizeof(struct reiserfs_de_head) #define DEH_SIZE sizeof(struct reiserfs_de_head)
...@@ -1084,10 +1084,10 @@ struct reiserfs_de_head ...@@ -1084,10 +1084,10 @@ struct reiserfs_de_head
#define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) #define de_visible(deh) test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
#define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state)) #define de_hidden(deh) !test_bit_unaligned (DEH_Visible, &((deh)->deh_state))
extern void make_empty_dir_item_v1 (char * body, __u32 dirid, __u32 objid, extern void make_empty_dir_item_v1 (char * body, __le32 dirid, __le32 objid,
__u32 par_dirid, __u32 par_objid); __le32 par_dirid, __le32 par_objid);
extern void make_empty_dir_item (char * body, __u32 dirid, __u32 objid, extern void make_empty_dir_item (char * body, __le32 dirid, __le32 objid,
__u32 par_dirid, __u32 par_objid); __le32 par_dirid, __le32 par_objid);
/* array of the entry headers */ /* array of the entry headers */
/* get item body */ /* get item body */
...@@ -1186,9 +1186,9 @@ struct reiserfs_dir_entry ...@@ -1186,9 +1186,9 @@ struct reiserfs_dir_entry
/* Disk child pointer: The pointer from an internal node of the tree /* Disk child pointer: The pointer from an internal node of the tree
to a node that is on disk. */ to a node that is on disk. */
struct disk_child { struct disk_child {
__u32 dc_block_number; /* Disk child's block number. */ __le32 dc_block_number; /* Disk child's block number. */
__u16 dc_size; /* Disk child's used space. */ __le16 dc_size; /* Disk child's used space. */
__u16 dc_reserved; __le16 dc_reserved;
}; };
#define DC_SIZE (sizeof(struct disk_child)) #define DC_SIZE (sizeof(struct disk_child))
...@@ -1656,10 +1656,10 @@ struct reiserfs_iget_args { ...@@ -1656,10 +1656,10 @@ struct reiserfs_iget_args {
/* first block written in a commit. */ /* first block written in a commit. */
struct reiserfs_journal_desc { struct reiserfs_journal_desc {
__u32 j_trans_id ; /* id of commit */ __le32 j_trans_id ; /* id of commit */
__u32 j_len ; /* length of commit. len +1 is the commit block */ __le32 j_len ; /* length of commit. len +1 is the commit block */
__u32 j_mount_id ; /* mount id of this trans*/ __le32 j_mount_id ; /* mount id of this trans*/
__u32 j_realblock[1] ; /* real locations for each block */ __le32 j_realblock[1] ; /* real locations for each block */
} ; } ;
#define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id) #define get_desc_trans_id(d) le32_to_cpu((d)->j_trans_id)
...@@ -1672,9 +1672,9 @@ struct reiserfs_journal_desc { ...@@ -1672,9 +1672,9 @@ struct reiserfs_journal_desc {
/* last block written in a commit */ /* last block written in a commit */
struct reiserfs_journal_commit { struct reiserfs_journal_commit {
__u32 j_trans_id ; /* must match j_trans_id from the desc block */ __le32 j_trans_id ; /* must match j_trans_id from the desc block */
__u32 j_len ; /* ditto */ __le32 j_len ; /* ditto */
__u32 j_realblock[1] ; /* real locations for each block */ __le32 j_realblock[1] ; /* real locations for each block */
} ; } ;
#define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id) #define get_commit_trans_id(c) le32_to_cpu((c)->j_trans_id)
...@@ -1689,9 +1689,9 @@ struct reiserfs_journal_commit { ...@@ -1689,9 +1689,9 @@ struct reiserfs_journal_commit {
** and this transaction does not need to be replayed. ** and this transaction does not need to be replayed.
*/ */
struct reiserfs_journal_header { struct reiserfs_journal_header {
__u32 j_last_flush_trans_id ; /* id of last fully flushed transaction */ __le32 j_last_flush_trans_id ; /* id of last fully flushed transaction */
__u32 j_first_unflushed_offset ; /* offset in the log of where to start replay after a crash */ __le32 j_first_unflushed_offset ; /* offset in the log of where to start replay after a crash */
__u32 j_mount_id ; __le32 j_mount_id ;
/* 12 */ struct journal_params jh_journal; /* 12 */ struct journal_params jh_journal;
} ; } ;
...@@ -2170,7 +2170,7 @@ void reiserfs_init_alloc_options (struct super_block *s); ...@@ -2170,7 +2170,7 @@ void reiserfs_init_alloc_options (struct super_block *s);
* to use for a new object underneat it. The locality is returned * to use for a new object underneat it. The locality is returned
* in disk byte order (le). * in disk byte order (le).
*/ */
u32 reiserfs_choose_packing(struct inode *dir); __le32 reiserfs_choose_packing(struct inode *dir);
int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value); int is_reusable (struct super_block * s, b_blocknr_t block, int bit_value);
void reiserfs_free_block (struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted); void reiserfs_free_block (struct reiserfs_transaction_handle *th, struct inode *, b_blocknr_t, int for_unformatted);
......
...@@ -10,8 +10,8 @@ ...@@ -10,8 +10,8 @@
#define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */ #define REISERFS_XATTR_MAGIC 0x52465841 /* "RFXA" */
struct reiserfs_xattr_header { struct reiserfs_xattr_header {
__u32 h_magic; /* magic number for identification */ __le32 h_magic; /* magic number for identification */
__u32 h_hash; /* hash of the value */ __le32 h_hash; /* hash of the value */
}; };
#ifdef __KERNEL__ #ifdef __KERNEL__
......
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