kernel: generic: Add kernel 4.14 support
[openwrt/openwrt.git] / target / linux / generic / hack-4.14 / 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 --- a/tools/include/tools/be_byteshift.h
16 +++ b/tools/include/tools/be_byteshift.h
17 @@ -2,6 +2,10 @@
18 #ifndef _TOOLS_BE_BYTESHIFT_H
19 #define _TOOLS_BE_BYTESHIFT_H
20
21 +#ifndef __linux__
22 +#include "linux_types.h"
23 +#endif
24 +
25 #include <stdint.h>
26
27 static inline uint16_t __get_unaligned_be16(const uint8_t *p)
28 --- a/tools/include/tools/le_byteshift.h
29 +++ b/tools/include/tools/le_byteshift.h
30 @@ -2,6 +2,10 @@
31 #ifndef _TOOLS_LE_BYTESHIFT_H
32 #define _TOOLS_LE_BYTESHIFT_H
33
34 +#ifndef __linux__
35 +#include "linux_types.h"
36 +#endif
37 +
38 #include <stdint.h>
39
40 static inline uint16_t __get_unaligned_le16(const uint8_t *p)
41 --- /dev/null
42 +++ b/tools/include/tools/linux_types.h
43 @@ -0,0 +1,22 @@
44 +#ifndef __LINUX_TYPES_H
45 +#define __LINUX_TYPES_H
46 +
47 +#include <stdint.h>
48 +
49 +typedef uint8_t __u8;
50 +typedef uint8_t __be8;
51 +typedef uint8_t __le8;
52 +
53 +typedef uint16_t __u16;
54 +typedef uint16_t __be16;
55 +typedef uint16_t __le16;
56 +
57 +typedef uint32_t __u32;
58 +typedef uint32_t __be32;
59 +typedef uint32_t __le32;
60 +
61 +typedef uint64_t __u64;
62 +typedef uint64_t __be64;
63 +typedef uint64_t __le64;
64 +
65 +#endif