helpers.c (aaccf3c97418f169afdbb5855e9cbcbda34e90fd) | helpers.c (8bad74f9840f87661f20ced3dc80c84ab4fd55a1) |
---|---|
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 * This program is distributed in the hope that it will be useful, but 8 * WITHOUT ANY WARRANTY; without even the implied warranty of --- 180 unchanged lines hidden (view full) --- 189} 190 191const struct bpf_func_proto bpf_get_current_cgroup_id_proto = { 192 .func = bpf_get_current_cgroup_id, 193 .gpl_only = false, 194 .ret_type = RET_INTEGER, 195}; 196 | 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 * This program is distributed in the hope that it will be useful, but 8 * WITHOUT ANY WARRANTY; without even the implied warranty of --- 180 unchanged lines hidden (view full) --- 189} 190 191const struct bpf_func_proto bpf_get_current_cgroup_id_proto = { 192 .func = bpf_get_current_cgroup_id, 193 .gpl_only = false, 194 .ret_type = RET_INTEGER, 195}; 196 |
197DECLARE_PER_CPU(void*, bpf_cgroup_storage); | 197#ifdef CONFIG_CGROUP_BPF 198DECLARE_PER_CPU(void*, bpf_cgroup_storage[MAX_BPF_CGROUP_STORAGE_TYPE]); |
198 199BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags) 200{ | 199 200BPF_CALL_2(bpf_get_local_storage, struct bpf_map *, map, u64, flags) 201{ |
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. | 202 /* flags argument is not used now, 203 * but provides an ability to extend the API. 204 * verifier checks that its value is correct. |
205 */ | 205 */ |
206 return (unsigned long) this_cpu_read(bpf_cgroup_storage); | 206 enum bpf_cgroup_storage_type stype = cgroup_storage_type(map); 207 208 return (unsigned long) this_cpu_read(bpf_cgroup_storage[stype]); |
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}; 216#endif | 209} 210 211const struct bpf_func_proto bpf_get_local_storage_proto = { 212 .func = bpf_get_local_storage, 213 .gpl_only = false, 214 .ret_type = RET_PTR_TO_MAP_VALUE, 215 .arg1_type = ARG_CONST_MAP_PTR, 216 .arg2_type = ARG_ANYTHING, 217}; 218#endif |
219#endif |
|