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: fix portability of some includes files in tools/ used on the host
6 Signed-off-by: Felix Fietkau <nbd@nbd.name>
8 tools/include/tools/be_byteshift.h | 4 ++++
9 tools/include/tools/le_byteshift.h | 4 ++++
10 tools/include/tools/linux_types.h | 22 ++++++++++++++++++++++
11 3 files changed, 30 insertions(+)
12 create mode 100644 tools/include/tools/linux_types.h
14 --- a/tools/include/tools/be_byteshift.h
15 +++ b/tools/include/tools/be_byteshift.h
17 #ifndef _TOOLS_BE_BYTESHIFT_H
18 #define _TOOLS_BE_BYTESHIFT_H
21 +#include "linux_types.h"
26 static inline uint16_t __get_unaligned_be16(const uint8_t *p)
27 --- a/tools/include/tools/le_byteshift.h
28 +++ b/tools/include/tools/le_byteshift.h
30 #ifndef _TOOLS_LE_BYTESHIFT_H
31 #define _TOOLS_LE_BYTESHIFT_H
34 +#include "linux_types.h"
39 static inline uint16_t __get_unaligned_le16(const uint8_t *p)
41 +++ b/tools/include/tools/linux_types.h
43 +#ifndef __LINUX_TYPES_H
44 +#define __LINUX_TYPES_H
49 +typedef uint8_t __u8;
50 +typedef uint8_t __be8;
51 +typedef uint8_t __le8;
53 +typedef int16_t __s16;
54 +typedef uint16_t __u16;
55 +typedef uint16_t __be16;
56 +typedef uint16_t __le16;
58 +typedef int32_t __s32;
59 +typedef uint32_t __u32;
60 +typedef uint32_t __be32;
61 +typedef uint32_t __le32;
63 +typedef int64_t __s64;
64 +typedef uint64_t __u64;
65 +typedef uint64_t __be64;
66 +typedef uint64_t __le64;
69 --- a/tools/include/linux/types.h
70 +++ b/tools/include/linux/types.h
72 #define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
76 +#include <tools/linux_types.h>
78 #include <asm/types.h>
79 #include <asm/posix_types.h>
84 --- a/tools/perf/pmu-events/jevents.c
85 +++ b/tools/perf/pmu-events/jevents.c
88 #define _XOPEN_SOURCE 500 /* needed for nftw() */
90 #define _GNU_SOURCE /* needed for asprintf() */
92 /* Parse event JSON files */
101 --- a/tools/perf/pmu-events/json.c
102 +++ b/tools/perf/pmu-events/json.c
107 -#include <linux/kernel.h>
110 static char *mapfile(const char *fn, size_t *size)