Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

bpf: Move cgroup iterator helpers to bpf.h

Move them into bpf.h given we also need them in core code.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Link: https://lore.kernel.org/r/20250730234733.530041-3-daniel@iogearbox.net
Signed-off-by: Alexei Starovoitov <ast@kernel.org>

authored by

Daniel Borkmann and committed by
Alexei Starovoitov
9621e60f fd1c98f0

+14 -13
-5
include/linux/bpf-cgroup.h
··· 77 77 extern struct static_key_false cgroup_bpf_enabled_key[MAX_CGROUP_BPF_ATTACH_TYPE]; 78 78 #define cgroup_bpf_enabled(atype) static_branch_unlikely(&cgroup_bpf_enabled_key[atype]) 79 79 80 - #define for_each_cgroup_storage_type(stype) \ 81 - for (stype = 0; stype < MAX_BPF_CGROUP_STORAGE_TYPE; stype++) 82 - 83 80 struct bpf_cgroup_storage_map; 84 81 85 82 struct bpf_storage_buffer { ··· 506 509 optlen, retval) ({ retval; }) 507 510 #define BPF_CGROUP_RUN_PROG_SETSOCKOPT(sock, level, optname, optval, optlen, \ 508 511 kernel_optval) ({ 0; }) 509 - 510 - #define for_each_cgroup_storage_type(stype) for (; false; ) 511 512 512 513 #endif /* CONFIG_CGROUP_BPF */ 513 514
+14 -8
include/linux/bpf.h
··· 208 208 BPF_RES_SPIN_LOCK = (1 << 12), 209 209 }; 210 210 211 + enum bpf_cgroup_storage_type { 212 + BPF_CGROUP_STORAGE_SHARED, 213 + BPF_CGROUP_STORAGE_PERCPU, 214 + __BPF_CGROUP_STORAGE_MAX 215 + #define MAX_BPF_CGROUP_STORAGE_TYPE __BPF_CGROUP_STORAGE_MAX 216 + }; 217 + 218 + #ifdef CONFIG_CGROUP_BPF 219 + # define for_each_cgroup_storage_type(stype) \ 220 + for (stype = 0; stype < MAX_BPF_CGROUP_STORAGE_TYPE; stype++) 221 + #else 222 + # define for_each_cgroup_storage_type(stype) for (; false; ) 223 + #endif /* CONFIG_CGROUP_BPF */ 224 + 211 225 typedef void (*btf_dtor_kfunc_t)(void *); 212 226 213 227 struct btf_field_kptr { ··· 1098 1084 void *jited_image; 1099 1085 u32 jited_len; 1100 1086 }; 1101 - 1102 - enum bpf_cgroup_storage_type { 1103 - BPF_CGROUP_STORAGE_SHARED, 1104 - BPF_CGROUP_STORAGE_PERCPU, 1105 - __BPF_CGROUP_STORAGE_MAX 1106 - }; 1107 - 1108 - #define MAX_BPF_CGROUP_STORAGE_TYPE __BPF_CGROUP_STORAGE_MAX 1109 1087 1110 1088 /* The longest tracepoint has 12 args. 1111 1089 * See include/trace/bpf_probe.h