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

+2 -2
View File
@@ -81,7 +81,7 @@ void do_recover(reiserfs_filsys_t fs)
ih = item_head(bh, 0);
for (i = 0; i < node_item_number(bh); i++, ih++) {
__u32 *indirect;
__le32 *indirect;
struct buffer_head *tmp_bh;
if (!is_indirect_ih(ih)
@@ -385,7 +385,7 @@ static void recover_items(FILE * fp, reiserfs_filsys_t *fs, FILE * target_file)
} else if (is_indirect_ih(ih)) {
for (j = 0; j < I_UNFM_NUM(ih); j++) {
unfm_ptr =
d32_get((__u32 *) ih_item_body(bh, ih), j);
d32_get((__le32 *) ih_item_body(bh, ih), j);
if (!unfm_ptr) {
fseek(target_file, fs->fs_blocksize,
SEEK_CUR);