Skip to content

Commit

Permalink
tools: Consolidate types.h
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Borislav Petkov authored and Jiri Olsa committed May 1, 2014
1 parent 5ac3e4b commit d944c4e
Show file tree
Hide file tree
Showing 42 changed files with 63 additions and 139 deletions.
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
#ifndef _LIBLOCKDEP_LINUX_TYPES_H_
#define _LIBLOCKDEP_LINUX_TYPES_H_
#ifndef _TOOLS_LINUX_TYPES_H_
#define _TOOLS_LINUX_TYPES_H_

#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>

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

struct page;
struct kmem_cache;

typedef unsigned gfp_t;
typedef enum {
GFP_KERNEL,
GFP_ATOMIC,
__GFP_HIGHMEM,
__GFP_HIGH
} gfp_t;

typedef __u64 u64;
typedef __s64 s64;
/*
* We define u64 as uint64_t for every architecture
* so that we can print it with "%"PRIx64 without getting warnings.
*
* typedef __u64 u64;
* typedef __s64 s64;
*/
typedef uint64_t u64;
typedef int64_t s64;

typedef __u32 u32;
typedef __s32 s32;
Expand All @@ -35,6 +48,10 @@ typedef __s8 s8;
#define __bitwise
#endif

#define __force
#define __user
#define __must_check
#define __cold

typedef __u16 __bitwise __le16;
typedef __u16 __bitwise __be16;
Expand All @@ -55,4 +72,4 @@ struct hlist_node {
struct hlist_node *next, **pprev;
};

#endif
#endif /* _TOOLS_LINUX_TYPES_H_ */
1 change: 1 addition & 0 deletions tools/perf/MANIFEST
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ tools/include/asm/bug.h
tools/include/linux/compiler.h
tools/include/linux/hash.h
tools/include/linux/export.h
tools/include/linux/types.h
include/linux/const.h
include/linux/perf_event.h
include/linux/rbtree.h
Expand Down
3 changes: 1 addition & 2 deletions tools/perf/Makefile.perf
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,7 @@ LIB_H += util/include/linux/poison.h
LIB_H += util/include/linux/rbtree.h
LIB_H += util/include/linux/rbtree_augmented.h
LIB_H += util/include/linux/string.h
LIB_H += util/include/linux/types.h
LIB_H += ../include/linux/types.h
LIB_H += util/include/linux/linkage.h
LIB_H += util/include/asm/asm-offsets.h
LIB_H += ../include/asm/bug.h
Expand All @@ -252,7 +252,6 @@ LIB_H += util/event.h
LIB_H += util/evsel.h
LIB_H += util/evlist.h
LIB_H += util/exec_cmd.h
LIB_H += util/types.h
LIB_H += util/levenshtein.h
LIB_H += util/machine.h
LIB_H += util/map.h
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/x86/include/perf_regs.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define ARCH_PERF_REGS_H

#include <stdlib.h>
#include "../../util/types.h"
#include <linux/types.h>
#include <asm/perf_regs.h>

void perf_regs_load(u64 *regs);
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/x86/util/tsc.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <linux/perf_event.h>

#include "../../perf.h"
#include "../../util/types.h"
#include <linux/types.h>
#include "../../util/debug.h"
#include "tsc.h"

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/arch/x86/util/tsc.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef TOOLS_PERF_ARCH_X86_UTIL_TSC_H__
#define TOOLS_PERF_ARCH_X86_UTIL_TSC_H__

#include "../../util/types.h"
#include <linux/types.h>

