.. | .. |
---|
8 | 8 | |
---|
9 | 9 | #include <linux/compiler.h> |
---|
10 | 10 | #include <linux/err.h> |
---|
11 | | -#include <string.h> |
---|
12 | 11 | #include <bpf/libbpf.h> |
---|
13 | | -#include "probe-event.h" |
---|
14 | | -#include "evlist.h" |
---|
15 | | -#include "debug.h" |
---|
16 | 12 | |
---|
17 | 13 | enum bpf_loader_errno { |
---|
18 | 14 | __BPF_LOADER_ERRNO__START = __LIBBPF_ERRNO__START - 100, |
---|
.. | .. |
---|
43 | 39 | __BPF_LOADER_ERRNO__END, |
---|
44 | 40 | }; |
---|
45 | 41 | |
---|
46 | | -struct perf_evsel; |
---|
| 42 | +struct evsel; |
---|
| 43 | +struct evlist; |
---|
47 | 44 | struct bpf_object; |
---|
48 | 45 | struct parse_events_term; |
---|
49 | 46 | #define PERF_BPF_PROBE_GROUP "perf_bpf_probe" |
---|
50 | 47 | |
---|
51 | 48 | 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); |
---|
53 | 50 | |
---|
54 | 51 | #ifdef HAVE_LIBBPF_SUPPORT |
---|
55 | 52 | struct bpf_object *bpf__prepare_load(const char *filename, bool source); |
---|
.. | .. |
---|
73 | 70 | bpf_prog_iter_callback_t func, void *arg); |
---|
74 | 71 | |
---|
75 | 72 | 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); |
---|
77 | 74 | int bpf__strerror_config_obj(struct bpf_object *obj, |
---|
78 | 75 | struct parse_events_term *term, |
---|
79 | | - struct perf_evlist *evlist, |
---|
| 76 | + struct evlist *evlist, |
---|
80 | 77 | int *error_pos, int err, char *buf, |
---|
81 | 78 | size_t size); |
---|
82 | 79 | int bpf__apply_obj_config(void); |
---|
83 | 80 | int bpf__strerror_apply_obj_config(int err, char *buf, size_t size); |
---|
84 | 81 | |
---|
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); |
---|
88 | 85 | #else |
---|
89 | 86 | #include <errno.h> |
---|
| 87 | +#include <string.h> |
---|
| 88 | +#include "debug.h" |
---|
90 | 89 | |
---|
91 | 90 | static inline struct bpf_object * |
---|
92 | 91 | bpf__prepare_load(const char *filename __maybe_unused, |
---|
.. | .. |
---|
120 | 119 | static inline int |
---|
121 | 120 | bpf__config_obj(struct bpf_object *obj __maybe_unused, |
---|
122 | 121 | struct parse_events_term *term __maybe_unused, |
---|
123 | | - struct perf_evlist *evlist __maybe_unused, |
---|
| 122 | + struct evlist *evlist __maybe_unused, |
---|
124 | 123 | int *error_pos __maybe_unused) |
---|
125 | 124 | { |
---|
126 | 125 | return 0; |
---|
.. | .. |
---|
133 | 132 | } |
---|
134 | 133 | |
---|
135 | 134 | static inline int |
---|
136 | | -bpf__setup_stdout(struct perf_evlist *evlist __maybe_unused) |
---|
| 135 | +bpf__setup_stdout(struct evlist *evlist __maybe_unused) |
---|
137 | 136 | { |
---|
138 | 137 | return 0; |
---|
139 | 138 | } |
---|
140 | 139 | |
---|
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) |
---|
143 | 142 | { |
---|
144 | 143 | return NULL; |
---|
145 | 144 | } |
---|
.. | .. |
---|
183 | 182 | static inline int |
---|
184 | 183 | bpf__strerror_config_obj(struct bpf_object *obj __maybe_unused, |
---|
185 | 184 | struct parse_events_term *term __maybe_unused, |
---|
186 | | - struct perf_evlist *evlist __maybe_unused, |
---|
| 185 | + struct evlist *evlist __maybe_unused, |
---|
187 | 186 | int *error_pos __maybe_unused, |
---|
188 | 187 | int err __maybe_unused, |
---|
189 | 188 | char *buf, size_t size) |
---|
.. | .. |
---|
199 | 198 | } |
---|
200 | 199 | |
---|
201 | 200 | 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, |
---|
203 | 202 | int err __maybe_unused, char *buf, size_t size) |
---|
204 | 203 | { |
---|
205 | 204 | return __bpf_strerror(buf, size); |
---|
.. | .. |
---|
207 | 206 | |
---|
208 | 207 | #endif |
---|
209 | 208 | |
---|
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) |
---|
211 | 210 | { |
---|
212 | 211 | return bpf__strerror_setup_output_event(evlist, err, buf, size); |
---|
213 | 212 | } |
---|