aboutsummaryrefslogtreecommitdiffstats
path: root/kerncompat.h
diff options
context:
space:
mode:
authorChris Mason <chris.mason@fusionio.com>2013-02-06 12:42:24 -0500
committerChris Mason <chris.mason@fusionio.com>2013-02-06 12:42:24 -0500
commit7b1c567c84a6292c138db3bd1638e19e73e0e593 (patch)
tree9ab6983c6fa2cbb837e9b782d1020899e0d2d846 /kerncompat.h
parent5ffe6597e708d74c02d72d79ebb4a8fd2181e227 (diff)
parent2161e1b6f35d1c084fda49b479951219117c86e9 (diff)
downloadbtrfs-progs-7b1c567c84a6292c138db3bd1638e19e73e0e593.tar.gz
btrfs-progs-7b1c567c84a6292c138db3bd1638e19e73e0e593.tar.xz
btrfs-progs-7b1c567c84a6292c138db3bd1638e19e73e0e593.zip
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.h13
1 files changed, 13 insertions, 0 deletions
diff --git a/kerncompat.h b/kerncompat.h
index 28b9799..0ab2baf 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