summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/bpf-loader.h
blob: f402d7c8c28841d756f5513f3b05fa3d45f9f248 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
/*
 * Copyright (C) 2015, Wang Nan <wangnan0@huawei.com>
 * Copyright (C) 2015, Huawei Inc.
 */
#ifndef __BPF_LOADER_H
#define __BPF_LOADER_H

#include <linux/compiler.h>
#include <linux/err.h>
#include <string.h>
#include "debug.h"

struct bpf_object;

#ifdef HAVE_LIBBPF_SUPPORT
struct bpf_object *bpf__prepare_load(const char *filename);

void bpf__clear(void);
#else
static inline struct bpf_object *
bpf__prepare_load(const char *filename __maybe_unused)
{
	pr_debug("ERROR: eBPF object loading is disabled during compiling.\n");
	return ERR_PTR(-ENOTSUP);
}

static inline void bpf__clear(void) { }
#endif
#endif