qemu/ebpf/ebpf.h
<<
>>
Prefs
   1/*
   2 * QEMU eBPF binary declaration routine.
   3 *
   4 * Developed by Daynix Computing LTD (http://www.daynix.com)
   5 *
   6 * Authors:
   7 *  Andrew Melnychenko <andrew@daynix.com>
   8 *
   9 * SPDX-License-Identifier: GPL-2.0-or-later
  10 */
  11
  12#ifndef EBPF_H
  13#define EBPF_H
  14
  15
  16void ebpf_register_binary_data(int id, const void *data,
  17                               size_t datalen);
  18const void *ebpf_find_binary_by_id(int id, size_t *sz,
  19                                   struct Error **errp);
  20
  21#define ebpf_binary_init(id, fn)                                           \
  22static void __attribute__((constructor)) ebpf_binary_init_ ## fn(void)     \
  23{                                                                          \
  24    size_t datalen = 0;                                                    \
  25    const void *data = fn(&datalen);                                       \
  26    ebpf_register_binary_data(id, data, datalen);                          \
  27}
  28
  29#endif /* EBPF_H */
  30