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 -3
View File
@@ -388,7 +388,8 @@ static int bad_direct_item(reiserfs_filsys_t *fs,
}
inline void handle_one_pointer(reiserfs_filsys_t *fs,
struct buffer_head *bh, __u32 * item, int offset)
struct buffer_head *bh, __le32 * item,
int offset)
{
if (fsck_mode(fs) == FSCK_FIX_FIXABLE) {
fsck_log(" - zeroed");
@@ -403,7 +404,7 @@ static int bad_badblocks_item(reiserfs_filsys_t *fs, struct buffer_head *bh,
struct item_head *ih)
{
__u32 i;
__u32 *ind = (__u32 *) ih_item_body(bh, ih);
__le32 *ind = (__le32 *) ih_item_body(bh, ih);
if (get_ih_item_len(ih) % 4) {
fsck_log("%s: block %lu: item (%H) has bad length\n",
@@ -477,7 +478,7 @@ static int bad_badblocks_item(reiserfs_filsys_t *fs, struct buffer_head *bh,
static int bad_indirect_item(reiserfs_filsys_t *fs, struct buffer_head *bh,
struct item_head *ih)
{
__u32 *ind = (__u32 *) ih_item_body(bh, ih);
__le32 *ind = (__le32 *) ih_item_body(bh, ih);
unsigned int i;
if (get_ih_item_len(ih) % 4) {