Fix btrfs endianness handling.

* grub-core/fs/btrfs.c (key_cmp): Use grub_le_to_cpu for clarity.
	(lower_bound): Make root uint64_t. Use root in le.
	(grub_btrfs_read_logical): Fix template key init. Fix address byteswap.
	(find_path): Fix template key init.
	(grub_btrfs_dir): Fix mtime byteswap.
	* include/grub/types.h (grub_cpu_to_le64_compile_time): New macro.

	Also-By: Vladimir Serbinenko <phcoder@gmail.com>
This commit is contained in:
Anton Blanchard 2012-03-31 18:45:13 +02:00 committed by Vladimir 'phcoder' Serbinenko
parent 354e0af7d3
commit bbb39a458b
3 changed files with 28 additions and 14 deletions

View file

@ -212,6 +212,7 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
# define grub_cpu_to_be64_compile_time(x) ((grub_uint64_t) (x))
# define grub_be_to_cpu64_compile_time(x) ((grub_uint64_t) (x))
# define grub_cpu_to_le32_compile_time(x) grub_swap_bytes32_compile_time(x)
# define grub_cpu_to_le64_compile_time(x) grub_swap_bytes64_compile_time(x)
# define grub_cpu_to_le16_compile_time(x) grub_swap_bytes16_compile_time(x)
#else /* ! WORDS_BIGENDIAN */
# define grub_cpu_to_le16(x) ((grub_uint16_t) (x))
@ -232,6 +233,7 @@ static inline grub_uint64_t grub_swap_bytes64(grub_uint64_t x)
# define grub_be_to_cpu64_compile_time(x) grub_swap_bytes64_compile_time(x)
# define grub_cpu_to_le16_compile_time(x) ((grub_uint16_t) (x))
# define grub_cpu_to_le32_compile_time(x) ((grub_uint32_t) (x))
# define grub_cpu_to_le64_compile_time(x) ((grub_uint64_t) (x))
#endif /* ! WORDS_BIGENDIAN */