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

+6 -4
View File
@@ -250,13 +250,14 @@ int blockdev_list_compare(const void *block1, const void *block2);
#define set_bit_field_XX(XX,vp,val,from,count) \
{\
__u##XX * p, tmp;\
__le##XX * p;\
__u##XX tmp;\
\
/* make sure that given value can be put in 'count' bits */\
if (val > (1 << count))\
die ("set_bit_field: val %d is too big for %d bits", val, count);\
\
p = (__u##XX *)vp;\
p = (__le##XX *)vp;\
tmp = le##XX##_to_cpu (*p);\
\
/* clear 'count' bits starting from 'from'-th one */\
@@ -270,9 +271,10 @@ int blockdev_list_compare(const void *block1, const void *block2);
#define get_bit_field_XX(XX,vp,from,count) \
\
__u##XX * p, tmp;\
__le##XX * p;\
__u##XX tmp;\
\
p = (__u##XX *)vp;\
p = (__le##XX *)vp;\
tmp = le##XX##_to_cpu (*p);\
\
/* clear all bits but 'count' bits starting from 'from'-th one */\