blob: 86708fced09273184aa51e440f8bdada7b0b3430 [file] [log] [blame]
Maciej Żenczykowski730a3862020-01-27 01:10:48 -08001/*
2 * Copyright (C) 2020 The Android Open Source Project
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 */
16
17#pragma once
18
19/* This file is separate because it's included both by eBPF programs (via include
20 * in bpf_helpers.h) and directly by the boot time bpfloader (Loader.cpp).
21 */
22
23#include <linux/bpf.h>
24
25/*
26 * Map structure to be used by Android eBPF C programs. The Android eBPF loader
27 * uses this structure from eBPF object to create maps at boot time.
28 *
29 * The eBPF C program should define structure in the maps section using
30 * SEC("maps") otherwise it will be ignored by the eBPF loader.
31 *
32 * For example:
33 * const struct bpf_map_def SEC("maps") mymap { .type=... , .key_size=... }
34 *
35 * See 'bpf_helpers.h' for helpful macros for eBPF program use.
36 */
37struct bpf_map_def {
38 enum bpf_map_type type;
39 unsigned int key_size;
40 unsigned int value_size;
41 unsigned int max_entries;
42 unsigned int map_flags;
43
44 // The following are not supported by the Android bpfloader:
45 // unsigned int inner_map_idx;
46 // unsigned int numa_node;
47};