struct perf_tsc_conversion {
u16 time_shift;
Expand Down
4 changes: 1 addition & 3 deletions tools/perf/perf.h
Original file line number Diff line number Diff line change
Expand Up @@ -173,9 +173,8 @@
#include <sys/types.h>
#include <sys/syscall.h>

#include <linux/types.h>
#include <linux/perf_event.h>
#include "util/types.h"
#include <stdbool.h>

/*
* prctl(PR_TASK_PERF_EVENTS_DISABLE) will (cheaply) disable all
Expand All @@ -202,7 +201,6 @@ static inline unsigned long long rdclock(void)
/*
* Pick up some kernel type conventions:
*/
#define __user
#define asmlinkage

#define unlikely(x) __builtin_expect(!!(x), 0)
Expand Down
7 changes: 0 additions & 7 deletions tools/perf/tests/attr.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

/*
* The struct perf_event_attr test support.
*
Expand All @@ -19,14 +18,8 @@
* permissions. All the event text files are stored there.
*/

/*
* Powerpc needs __SANE_USERSPACE_TYPES__ before <linux/types.h> to select
* 'int-ll64.h' and avoid compile warnings when printing __u64 with %llu.
*/
#define __SANE_USERSPACE_TYPES__
#include <stdlib.h>
#include <stdio.h>
#include <inttypes.h>
#include <linux/types.h>
#include <linux/kernel.h>
#include "../perf.h"
Expand Down
3 changes: 1 addition & 2 deletions tools/perf/tests/code-reading.c
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
#include <sys/types.h>
#include <linux/types.h>
#include <stdlib.h>
#include <unistd.h>
#include <stdio.h>
#include <inttypes.h>
#include <ctype.h>
#include <string.h>

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/tests/dso-data.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#include "util.h"

#include <stdlib.h>
#include <sys/types.h>
#include <linux/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <string.h>
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/tests/dwarf-unwind.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <linux/compiler.h>
#include <sys/types.h>
#include <linux/types.h>
#include <unistd.h>
#include "tests.h"
#include "debug.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/tests/keep-tracking.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <sys/types.h>
#include <linux/types.h>
#include <unistd.h>
#include <sys/prctl.h>

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/tests/parse-no-sample-id-all.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include <sys/types.h>
#include <linux/types.h>
#include <stddef.h>

#include "tests.h"
Expand Down
3 changes: 1 addition & 2 deletions tools/perf/tests/perf-time-to-tsc.c
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <inttypes.h>
#include <linux/types.h>
#include <sys/prctl.h>

#include "parse-events.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/tests/rdpmc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#include <stdlib.h>
#include <signal.h>
#include <sys/mman.h>
#include "types.h"
#include <linux/types.h>
#include "perf.h"
#include "debug.h"
#include "tests.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/tests/sample-parsing.c
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#include <stdbool.h>
#include <inttypes.h>
#include <linux/types.h>

#include "util.h"
#include "event.h"
Expand Down
4 changes: 1 addition & 3 deletions tools/perf/ui/browser.h
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
#ifndef _PERF_UI_BROWSER_H_
#define _PERF_UI_BROWSER_H_ 1

#include <stdbool.h>
#include <sys/types.h>
#include "../types.h"
#include <linux/types.h>

#define HE_COLORSET_TOP 50
#define HE_COLORSET_MEDIUM 51
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/ui/progress.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef _PERF_UI_PROGRESS_H_
#define _PERF_UI_PROGRESS_H_ 1

#include <../types.h>
#include <linux/types.h>

void ui_progress__finish(void);

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/annotate.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

#include <stdbool.h>
#include <stdint.h>
#include "types.h"
#include <linux/types.h>
#include "symbol.h"
#include "hist.h"
#include "sort.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/build-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#define BUILD_ID_SIZE 20

#include "tool.h"
#include "types.h"
#include <linux/types.h>

extern struct perf_tool build_id__mark_dso_hit_ops;
struct dso;
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/dso.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#include <linux/types.h>
#include <linux/rbtree.h>
#include <stdbool.h>
#include "types.h"
#include <linux/types.h>
#include "map.h"
#include "build-id.h"

Expand Down
4 changes: 2 additions & 2 deletions tools/perf/util/evsel.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@
#include <stdbool.h>
#include <stddef.h>
#include <linux/perf_event.h>
#include "types.h"
#include <linux/types.h>
#include "xyarray.h"
#include "cgroup.h"
#include "hist.h"
#include "symbol.h"

struct perf_counts_values {
union {
struct {
Expand Down
4 changes: 2 additions & 2 deletions tools/perf/util/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@
#include <linux/perf_event.h>
#include <sys/types.h>
#include <stdbool.h>
#include "types.h"
#include <linux/bitmap.h>
#include <linux/types.h>
#include "event.h"

#include <linux/bitmap.h>

enum {
HEADER_RESERVED = 0, /* always cleared */
Expand Down
3 changes: 3 additions & 0 deletions tools/perf/util/include/linux/bitmap.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@
#include <string.h>
#include <linux/bitops.h>

#define DECLARE_BITMAP(name,bits) \
unsigned long name[BITS_TO_LONGS(bits)]

int __bitmap_weight(const unsigned long *bitmap, int bits);
void __bitmap_or(unsigned long *dst, const unsigned long *bitmap1,
const unsigned long *bitmap2, int bits);
Expand Down
1 change: 1 addition & 0 deletions tools/perf/util/include/linux/list.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#include <linux/kernel.h>
#include <linux/types.h>

#include "../../../../include/linux/list.h"

Expand Down
29 changes: 0 additions & 29 deletions tools/perf/util/include/linux/types.h

This file was deleted.

2 changes: 1 addition & 1 deletion tools/perf/util/map.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
#include <linux/rbtree.h>
#include <stdio.h>
#include <stdbool.h>
#include "types.h"
#include <linux/types.h>

enum map_type {
MAP__FUNCTION = 0,
Expand Down
3 changes: 1 addition & 2 deletions tools/perf/util/parse-events.h
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@

#include <linux/list.h>
#include <stdbool.h>
#include "types.h"
#include <linux/types.h>
#include <linux/perf_event.h>
#include "types.h"

struct list_head;
struct perf_evsel;
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/parse-events.y
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

#include <linux/compiler.h>
#include <linux/list.h>
#include "types.h"
#include <linux/types.h>
#include "util.h"
#include "parse-events.h"
#include "parse-events-bison.h"
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/perf_regs.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __PERF_REGS_H
#define __PERF_REGS_H

#include "types.h"
#include <linux/types.h>
#include "event.h"

#ifdef HAVE_PERF_REGS_SUPPORT
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/pmu.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __PMU_H
#define __PMU_H

#include <linux/bitops.h>
#include <linux/bitmap.h>
#include <linux/perf_event.h>
#include <stdbool.h>

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/stat.h
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#ifndef __PERF_STATS_H
#define __PERF_STATS_H

#include "types.h"
#include <linux/types.h>

struct stats
{
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/svghelper.c
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <linux/bitops.h>
#include <linux/bitmap.h>

#include "perf.h"
#include "svghelper.h"
Expand Down
Loading

0 comments on commit d944c4e

Please sign in to comment.