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
@@ -213,10 +213,10 @@ void id_map_flush(struct id_map *map, reiserfs_filsys_t *fs)
{
int size, max, i;
__u32 id, prev_id;
__u32 *sb_objectid_map;
__le32 *sb_objectid_map;
size = reiserfs_super_block_size(fs->fs_ondisk_sb);
sb_objectid_map = (__u32 *) ((char *)(fs->fs_ondisk_sb) + size);
sb_objectid_map = (__le32 *) ((char *)(fs->fs_ondisk_sb) + size);
max = ((fs->fs_blocksize - size) >> 3 << 1);
set_sb_oid_maxsize(fs->fs_ondisk_sb, max);
@@ -286,10 +286,10 @@ void id_map_flush(struct id_map *map, reiserfs_filsys_t *fs)
void fetch_objectid_map (struct id_map * map, reiserfs_filsys_t *fs)
{
int sb_size;
__u32 * sb_objectid_map;
__le32 * sb_objectid_map;
sb_size = reiserfs_super_block_size (fs->fs_ondisk_sb);
sb_objectid_map = (__u32 *)((char *)(fs->fs_ondisk_sb) + sb_size);
sb_objectid_map = (__le32 *)((char *)(fs->fs_ondisk_sb) + sb_size);
if (map->m_page_count != 1)
die ("fetch_objectid_map: can not fetch long map");