diff options
Diffstat (limited to 'tools/lib/bpf/libbpf_util.h')
-rw-r--r-- | tools/lib/bpf/libbpf_util.h | 30 |
1 files changed, 30 insertions, 0 deletions
diff --git a/tools/lib/bpf/libbpf_util.h b/tools/lib/bpf/libbpf_util.h new file mode 100644 index 000000000000..81ecda0cb9c9 --- /dev/null +++ b/tools/lib/bpf/libbpf_util.h | |||
@@ -0,0 +1,30 @@ | |||
1 | /* SPDX-License-Identifier: (LGPL-2.1 OR BSD-2-Clause) */ | ||
2 | /* Copyright (c) 2019 Facebook */ | ||
3 | |||
4 | #ifndef __LIBBPF_LIBBPF_UTIL_H | ||
5 | #define __LIBBPF_LIBBPF_UTIL_H | ||
6 | |||
7 | #include <stdbool.h> | ||
8 | |||
9 | #ifdef __cplusplus | ||
10 | extern "C" { | ||
11 | #endif | ||
12 | |||
13 | extern void libbpf_print(enum libbpf_print_level level, | ||
14 | const char *format, ...) | ||
15 | __attribute__((format(printf, 2, 3))); | ||
16 | |||
17 | #define __pr(level, fmt, ...) \ | ||
18 | do { \ | ||
19 | libbpf_print(level, "libbpf: " fmt, ##__VA_ARGS__); \ | ||
20 | } while (0) | ||
21 | |||
22 | #define pr_warning(fmt, ...) __pr(LIBBPF_WARN, fmt, ##__VA_ARGS__) | ||
23 | #define pr_info(fmt, ...) __pr(LIBBPF_INFO, fmt, ##__VA_ARGS__) | ||
24 | #define pr_debug(fmt, ...) __pr(LIBBPF_DEBUG, fmt, ##__VA_ARGS__) | ||
25 | |||
26 | #ifdef __cplusplus | ||
27 | } /* extern "C" */ | ||
28 | #endif | ||
29 | |||
30 | #endif | ||