Wang Nan | 69d262a | 2015-10-14 12:41:13 +0000 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2015, Wang Nan <wangnan0@huawei.com> |
| 3 | * Copyright (C) 2015, Huawei Inc. |
| 4 | */ |
| 5 | #ifndef __BPF_LOADER_H |
| 6 | #define __BPF_LOADER_H |
| 7 | |
| 8 | #include <linux/compiler.h> |
| 9 | #include <linux/err.h> |
| 10 | #include <string.h> |
| 11 | #include "debug.h" |
| 12 | |
| 13 | struct bpf_object; |
| 14 | |
| 15 | #ifdef HAVE_LIBBPF_SUPPORT |
| 16 | struct bpf_object *bpf__prepare_load(const char *filename); |
| 17 | |
| 18 | void bpf__clear(void); |
| 19 | #else |
| 20 | static inline struct bpf_object * |
| 21 | bpf__prepare_load(const char *filename __maybe_unused) |
| 22 | { |
| 23 | pr_debug("ERROR: eBPF object loading is disabled during compiling.\n"); |
| 24 | return ERR_PTR(-ENOTSUP); |
| 25 | } |
| 26 | |
| 27 | static inline void bpf__clear(void) { } |
| 28 | #endif |
| 29 | #endif |