2 * Copyright (C) 2015, Wang Nan <wangnan0@huawei.com>
3 * Copyright (C) 2015, Huawei Inc.
8 #include <linux/compiler.h>
11 #include "probe-event.h"
15 #define PERF_BPF_PROBE_GROUP "perf_bpf_probe"
17 typedef int (*bpf_prog_iter_callback_t)(struct probe_trace_event *tev,
20 #ifdef HAVE_LIBBPF_SUPPORT
21 struct bpf_object *bpf__prepare_load(const char *filename, bool source);
23 void bpf__clear(void);
25 int bpf__probe(struct bpf_object *obj);
26 int bpf__unprobe(struct bpf_object *obj);
27 int bpf__strerror_probe(struct bpf_object *obj, int err,
28 char *buf, size_t size);
30 int bpf__load(struct bpf_object *obj);
31 int bpf__strerror_load(struct bpf_object *obj, int err,
32 char *buf, size_t size);
33 int bpf__foreach_tev(struct bpf_object *obj,
34 bpf_prog_iter_callback_t func, void *arg);
36 static inline struct bpf_object *
37 bpf__prepare_load(const char *filename __maybe_unused,
38 bool source __maybe_unused)
40 pr_debug("ERROR: eBPF object loading is disabled during compiling.\n");
41 return ERR_PTR(-ENOTSUP);
44 static inline void bpf__clear(void) { }
46 static inline int bpf__probe(struct bpf_object *obj __maybe_unused) { return 0;}
47 static inline int bpf__unprobe(struct bpf_object *obj __maybe_unused) { return 0;}
48 static inline int bpf__load(struct bpf_object *obj __maybe_unused) { return 0; }
51 bpf__foreach_tev(struct bpf_object *obj __maybe_unused,
52 bpf_prog_iter_callback_t func __maybe_unused,
53 void *arg __maybe_unused)
59 __bpf_strerror(char *buf, size_t size)
64 "ERROR: eBPF object loading is disabled during compiling.\n",
71 bpf__strerror_probe(struct bpf_object *obj __maybe_unused,
72 int err __maybe_unused,
73 char *buf, size_t size)
75 return __bpf_strerror(buf, size);
78 static inline int bpf__strerror_load(struct bpf_object *obj __maybe_unused,
79 int err __maybe_unused,
80 char *buf, size_t size)
82 return __bpf_strerror(buf, size);