diff options
author | Chris Mason <chris.mason@fusionio.com> | 2013-02-06 12:42:24 -0500 |
---|---|---|
committer | Chris Mason <chris.mason@fusionio.com> | 2013-02-06 12:42:24 -0500 |
commit | 7b1c567c84a6292c138db3bd1638e19e73e0e593 (patch) | |
tree | 9ab6983c6fa2cbb837e9b782d1020899e0d2d846 /kerncompat.h | |
parent | 5ffe6597e708d74c02d72d79ebb4a8fd2181e227 (diff) | |
parent | 2161e1b6f35d1c084fda49b479951219117c86e9 (diff) |
Merge branch 'for-chris' of git://repo.or.cz/btrfs-progs-unstable/devel into raid56
Conflicts:
ctree.h
Signed-off-by: Chris Mason <chris.mason@fusionio.com>
Diffstat (limited to 'kerncompat.h')
-rw-r--r-- | kerncompat.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/kerncompat.h b/kerncompat.h index 28b9799d..0ab2baf9 100644 --- a/kerncompat.h +++ b/kerncompat.h @@ -271,6 +271,19 @@ typedef u64 __bitwise __be64; #define cpu_to_le16(x) ((__force __le16)(u16)(x)) #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__)); + +#define get_unaligned_le8(p) (*((u8 *)(p))) +#define put_unaligned_le8(val,p) ((*((u8 *)(p))) = (val)) +#define get_unaligned_le16(p) le16_to_cpu(((const struct __una_u16 *)(p))->x) +#define put_unaligned_le16(val,p) (((struct __una_u16 *)(p))->x = cpu_to_le16(val)) +#define get_unaligned_le32(p) le32_to_cpu(((const struct __una_u32 *)(p))->x) +#define put_unaligned_le32(val,p) (((struct __una_u32 *)(p))->x = cpu_to_le32(val)) +#define get_unaligned_le64(p) le64_to_cpu(((const struct __una_u64 *)(p))->x) +#define put_unaligned_le64(val,p) (((struct __una_u64 *)(p))->x = cpu_to_le64(val)) #endif #ifndef noinline |