reiserfsprogs: annotate for endian safeness

By annotating structure members and other on-disk structures as little
endian, we can catch bugs more easily.

The code was already endian safe except for three minor spots:
1) The badblock list code was initializing its key in an endian-unsafe way.
2) Indirect block pointer sequence printing was treating cpu-order values
   as little endian.
3) reiserfsck was trying to do endian switching on the lost+found key,
   but it was before it was even initialized to anything, so we can
   just remove that completely.

These issues were fixed as part of this commit.

Signed-off-by: Jeff Mahoney <jeffm@suse.com>
This commit is contained in:
Jeff Mahoney committed 2013-08-26 19:02:20 -04:00
1 parent 767f7b85df
commit 81aeadf510
26 files changed
+241 -220

No files matched your search

+4 -4
View File
@@ -94,11 +94,11 @@ static char *still_bad_unfm_ptr_to_string(int val)
static void indirect_in_tree(struct buffer_head *bh, struct item_head *ih)
{
unsigned int i;
__u32 *unp;
__le32 *unp;
__u32 unfm_ptr;
int ret;
unp = (__u32 *) ih_item_body(bh, ih);
unp = (__le32 *) ih_item_body(bh, ih);
for (i = 0; i < I_UNFM_NUM(ih); i++) {
unfm_ptr = d32_get(unp, i);
@@ -344,7 +344,7 @@ static void pass1_correct_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh)
{
unsigned int i, j;
struct item_head *ih;
__u32 *ind_item;
__le32 *ind_item;
__u32 unfm_ptr;
int dirty = 0;
@@ -423,7 +423,7 @@ static void pass1_correct_leaf(reiserfs_filsys_t *fs, struct buffer_head *bh)
continue;
/* correct indirect items */
ind_item = (__u32 *) ih_item_body(bh, ih);
ind_item = (__le32 *) ih_item_body(bh, ih);
for (j = 0; j < I_UNFM_NUM(ih); j++) {
unfm_ptr = d32_get(ind_item, j);