summaryrefslogtreecommitdiffstats
path: root/tools/include/linux/unaligned/packed_struct.h
diff options
context:
space:
mode:
authorLevin, Alexander (Sasha Levin) <alexander.levin@verizon.com>2017-05-25 12:58:47 +0000
committerIngo Molnar <mingo@kernel.org>2017-06-05 09:28:09 +0200
commit6c8e6483850e7a7e44fd584790969c308887c468 (patch)
treea22b5da6c662b1479f17b6fbfaf040f4a0881491 /tools/include/linux/unaligned/packed_struct.h
parent20fb654aef1c929f7befb40678e2cb65a77ead7f (diff)
downloadlinux-6c8e6483850e7a7e44fd584790969c308887c468.tar.gz
linux-6c8e6483850e7a7e44fd584790969c308887c468.tar.bz2
linux-6c8e6483850e7a7e44fd584790969c308887c468.zip
tools/lib/lockdep: Fix compilation for 4.11
- More rcu stubs - New dummy headers due to sched header split - jhash2 included in due to kernel lockdep inclusion and usage Signed-off-by: Sasha Levin <alexander.levin@verizon.com> Cc: Linus Torvalds <torvalds@linux-foundation.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: a.p.zijlstra@chello.nl Cc: ben@decadent.org.uk Link: http://lkml.kernel.org/r/20170525130005.5947-13-alexander.levin@verizon.com Signed-off-by: Ingo Molnar <mingo@kernel.org>
Diffstat (limited to 'tools/include/linux/unaligned/packed_struct.h')
-rw-r--r--tools/include/linux/unaligned/packed_struct.h46
1 files changed, 46 insertions, 0 deletions
diff --git a/tools/include/linux/unaligned/packed_struct.h b/tools/include/linux/unaligned/packed_struct.h
new file mode 100644
index 000000000000..c0d817de4df2
--- /dev/null
+++ b/tools/include/linux/unaligned/packed_struct.h
@@ -0,0 +1,46 @@
+#ifndef _LINUX_UNALIGNED_PACKED_STRUCT_H
+#define _LINUX_UNALIGNED_PACKED_STRUCT_H
+
+#include <linux/kernel.h>
+
+struct __una_u16 { u16 x; } __packed;
+struct __una_u32 { u32 x; } __packed;
+struct __una_u64 { u64 x; } __packed;
+
+static inline u16 __get_unaligned_cpu16(const void *p)
+{
+ const struct __una_u16 *ptr = (const struct __una_u16 *)p;
+ return ptr->x;
+}
+
+static inline u32 __get_unaligned_cpu32(const void *p)
+{
+ const struct __una_u32 *ptr = (const struct __una_u32 *)p;
+ return ptr->x;
+}
+
+static inline u64 __get_unaligned_cpu64(const void *p)
+{
+ const struct __una_u64 *ptr = (const struct __una_u64 *)p;
+ return ptr->x;
+}
+
+static inline void __put_unaligned_cpu16(u16 val, void *p)
+{
+ struct __una_u16 *ptr = (struct __una_u16 *)p;
+ ptr->x = val;
+}
+
+static inline void __put_unaligned_cpu32(u32 val, void *p)
+{
+ struct __una_u32 *ptr = (struct __una_u32 *)p;
+ ptr->x = val;
+}
+
+static inline void __put_unaligned_cpu64(u64 val, void *p)
+{
+ struct __una_u64 *ptr = (struct __una_u64 *)p;
+ ptr->x = val;
+}
+
+#endif /* _LINUX_UNALIGNED_PACKED_STRUCT_H */