aboutsummaryrefslogtreecommitdiffstats
path: root/include/linux/bpf.h
diff options
context:
space:
mode:
authorDaniel Borkmann <daniel@iogearbox.net>2015-03-01 06:31:42 -0500
committerDavid S. Miller <davem@davemloft.net>2015-03-01 14:05:18 -0500
commita2c83fff582ae133d9f5bb187404ea9ce4da1f96 (patch)
tree93293fffedc76b48e5ccaefdfd95728719d11753 /include/linux/bpf.h
parentf91fe17e243d1f279d425071a35e3d41290758a0 (diff)
ebpf: constify various function pointer structs
We can move bpf_map_ops and bpf_verifier_ops and other structs into ro section, bpf_map_type_list and bpf_prog_type_list into read mostly. Signed-off-by: Daniel Borkmann <daniel@iogearbox.net> Acked-by: Alexei Starovoitov <ast@plumgrid.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'include/linux/bpf.h')
-rw-r--r--include/linux/bpf.h14
1 files changed, 7 insertions, 7 deletions
diff --git a/include/linux/bpf.h b/include/linux/bpf.h
index bbfceb756452..78446860f796 100644
--- a/include/linux/bpf.h
+++ b/include/linux/bpf.h
@@ -32,13 +32,13 @@ struct bpf_map {
32 u32 key_size; 32 u32 key_size;
33 u32 value_size; 33 u32 value_size;
34 u32 max_entries; 34 u32 max_entries;
35 struct bpf_map_ops *ops; 35 const struct bpf_map_ops *ops;
36 struct work_struct work; 36 struct work_struct work;
37}; 37};
38 38
39struct bpf_map_type_list { 39struct bpf_map_type_list {
40 struct list_head list_node; 40 struct list_head list_node;
41 struct bpf_map_ops *ops; 41 const struct bpf_map_ops *ops;
42 enum bpf_map_type type; 42 enum bpf_map_type type;
43}; 43};
44 44
@@ -109,7 +109,7 @@ struct bpf_verifier_ops {
109 109
110struct bpf_prog_type_list { 110struct bpf_prog_type_list {
111 struct list_head list_node; 111 struct list_head list_node;
112 struct bpf_verifier_ops *ops; 112 const struct bpf_verifier_ops *ops;
113 enum bpf_prog_type type; 113 enum bpf_prog_type type;
114}; 114};
115 115
@@ -121,7 +121,7 @@ struct bpf_prog_aux {
121 atomic_t refcnt; 121 atomic_t refcnt;
122 bool is_gpl_compatible; 122 bool is_gpl_compatible;
123 enum bpf_prog_type prog_type; 123 enum bpf_prog_type prog_type;
124 struct bpf_verifier_ops *ops; 124 const struct bpf_verifier_ops *ops;
125 struct bpf_map **used_maps; 125 struct bpf_map **used_maps;
126 u32 used_map_cnt; 126 u32 used_map_cnt;
127 struct bpf_prog *prog; 127 struct bpf_prog *prog;
@@ -138,8 +138,8 @@ struct bpf_prog *bpf_prog_get(u32 ufd);
138int bpf_check(struct bpf_prog *fp, union bpf_attr *attr); 138int bpf_check(struct bpf_prog *fp, union bpf_attr *attr);
139 139
140/* verifier prototypes for helper functions called from eBPF programs */ 140/* verifier prototypes for helper functions called from eBPF programs */
141extern struct bpf_func_proto bpf_map_lookup_elem_proto; 141extern const struct bpf_func_proto bpf_map_lookup_elem_proto;
142extern struct bpf_func_proto bpf_map_update_elem_proto; 142extern const struct bpf_func_proto bpf_map_update_elem_proto;
143extern struct bpf_func_proto bpf_map_delete_elem_proto; 143extern const struct bpf_func_proto bpf_map_delete_elem_proto;
144 144
145#endif /* _LINUX_BPF_H */ 145#endif /* _LINUX_BPF_H */