aboutsummaryrefslogtreecommitdiff
path: root/ebpf/ebpf.h
blob: 378d4e9c706ddf3f6eb0dcdfb54a3e0210438fd3 (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
/*
 * QEMU eBPF binary declaration routine.
 *
 * Developed by Daynix Computing LTD (http://www.daynix.com)
 *
 * Authors:
 *  Andrew Melnychenko <andrew@daynix.com>
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef EBPF_H
#define EBPF_H


void ebpf_register_binary_data(int id, const void *data,
                               size_t datalen);
const void *ebpf_find_binary_by_id(int id, size_t *sz,
                                   struct Error **errp);

#define ebpf_binary_init(id, fn)                                           \
static void __attribute__((constructor)) ebpf_binary_init_ ## fn(void)     \
{                                                                          \
    size_t datalen = 0;                                                    \
    const void *data = fn(&datalen);                                       \
    ebpf_register_binary_data(id, data, datalen);                          \
}

#endif /* EBPF_H */