aboutsummaryrefslogtreecommitdiffstats
path: root/kernel/bpf/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'kernel/bpf/helpers.c')
-rw-r--r--kernel/bpf/helpers.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/kernel/bpf/helpers.c b/kernel/bpf/helpers.c
index 73065e2d23c2..1991466b8327 100644
--- a/kernel/bpf/helpers.c
+++ b/kernel/bpf/helpers.c
@@ -193,4 +193,24 @@ const struct bpf_func_proto bpf_get_current_cgroup_id_proto = {
193 .gpl_only = false, 193 .gpl_only = false,
194 .ret_type = RET_INTEGER, 194 .ret_type = RET_INTEGER,
195}; 195};
196
197DECLARE_PER_CPU(void*, bpf_cgroup_storage);
198
199BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags)
200{
201 /* map and flags arguments are not used now,
202 * but provide an ability to extend the API
203 * for other types of local storages.
204 * verifier checks that their values are correct.
205 */
206 return (unsigned long) this_cpu_read(bpf_cgroup_storage);
207}
208
209const struct bpf_func_proto bpf_get_local_storage_proto = {
210 .func = bpf_get_local_storage,
211 .gpl_only = false,
212 .ret_type = RET_PTR_TO_MAP_VALUE,
213 .arg1_type = ARG_CONST_MAP_PTR,
214 .arg2_type = ARG_ANYTHING,
215};
196#endif 216#endif