Skip to content

Commit d944c4e

Browse files
suryasaimadhuolsajiri
authored andcommitted
tools: Consolidate types.h
Combine all definitions into a common tools/include/linux/types.h and kill the wild growth elsewhere. Move DECLARE_BITMAP to its proper bitmap.h header. Signed-off-by: Borislav Petkov <bp@suse.de> Acked-by: Rusty Russell <rusty@rustcorp.com.au> Link: http://lkml.kernel.org/n/tip-azczs7qcv6h9xek9od10hiv2@git.kernel.org Signed-off-by: Jiri Olsa <jolsa@kernel.org>
1 parent 5ac3e4b commit d944c4e

42 files changed

Lines changed: 63 additions & 139 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,19 +1,32 @@
1-
#ifndef _LIBLOCKDEP_LINUX_TYPES_H_
2-
#define _LIBLOCKDEP_LINUX_TYPES_H_
1+
#ifndef _TOOLS_LINUX_TYPES_H_
2+
#define _TOOLS_LINUX_TYPES_H_
33

44
#include <stdbool.h>
55
#include <stddef.h>
6+
#include <stdint.h>
67

78
#define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */
89
#include <asm/types.h>
910

1011
struct page;
1112
struct kmem_cache;
1213

13-
typedef unsigned gfp_t;
14+
typedef enum {
15+
GFP_KERNEL,
16+
GFP_ATOMIC,
17+
__GFP_HIGHMEM,
18+
__GFP_HIGH
19+
} gfp_t;
1420

15-
typedef __u64 u64;
16-
typedef __s64 s64;
21+
/*
22+
* We define u64 as uint64_t for every architecture
23+
* so that we can print it with "%"PRIx64 without getting warnings.
24+
*
25+
* typedef __u64 u64;
26+
* typedef __s64 s64;
27+
*/
28+
typedef uint64_t u64;
29+
typedef int64_t s64;
1730

1831
typedef __u32 u32;
1932
typedef __s32 s32;
@@ -35,6 +48,10 @@ typedef __s8 s8;
3548
#define __bitwise
3649
#endif
3750

51+
#define __force
52+
#define __user
53+
#define __must_check
54+
#define __cold
3855

3956
typedef __u16 __bitwise __le16;
4057
typedef __u16 __bitwise __be16;
@@ -55,4 +72,4 @@ struct hlist_node {
5572
struct hlist_node *next, **pprev;
5673
};
5774

58-
#endif
75+
#endif /* _TOOLS_LINUX_TYPES_H_ */

‎tools/perf/MANIFEST‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ tools/include/asm/bug.h
88
tools/include/linux/compiler.h
99
tools/include/linux/hash.h
1010
tools/include/linux/export.h
11+
tools/include/linux/types.h
1112
include/linux/const.h
1213
include/linux/perf_event.h
1314
include/linux/rbtree.h

‎tools/perf/Makefile.perf‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ LIB_H += util/include/linux/poison.h
227227
LIB_H += util/include/linux/rbtree.h
228228
LIB_H += util/include/linux/rbtree_augmented.h
229229
LIB_H += util/include/linux/string.h
230-
LIB_H += util/include/linux/types.h
230+
LIB_H += ../include/linux/types.h
231231
LIB_H += util/include/linux/linkage.h
232232
LIB_H += util/include/asm/asm-offsets.h
233233
LIB_H += ../include/asm/bug.h
@@ -252,7 +252,6 @@ LIB_H += util/event.h
252252
LIB_H += util/evsel.h
253253
LIB_H += util/evlist.h
254254
LIB_H += util/exec_cmd.h
255-
LIB_H += util/types.h
256255
LIB_H += util/levenshtein.h
257256
LIB_H += util/machine.h
258257
LIB_H += util/map.h

‎tools/perf/arch/x86/include/perf_regs.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
#define ARCH_PERF_REGS_H
33

44
#include <stdlib.h>
5-
#include "../../util/types.h"
5+
#include <linux/types.h>
66
#include <asm/perf_regs.h>
77

88
void perf_regs_load(u64 *regs);

‎tools/perf/arch/x86/util/tsc.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
#include <linux/perf_event.h>
55

66
#include "../../perf.h"
7-
#include "../../util/types.h"
7+
#include <linux/types.h>
88
#include "../../util/debug.h"
99
#include "tsc.h"
1010

‎tools/perf/arch/x86/util/tsc.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#ifndef TOOLS_PERF_ARCH_X86_UTIL_TSC_H__
22
#define TOOLS_PERF_ARCH_X86_UTIL_TSC_H__
33

4-
#include "../../util/types.h"
4+
#include <linux/types.h>
55

66
struct perf_tsc_conversion {
77
u16 time_shift;

‎tools/perf/perf.h‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -173,9 +173,8 @@
173173
#include <sys/types.h>
174174
#include <sys/syscall.h>
175175

176+
#include <linux/types.h>
176177
#include <linux/perf_event.h>
177-
#include "util/types.h"
178-
#include <stdbool.h>
179178

180179
/*
181180
* prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
@@ -202,7 +201,6 @@ static inline unsigned long long rdclock(void)
202201
/*
203202
* Pick up some kernel type conventions:
204203
*/
205-
#define __user
206204
#define asmlinkage
207205

208206
#define unlikely(x) __builtin_expect(!!(x), 0)

‎tools/perf/tests/attr.c‎

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
/*
32
* The struct perf_event_attr test support.
43
*
@@ -19,14 +18,8 @@
1918
* permissions. All the event text files are stored there.
2019
*/
2120

22-
/*
23-
* Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
24-
* 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
25-
*/
26-
#define __SANE_USERSPACE_TYPES__
2721
#include <stdlib.h>
2822
#include <stdio.h>
29-
#include <inttypes.h>
3023
#include <linux/types.h>
3124
#include <linux/kernel.h>
3225
#include "../perf.h"

‎tools/perf/tests/code-reading.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
1-
#include <sys/types.h>
1+
#include <linux/types.h>
22
#include <stdlib.h>
33
#include <unistd.h>
44
#include <stdio.h>
5-
#include <inttypes.h>
65
#include <ctype.h>
76
#include <string.h>
87

‎tools/perf/tests/dso-data.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
#include "util.h"
22

33
#include <stdlib.h>
4-
#include <sys/types.h>
4+
#include <linux/types.h>
55
#include <sys/stat.h>
66
#include <fcntl.h>
77
#include <string.h>

0 commit comments

Comments
 (0)