hc
2023-12-09 b22da3d8526a935aa31e086e63f60ff3246cb61c
kernel/tools/perf/util/bpf-loader.h
....@@ -8,11 +8,7 @@
88
99 #include <linux/compiler.h>
1010 #include <linux/err.h>
11
-#include <string.h>
1211 #include <bpf/libbpf.h>
13
-#include "probe-event.h"
14
-#include "evlist.h"
15
-#include "debug.h"
1612
1713 enum bpf_loader_errno {
1814 __BPF_LOADER_ERRNO__START = __LIBBPF_ERRNO__START - 100,
....@@ -43,13 +39,14 @@
4339 __BPF_LOADER_ERRNO__END,
4440 };
4541
46
-struct perf_evsel;
42
+struct evsel;
43
+struct evlist;
4744 struct bpf_object;
4845 struct parse_events_term;
4946 #define PERF_BPF_PROBE_GROUP "perf_bpf_probe"
5047
5148 typedef int (*bpf_prog_iter_callback_t)(const char *group, const char *event,
52
- int fd, void *arg);
49
+ int fd, struct bpf_object *obj, void *arg);
5350
5451 #ifdef HAVE_LIBBPF_SUPPORT
5552 struct bpf_object *bpf__prepare_load(const char *filename, bool source);
....@@ -73,20 +70,22 @@
7370 bpf_prog_iter_callback_t func, void *arg);
7471
7572 int bpf__config_obj(struct bpf_object *obj, struct parse_events_term *term,
76
- struct perf_evlist *evlist, int *error_pos);
73
+ struct evlist *evlist, int *error_pos);
7774 int bpf__strerror_config_obj(struct bpf_object *obj,
7875 struct parse_events_term *term,
79
- struct perf_evlist *evlist,
76
+ struct evlist *evlist,
8077 int *error_pos, int err, char *buf,
8178 size_t size);
8279 int bpf__apply_obj_config(void);
8380 int bpf__strerror_apply_obj_config(int err, char *buf, size_t size);
8481
85
-int bpf__setup_stdout(struct perf_evlist *evlist);
86
-struct perf_evsel *bpf__setup_output_event(struct perf_evlist *evlist, const char *name);
87
-int bpf__strerror_setup_output_event(struct perf_evlist *evlist, int err, char *buf, size_t size);
82
+int bpf__setup_stdout(struct evlist *evlist);
83
+struct evsel *bpf__setup_output_event(struct evlist *evlist, const char *name);
84
+int bpf__strerror_setup_output_event(struct evlist *evlist, int err, char *buf, size_t size);
8885 #else
8986 #include <errno.h>
87
+#include <string.h>
88
+#include "debug.h"
9089
9190 static inline struct bpf_object *
9291 bpf__prepare_load(const char *filename __maybe_unused,
....@@ -120,7 +119,7 @@
120119 static inline int
121120 bpf__config_obj(struct bpf_object *obj __maybe_unused,
122121 struct parse_events_term *term __maybe_unused,
123
- struct perf_evlist *evlist __maybe_unused,
122
+ struct evlist *evlist __maybe_unused,
124123 int *error_pos __maybe_unused)
125124 {
126125 return 0;
....@@ -133,13 +132,13 @@
133132 }
134133
135134 static inline int
136
-bpf__setup_stdout(struct perf_evlist *evlist __maybe_unused)
135
+bpf__setup_stdout(struct evlist *evlist __maybe_unused)
137136 {
138137 return 0;
139138 }
140139
141
-static inline struct perf_evsel *
142
-bpf__setup_output_event(struct perf_evlist *evlist __maybe_unused, const char *name __maybe_unused)
140
+static inline struct evsel *
141
+bpf__setup_output_event(struct evlist *evlist __maybe_unused, const char *name __maybe_unused)
143142 {
144143 return NULL;
145144 }
....@@ -183,7 +182,7 @@
183182 static inline int
184183 bpf__strerror_config_obj(struct bpf_object *obj __maybe_unused,
185184 struct parse_events_term *term __maybe_unused,
186
- struct perf_evlist *evlist __maybe_unused,
185
+ struct evlist *evlist __maybe_unused,
187186 int *error_pos __maybe_unused,
188187 int err __maybe_unused,
189188 char *buf, size_t size)
....@@ -199,7 +198,7 @@
199198 }
200199
201200 static inline int
202
-bpf__strerror_setup_output_event(struct perf_evlist *evlist __maybe_unused,
201
+bpf__strerror_setup_output_event(struct evlist *evlist __maybe_unused,
203202 int err __maybe_unused, char *buf, size_t size)
204203 {
205204 return __bpf_strerror(buf, size);
....@@ -207,7 +206,7 @@
207206
208207 #endif
209208
210
-static inline int bpf__strerror_setup_stdout(struct perf_evlist *evlist, int err, char *buf, size_t size)
209
+static inline int bpf__strerror_setup_stdout(struct evlist *evlist, int err, char *buf, size_t size)
211210 {
212211 return bpf__strerror_setup_output_event(evlist, err, buf, size);
213212 }