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

+7 -4
View File
@@ -53,8 +53,8 @@ inline int B_IS_IN_TREE(struct buffer_head *p_s_bh)
int comp_short_keys(const void *k1, const void *k2)
{
int n_key_length = REISERFS_SHORT_KEY_LEN;
__u32 *p_s_key1 = (__u32 *) k1;
__u32 *p_s_key2 = (__u32 *) k2;
__le32 *p_s_key1 = (__le32 *) k1;
__le32 *p_s_key2 = (__le32 *) k2;
__u32 u1, u2;
for (; n_key_length--; ++p_s_key1, ++p_s_key2) {
@@ -173,11 +173,14 @@ int bin_search(void *p_v_key, /* Key to search for. */
}
/* Minimal possible key. It is never in the tree. */
const struct reiserfs_key MIN_KEY = { 0, 0, {{0, 0},} };
const struct reiserfs_key MIN_KEY =
{ cpu_to_le32(0), cpu_to_le32(0),
{{cpu_to_le32(0), cpu_to_le32(0)},} };
/* Maximal possible key. It is never in the tree. */
const struct reiserfs_key MAX_KEY =
{ 0xffffffff, 0xffffffff, {{0xffffffff, 0xffffffff},} };
{ cpu_to_le32(0xffffffff), cpu_to_le32(0xffffffff),
{{cpu_to_le32(0xffffffff), cpu_to_le32(0xffffffff)},} };
/* Get delimiting key of the buffer by looking for it in the buffers in the
path, starting from the bottom of the path, and going upwards. We must