kernel: split patches folder up into backport, pending and hack folders
[openwrt/staging/chunkeey.git] / target / linux / generic / hack-4.9 / 212-byteshift_portability.patch
1 From 48232d3d931c95953ce2ddfe7da7bb164aef6a73 Mon Sep 17 00:00:00 2001
2 From: Felix Fietkau <nbd@nbd.name>
3 Date: Fri, 7 Jul 2017 17:03:16 +0200
4 Subject: linux-3.6: fix portability of some includes files in tools/ used on the host
5
6 lede-commit: 6040b1d29ab1f047c5e49b748abcb6a3196add28
7 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 ---
9 tools/include/tools/be_byteshift.h | 4 ++++
10 tools/include/tools/le_byteshift.h | 4 ++++
11 tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++
12 3 files changed, 30 insertions(+)
13 create mode 100644 tools/include/tools/linux_types.h
14
15 diff --git a/tools/include/tools/be_byteshift.h b/tools/include/tools/be_byteshift.h
16 index 84c17d836578..ed9932e97bd4 100644
17 --- a/tools/include/tools/be_byteshift.h
18 +++ b/tools/include/tools/be_byteshift.h
19 @@ -1,6 +1,10 @@
20 #ifndef _TOOLS_BE_BYTESHIFT_H
21 #define _TOOLS_BE_BYTESHIFT_H
22
23 +#ifndef __linux__
24 +#include "linux_types.h"
25 +#endif
26 +
27 #include <stdint.h>
28
29 static inline uint16_t __get_unaligned_be16(const uint8_t *p)
30 diff --git a/tools/include/tools/le_byteshift.h b/tools/include/tools/le_byteshift.h
31 index 8fe9f2488ec7..2e387b5226d9 100644
32 --- a/tools/include/tools/le_byteshift.h
33 +++ b/tools/include/tools/le_byteshift.h
34 @@ -1,6 +1,10 @@
35 #ifndef _TOOLS_LE_BYTESHIFT_H
36 #define _TOOLS_LE_BYTESHIFT_H
37
38 +#ifndef __linux__
39 +#include "linux_types.h"
40 +#endif
41 +
42 #include <stdint.h>
43
44 static inline uint16_t __get_unaligned_le16(const uint8_t *p)
45 diff --git a/tools/include/tools/linux_types.h b/tools/include/tools/linux_types.h
46 new file mode 100644
47 index 000000000000..f07ef8293ebc
48 --- /dev/null
49 +++ b/tools/include/tools/linux_types.h
50 @@ -0,0 +1,22 @@
51 +#ifndef __LINUX_TYPES_H
52 +#define __LINUX_TYPES_H
53 +
54 +#include <stdint.h>
55 +
56 +typedef uint8_t __u8;
57 +typedef uint8_t __be8;
58 +typedef uint8_t __le8;
59 +
60 +typedef uint16_t __u16;
61 +typedef uint16_t __be16;
62 +typedef uint16_t __le16;
63 +
64 +typedef uint32_t __u32;
65 +typedef uint32_t __be32;
66 +typedef uint32_t __le32;
67 +
68 +typedef uint64_t __u64;
69 +typedef uint64_t __be64;
70 +typedef uint64_t __le64;
71 +
72 +#endif
73 --
74 2.11.0
75