Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Borislav Petkov and committed by
Jiri Olsa
d944c4ee 5ac3e4b6

+63 -139
+23 -6
tools/lib/lockdep/uinclude/linux/types.h tools/include/linux/types.h
··· 1 - #ifndef _LIBLOCKDEP_LINUX_TYPES_H_ 2 - #define _LIBLOCKDEP_LINUX_TYPES_H_ 1 + #ifndef _TOOLS_LINUX_TYPES_H_ 2 + #define _TOOLS_LINUX_TYPES_H_ 3 3 4 4 #include <stdbool.h> 5 5 #include <stddef.h> 6 + #include <stdint.h> 6 7 7 8 #define __SANE_USERSPACE_TYPES__ /* For PPC64, to get LL64 types */ 8 9 #include <asm/types.h> ··· 11 10 struct page; 12 11 struct kmem_cache; 13 12 14 - typedef unsigned gfp_t; 13 + typedef enum { 14 + GFP_KERNEL, 15 + GFP_ATOMIC, 16 + __GFP_HIGHMEM, 17 + __GFP_HIGH 18 + } gfp_t; 15 19 16 - typedef __u64 u64; 17 - typedef __s64 s64; 20 + /* 21 + * We define u64 as uint64_t for every architecture 22 + * so that we can print it with "%"PRIx64 without getting warnings. 23 + * 24 + * typedef __u64 u64; 25 + * typedef __s64 s64; 26 + */ 27 + typedef uint64_t u64; 28 + typedef int64_t s64; 18 29 19 30 typedef __u32 u32; 20 31 typedef __s32 s32; ··· 48 35 #define __bitwise 49 36 #endif 50 37 38 + #define __force 39 + #define __user 40 + #define __must_check 41 + #define __cold 51 42 52 43 typedef __u16 __bitwise __le16; 53 44 typedef __u16 __bitwise __be16; ··· 72 55 struct hlist_node *next, **pprev; 73 56 }; 74 57 75 - #endif 58 + #endif /* _TOOLS_LINUX_TYPES_H_ */
+1
tools/perf/MANIFEST
··· 8 8 tools/include/linux/compiler.h 9 9 tools/include/linux/hash.h 10 10 tools/include/linux/export.h 11 + tools/include/linux/types.h 11 12 include/linux/const.h 12 13 include/linux/perf_event.h 13 14 include/linux/rbtree.h
+1 -2
tools/perf/Makefile.perf
··· 227 227 LIB_H += util/include/linux/rbtree.h 228 228 LIB_H += util/include/linux/rbtree_augmented.h 229 229 LIB_H += util/include/linux/string.h 230 - LIB_H += util/include/linux/types.h 230 + LIB_H += ../include/linux/types.h 231 231 LIB_H += util/include/linux/linkage.h 232 232 LIB_H += util/include/asm/asm-offsets.h 233 233 LIB_H += ../include/asm/bug.h ··· 252 252 LIB_H += util/evsel.h 253 253 LIB_H += util/evlist.h 254 254 LIB_H += util/exec_cmd.h 255 - LIB_H += util/types.h 256 255 LIB_H += util/levenshtein.h 257 256 LIB_H += util/machine.h 258 257 LIB_H += util/map.h
+1 -1
tools/perf/arch/x86/include/perf_regs.h
··· 2 2 #define ARCH_PERF_REGS_H 3 3 4 4 #include <stdlib.h> 5 - #include "../../util/types.h" 5 + #include <linux/types.h> 6 6 #include <asm/perf_regs.h> 7 7 8 8 void perf_regs_load(u64 *regs);
+1 -1
tools/perf/arch/x86/util/tsc.c
··· 4 4 #include <linux/perf_event.h> 5 5 6 6 #include "../../perf.h" 7 - #include "../../util/types.h" 7 + #include <linux/types.h> 8 8 #include "../../util/debug.h" 9 9 #include "tsc.h" 10 10
+1 -1
tools/perf/arch/x86/util/tsc.h
··· 1 1 #ifndef TOOLS_PERF_ARCH_X86_UTIL_TSC_H__ 2 2 #define TOOLS_PERF_ARCH_X86_UTIL_TSC_H__ 3 3 4 - #include "../../util/types.h" 4 + #include <linux/types.h> 5 5 6 6 struct perf_tsc_conversion { 7 7 u16 time_shift;
+1 -3
tools/perf/perf.h
··· 173 173 #include <sys/types.h> 174 174 #include <sys/syscall.h> 175 175 176 + #include <linux/types.h> 176 177 #include <linux/perf_event.h> 177 - #include "util/types.h" 178 - #include <stdbool.h> 179 178 180 179 /* 181 180 * prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all ··· 201 202 /* 202 203 * Pick up some kernel type conventions: 203 204 */ 204 - #define __user 205 205 #define asmlinkage 206 206 207 207 #define unlikely(x) __builtin_expect(!!(x), 0)
-7
tools/perf/tests/attr.c
··· 1 - 2 1 /* 3 2 * The struct perf_event_attr test support. 4 3 * ··· 18 19 * permissions. All the event text files are stored there. 19 20 */ 20 21 21 - /* 22 - * Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select 23 - * 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu. 24 - */ 25 - #define __SANE_USERSPACE_TYPES__ 26 22 #include <stdlib.h> 27 23 #include <stdio.h> 28 - #include <inttypes.h> 29 24 #include <linux/types.h> 30 25 #include <linux/kernel.h> 31 26 #include "../perf.h"
+1 -2
tools/perf/tests/code-reading.c
··· 1 - #include <sys/types.h> 1 + #include <linux/types.h> 2 2 #include <stdlib.h> 3 3 #include <unistd.h> 4 4 #include <stdio.h> 5 - #include <inttypes.h> 6 5 #include <ctype.h> 7 6 #include <string.h> 8 7
+1 -1
tools/perf/tests/dso-data.c
··· 1 1 #include "util.h" 2 2 3 3 #include <stdlib.h> 4 - #include <sys/types.h> 4 + #include <linux/types.h> 5 5 #include <sys/stat.h> 6 6 #include <fcntl.h> 7 7 #include <string.h>
+1 -1
tools/perf/tests/dwarf-unwind.c
··· 1 1 #include <linux/compiler.h> 2 - #include <sys/types.h> 2 + #include <linux/types.h> 3 3 #include <unistd.h> 4 4 #include "tests.h" 5 5 #include "debug.h"
+1 -1
tools/perf/tests/keep-tracking.c
··· 1 - #include <sys/types.h> 1 + #include <linux/types.h> 2 2 #include <unistd.h> 3 3 #include <sys/prctl.h> 4 4
+1 -1
tools/perf/tests/parse-no-sample-id-all.c
··· 1 - #include <sys/types.h> 1 + #include <linux/types.h> 2 2 #include <stddef.h> 3 3 4 4 #include "tests.h"
+1 -2
tools/perf/tests/perf-time-to-tsc.c
··· 1 1 #include <stdio.h> 2 - #include <sys/types.h> 3 2 #include <unistd.h> 4 - #include <inttypes.h> 3 + #include <linux/types.h> 5 4 #include <sys/prctl.h> 6 5 7 6 #include "parse-events.h"
+1 -1
tools/perf/tests/rdpmc.c
··· 2 2 #include <stdlib.h> 3 3 #include <signal.h> 4 4 #include <sys/mman.h> 5 - #include "types.h" 5 + #include <linux/types.h> 6 6 #include "perf.h" 7 7 #include "debug.h" 8 8 #include "tests.h"
+1 -1
tools/perf/tests/sample-parsing.c
··· 1 1 #include <stdbool.h> 2 - #include <inttypes.h> 2 + #include <linux/types.h> 3 3 4 4 #include "util.h" 5 5 #include "event.h"
+1 -3
tools/perf/ui/browser.h
··· 1 1 #ifndef _PERF_UI_BROWSER_H_ 2 2 #define _PERF_UI_BROWSER_H_ 1 3 3 4 - #include <stdbool.h> 5 - #include <sys/types.h> 6 - #include "../types.h" 4 + #include <linux/types.h> 7 5 8 6 #define HE_COLORSET_TOP 50 9 7 #define HE_COLORSET_MEDIUM 51
+1 -1
tools/perf/ui/progress.h
··· 1 1 #ifndef _PERF_UI_PROGRESS_H_ 2 2 #define _PERF_UI_PROGRESS_H_ 1 3 3 4 - #include <../types.h> 4 + #include <linux/types.h> 5 5 6 6 void ui_progress__finish(void); 7 7
+1 -1
tools/perf/util/annotate.h
··· 3 3 4 4 #include <stdbool.h> 5 5 #include <stdint.h> 6 - #include "types.h" 6 + #include <linux/types.h> 7 7 #include "symbol.h" 8 8 #include "hist.h" 9 9 #include "sort.h"
+1 -1
tools/perf/util/build-id.h
··· 4 4 #define BUILD_ID_SIZE 20 5 5 6 6 #include "tool.h" 7 - #include "types.h" 7 + #include <linux/types.h> 8 8 9 9 extern struct perf_tool build_id__mark_dso_hit_ops; 10 10 struct dso;
+1 -1
tools/perf/util/dso.h
··· 4 4 #include <linux/types.h> 5 5 #include <linux/rbtree.h> 6 6 #include <stdbool.h> 7 - #include "types.h" 7 + #include <linux/types.h> 8 8 #include "map.h" 9 9 #include "build-id.h" 10 10
+2 -2
tools/perf/util/evsel.h
··· 5 5 #include <stdbool.h> 6 6 #include <stddef.h> 7 7 #include <linux/perf_event.h> 8 - #include "types.h" 8 + #include <linux/types.h> 9 9 #include "xyarray.h" 10 10 #include "cgroup.h" 11 11 #include "hist.h" 12 12 #include "symbol.h" 13 - 13 + 14 14 struct perf_counts_values { 15 15 union { 16 16 struct {
+2 -2
tools/perf/util/header.h
··· 4 4 #include <linux/perf_event.h> 5 5 #include <sys/types.h> 6 6 #include <stdbool.h> 7 - #include "types.h" 7 + #include <linux/bitmap.h> 8 + #include <linux/types.h> 8 9 #include "event.h" 9 10 10 - #include <linux/bitmap.h> 11 11 12 12 enum { 13 13 HEADER_RESERVED = 0, /* always cleared */
+3
tools/perf/util/include/linux/bitmap.h
··· 4 4 #include <string.h> 5 5 #include <linux/bitops.h> 6 6 7 + #define DECLARE_BITMAP(name,bits) \ 8 + unsigned long name[BITS_TO_LONGS(bits)] 9 + 7 10 int __bitmap_weight(const unsigned long *bitmap, int bits); 8 11 void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1, 9 12 const unsigned long *bitmap2, int bits);
+1
tools/perf/util/include/linux/list.h
··· 1 1 #include <linux/kernel.h> 2 + #include <linux/types.h> 2 3 3 4 #include "../../../../include/linux/list.h" 4 5
-29
tools/perf/util/include/linux/types.h
··· 1 - #ifndef _PERF_LINUX_TYPES_H_ 2 - #define _PERF_LINUX_TYPES_H_ 3 - 4 - #include <asm/types.h> 5 - 6 - #ifndef __bitwise 7 - #define __bitwise 8 - #endif 9 - 10 - #ifndef __le32 11 - typedef __u32 __bitwise __le32; 12 - #endif 13 - 14 - #define DECLARE_BITMAP(name,bits) \ 15 - unsigned long name[BITS_TO_LONGS(bits)] 16 - 17 - struct list_head { 18 - struct list_head *next, *prev; 19 - }; 20 - 21 - struct hlist_head { 22 - struct hlist_node *first; 23 - }; 24 - 25 - struct hlist_node { 26 - struct hlist_node *next, **pprev; 27 - }; 28 - 29 - #endif
+1 -1
tools/perf/util/map.h
··· 6 6 #include <linux/rbtree.h> 7 7 #include <stdio.h> 8 8 #include <stdbool.h> 9 - #include "types.h" 9 + #include <linux/types.h> 10 10 11 11 enum map_type { 12 12 MAP__FUNCTION = 0,
+1 -2
tools/perf/util/parse-events.h
··· 6 6 7 7 #include <linux/list.h> 8 8 #include <stdbool.h> 9 - #include "types.h" 9 + #include <linux/types.h> 10 10 #include <linux/perf_event.h> 11 - #include "types.h" 12 11 13 12 struct list_head; 14 13 struct perf_evsel;
+1 -1
tools/perf/util/parse-events.y
··· 9 9 10 10 #include <linux/compiler.h> 11 11 #include <linux/list.h> 12 - #include "types.h" 12 + #include <linux/types.h> 13 13 #include "util.h" 14 14 #include "parse-events.h" 15 15 #include "parse-events-bison.h"
+1 -1
tools/perf/util/perf_regs.h
··· 1 1 #ifndef __PERF_REGS_H 2 2 #define __PERF_REGS_H 3 3 4 - #include "types.h" 4 + #include <linux/types.h> 5 5 #include "event.h" 6 6 7 7 #ifdef HAVE_PERF_REGS_SUPPORT
+1 -1
tools/perf/util/pmu.h
··· 1 1 #ifndef __PMU_H 2 2 #define __PMU_H 3 3 4 - #include <linux/bitops.h> 4 + #include <linux/bitmap.h> 5 5 #include <linux/perf_event.h> 6 6 #include <stdbool.h> 7 7
+1 -1
tools/perf/util/stat.h
··· 1 1 #ifndef __PERF_STATS_H 2 2 #define __PERF_STATS_H 3 3 4 - #include "types.h" 4 + #include <linux/types.h> 5 5 6 6 struct stats 7 7 {
+1 -1
tools/perf/util/svghelper.c
··· 17 17 #include <stdlib.h> 18 18 #include <unistd.h> 19 19 #include <string.h> 20 - #include <linux/bitops.h> 20 + #include <linux/bitmap.h> 21 21 22 22 #include "perf.h" 23 23 #include "svghelper.h"
+1 -1
tools/perf/util/svghelper.h
··· 1 1 #ifndef __PERF_SVGHELPER_H 2 2 #define __PERF_SVGHELPER_H 3 3 4 - #include "types.h" 4 + #include <linux/types.h> 5 5 6 6 extern void open_svg(const char *filename, int cpus, int rows, u64 start, u64 end); 7 7 extern void svg_box(int Yslot, u64 start, u64 end, const char *type);
+1 -1
tools/perf/util/top.h
··· 2 2 #define __PERF_TOP_H 1 3 3 4 4 #include "tool.h" 5 - #include "types.h" 5 + #include <linux/types.h> 6 6 #include <stddef.h> 7 7 #include <stdbool.h> 8 8 #include <termios.h>
-19
tools/perf/util/types.h
··· 1 - #ifndef __PERF_TYPES_H 2 - #define __PERF_TYPES_H 3 - 4 - #include <stdint.h> 5 - 6 - /* 7 - * We define u64 as uint64_t for every architecture 8 - * so that we can print it with "%"PRIx64 without getting warnings. 9 - */ 10 - typedef uint64_t u64; 11 - typedef int64_t s64; 12 - typedef unsigned int u32; 13 - typedef signed int s32; 14 - typedef unsigned short u16; 15 - typedef signed short s16; 16 - typedef unsigned char u8; 17 - typedef signed char s8; 18 - 19 - #endif /* __PERF_TYPES_H */
+1 -1
tools/perf/util/unwind-libdw.c
··· 7 7 #include "unwind-libdw.h" 8 8 #include "machine.h" 9 9 #include "thread.h" 10 - #include "types.h" 10 + #include <linux/types.h> 11 11 #include "event.h" 12 12 #include "perf_regs.h" 13 13
+1 -1
tools/perf/util/unwind.h
··· 1 1 #ifndef __UNWIND_H 2 2 #define __UNWIND_H 3 3 4 - #include "types.h" 4 + #include <linux/types.h> 5 5 #include "event.h" 6 6 #include "symbol.h" 7 7
+1 -1
tools/perf/util/util.h
··· 69 69 #include <sys/ioctl.h> 70 70 #include <inttypes.h> 71 71 #include <linux/magic.h> 72 - #include "types.h" 72 + #include <linux/types.h> 73 73 #include <sys/ttydefaults.h> 74 74 #include <api/fs/debugfs.h> 75 75 #include <termios.h>
+1 -1
tools/perf/util/values.h
··· 1 1 #ifndef __PERF_VALUES_H 2 2 #define __PERF_VALUES_H 3 3 4 - #include "types.h" 4 + #include <linux/types.h> 5 5 6 6 struct perf_read_values { 7 7 int threads;
-7
tools/virtio/linux/kernel.h
··· 38 38 39 39 #define __printf(a,b) __attribute__((format(printf,a,b))) 40 40 41 - typedef enum { 42 - GFP_KERNEL, 43 - GFP_ATOMIC, 44 - __GFP_HIGHMEM, 45 - __GFP_HIGH 46 - } gfp_t; 47 - 48 41 #define ARRAY_SIZE(x) (sizeof(x)/sizeof(x[0])) 49 42 50 43 extern void *__kmalloc_fake, *__kfree_ignore_start, *__kfree_ignore_end;
-28
tools/virtio/linux/types.h
··· 1 - #ifndef TYPES_H 2 - #define TYPES_H 3 - #include <stdint.h> 4 - 5 - #define __force 6 - #define __user 7 - #define __must_check 8 - #define __cold 9 - 10 - typedef uint64_t u64; 11 - typedef int64_t s64; 12 - typedef uint32_t u32; 13 - typedef int32_t s32; 14 - typedef uint16_t u16; 15 - typedef int16_t s16; 16 - typedef uint8_t u8; 17 - typedef int8_t s8; 18 - 19 - typedef uint64_t __u64; 20 - typedef int64_t __s64; 21 - typedef uint32_t __u32; 22 - typedef int32_t __s32; 23 - typedef uint16_t __u16; 24 - typedef int16_t __s16; 25 - typedef uint8_t __u8; 26 - typedef int8_t __s8; 27 - 28 - #endif /* TYPES_H */