diff mbox

[12/15] btrfs-progs: fix unaligned compat endian warnings

Message ID 1376522205-16992-13-git-send-email-zab@redhat.com (mailing list archive)
State Accepted, archived
Headers show

Commit Message

Zach Brown Aug. 14, 2013, 11:16 p.m. UTC
The _una_ struct's entire job is to pass an argument to le*_to_cpu.  So
it's a little embarassing that it uses a native cpu types and generates
endian warnings.

ctree.h:1616:1: warning: incorrect type in assignment (different base types)
ctree.h:1616:1:    expected unsigned long long [unsigned] [usertype] x
ctree.h:1616:1:    got restricted __le64 [usertype] <noident>

Signed-off-by: Zach Brown <zab@redhat.com>
---
 kerncompat.h | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
diff mbox

Patch

diff --git a/kerncompat.h b/kerncompat.h
index 4d78288..1fc2b34 100644
--- a/kerncompat.h
+++ b/kerncompat.h
@@ -277,9 +277,9 @@  typedef u64 __bitwise __be64;
 #define le16_to_cpu(x) ((__force u16)(__le16)(x))
 #endif
 
-struct __una_u16 { u16 x; } __attribute__((__packed__));
-struct __una_u32 { u32 x; } __attribute__((__packed__));
-struct __una_u64 { u64 x; } __attribute__((__packed__));
+struct __una_u16 { __le16 x; } __attribute__((__packed__));
+struct __una_u32 { __le32 x; } __attribute__((__packed__));
+struct __una_u64 { __le64 x; } __attribute__((__packed__));
 
 #define get_unaligned_le8(p) (*((u8 *)(p)))
 #define put_unaligned_le8(val,p) ((*((u8 *)(p))) = (val))