diff options
Diffstat (limited to 'kernel/bpf/helpers.c')
| -rw-r--r-- | kernel/bpf/helpers.c | 20 | 
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 = {  	.gpl_only	= false,  	.ret_type	= RET_INTEGER,  }; + +DECLARE_PER_CPU(void*, bpf_cgroup_storage); + +BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags) +{ +	/* map and flags arguments are not used now, +	 * but provide an ability to extend the API +	 * for other types of local storages. +	 * verifier checks that their values are correct. +	 */ +	return (unsigned long) this_cpu_read(bpf_cgroup_storage); +} + +const struct bpf_func_proto bpf_get_local_storage_proto = { +	.func		= bpf_get_local_storage, +	.gpl_only	= false, +	.ret_type	= RET_PTR_TO_MAP_VALUE, +	.arg1_type	= ARG_CONST_MAP_PTR, +	.arg2_type	= ARG_ANYTHING, +};  #endif  |