Re: [PATCH bpf-next v9 1/5] bpf: Introduce cgroup iter
From: Hao Luo <hidden>
Date: 2022-08-25 20:35:18
Also in:
bpf, cgroups, lkml
On Thu, Aug 25, 2022 at 1:18 PM Andrii Nakryiko [off-list ref] wrote:
On Tue, Aug 23, 2022 at 8:01 PM Hao Luo [off-list ref] wrote:quoted
[...]
quoted
typedef int (*bpf_iter_attach_target_t)(struct bpf_prog *prog,diff --git a/include/uapi/linux/bpf.h b/include/uapi/linux/bpf.h index 934a2a8beb87..1c4e1c583880 100644 --- a/include/uapi/linux/bpf.h +++ b/include/uapi/linux/bpf.h@@ -87,10 +87,29 @@ struct bpf_cgroup_storage_key { __u32 attach_type; /* program attach type (enum bpf_attach_type) */ }; +enum bpf_cgroup_iter_order { + BPF_ITER_ORDER_UNSPEC = 0, + BPF_ITER_SELF_ONLY, /* process only a single object. */ + BPF_ITER_DESCENDANTS_PRE, /* walk descendants in pre-order. */ + BPF_ITER_DESCENDANTS_POST, /* walk descendants in post-order. */ + BPF_ITER_ANCESTORS_UP, /* walk ancestors upward. */ +};just skimming through this, I noticed that we have "enum bpf_cgroup_iter_order" (good, I like) but BPF_ITER_xxx with no CGROUP part in it (not good, don't like :). All the enumerator names have global visibility, so it would probably be best for them to be CGROUP-specific and roughly match the enum name itself: BPF_CGROUP_ITER_SELF_ONLY, etc?
Ack. I will send a patch to fix this right now.