File libperf-add-perf_cpu_map-struct.patch of Package perf
118
1
From: Jiri Olsa <jolsa@kernel.org>
2
Date: Sun, 21 Jul 2019 13:24:15 +0200
3
Subject: libperf: Add perf_cpu_map struct
4
Git-commit: 959b83c769389b24d64759f60e64c4c62620ff02
5
Patch-mainline: v5.4-rc1
6
References: jsc#SLE-13661
7
8
Add perf_cpu_map struct to libperf.
9
10
It's added as a declaration into:
11
12
include/perf/cpumap.h
13
14
which will be included by users.
15
16
The perf_cpu_map struct definition is added into:
17
18
include/internal/cpumap.h
19
20
which is not to be included by users, but shared within perf and
21
libperf.
22
23
We tried the total separation of the perf_cpu_map struct in libperf, but
24
it lead to complications and much bigger changes in perf code, so we
25
decided to share the declaration.
26
27
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
28
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
29
Cc: Alexey Budankov <alexey.budankov@linux.intel.com>
30
Cc: Andi Kleen <ak@linux.intel.com>
31
Cc: Michael Petlan <mpetlan@redhat.com>
32
Cc: Namhyung Kim <namhyung@kernel.org>
33
Cc: Peter Zijlstra <peterz@infradead.org>
34
Link: http://lkml.kernel.org/r/20190721112506.12306-29-jolsa@kernel.org
35
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
36
Signed-off-by: Tony Jones <tonyj@suse.de>
37
---
38
tools/perf/lib/Build | 1 +
39
tools/perf/lib/cpumap.c | 5 +++++
40
tools/perf/lib/include/internal/cpumap.h | 13 +++++++++++++
41
tools/perf/lib/include/perf/cpumap.h | 7 +++++++
42
tools/perf/util/cpumap.h | 7 +------
43
5 files changed, 27 insertions(+), 6 deletions(-)
44
45
diff --git a/tools/perf/lib/Build b/tools/perf/lib/Build
46
index 5196958cec01..195b274db49a 100644
47
--- a/tools/perf/lib/Build
48
+++ b/tools/perf/lib/Build
49
50
libperf-y += core.o
51
+libperf-y += cpumap.o
52
diff --git a/tools/perf/lib/cpumap.c b/tools/perf/lib/cpumap.c
53
new file mode 100644
54
index 000000000000..86a199c26f20
55
--- /dev/null
56
+++ b/tools/perf/lib/cpumap.c
57
58
+// SPDX-License-Identifier: GPL-2.0-only
59
+#include <perf/cpumap.h>
60
+#include <stdlib.h>
61
+#include <linux/refcount.h>
62
+#include <internal/cpumap.h>
63
diff --git a/tools/perf/lib/include/internal/cpumap.h b/tools/perf/lib/include/internal/cpumap.h
64
new file mode 100644
65
index 000000000000..53ce95374b05
66
--- /dev/null
67
+++ b/tools/perf/lib/include/internal/cpumap.h
68
69
+/* SPDX-License-Identifier: GPL-2.0 */
70
+#ifndef __LIBPERF_INTERNAL_CPUMAP_H
71
+#define __LIBPERF_INTERNAL_CPUMAP_H
72
+
73
+#include <linux/refcount.h>
74
+
75
+struct perf_cpu_map {
76
+ refcount_t refcnt;
77
+ int nr;
78
+ int map[];
79
+};
80
+
81
+#endif /* __LIBPERF_INTERNAL_CPUMAP_H */
82
diff --git a/tools/perf/lib/include/perf/cpumap.h b/tools/perf/lib/include/perf/cpumap.h
83
new file mode 100644
84
index 000000000000..8355d3ce7d0c
85
--- /dev/null
86
+++ b/tools/perf/lib/include/perf/cpumap.h
87
88
+/* SPDX-License-Identifier: GPL-2.0 */
89
+#ifndef __LIBPERF_CPUMAP_H
90
+#define __LIBPERF_CPUMAP_H
91
+
92
+struct perf_cpu_map;
93
+
94
+#endif /* __LIBPERF_CPUMAP_H */
95
diff --git a/tools/perf/util/cpumap.h b/tools/perf/util/cpumap.h
96
index 22729beae959..c2ba9ae195f7 100644
97
--- a/tools/perf/util/cpumap.h
98
+++ b/tools/perf/util/cpumap.h
99
100
#include <stdio.h>
101
#include <stdbool.h>
102
#include <linux/refcount.h>
103
+#include <internal/cpumap.h>
104
105
#include "perf.h"
106
#include "util/debug.h"
107
108
-struct perf_cpu_map {
109
- refcount_t refcnt;
110
- int nr;
111
- int map[];
112
-};
113
-
114
struct perf_cpu_map *cpu_map__new(const char *cpu_list);
115
struct perf_cpu_map *cpu_map__empty_new(int nr);
116
struct perf_cpu_map *cpu_map__dummy_new(void);
117
118