]>
Commit | Line | Data |
---|---|---|
99c55f7d AS |
1 | /* Copyright (c) 2011-2014 PLUMgrid, http://plumgrid.com |
2 | * | |
3 | * This program is free software; you can redistribute it and/or | |
4 | * modify it under the terms of version 2 of the GNU General Public | |
5 | * License as published by the Free Software Foundation. | |
6 | */ | |
7 | #ifndef _LINUX_BPF_H | |
8 | #define _LINUX_BPF_H 1 | |
9 | ||
10 | #include <uapi/linux/bpf.h> | |
11 | #include <linux/workqueue.h> | |
12 | ||
13 | struct bpf_map; | |
14 | ||
15 | /* map is generic key/value storage optionally accesible by eBPF programs */ | |
16 | struct bpf_map_ops { | |
17 | /* funcs callable from userspace (via syscall) */ | |
18 | struct bpf_map *(*map_alloc)(union bpf_attr *attr); | |
19 | void (*map_free)(struct bpf_map *); | |
20 | }; | |
21 | ||
22 | struct bpf_map { | |
23 | atomic_t refcnt; | |
24 | enum bpf_map_type map_type; | |
25 | u32 key_size; | |
26 | u32 value_size; | |
27 | u32 max_entries; | |
28 | struct bpf_map_ops *ops; | |
29 | struct work_struct work; | |
30 | }; | |
31 | ||
32 | struct bpf_map_type_list { | |
33 | struct list_head list_node; | |
34 | struct bpf_map_ops *ops; | |
35 | enum bpf_map_type type; | |
36 | }; | |
37 | ||
38 | void bpf_register_map_type(struct bpf_map_type_list *tl); | |
39 | void bpf_map_put(struct bpf_map *map); | |
40 | ||
41 | #endif /* _LINUX_BPF_H */ |