On Mon, Jan 27, 2025 at 3:48 PM Juntong Deng <juntong.deng@xxxxxxxxxxx> wrote: > > This patch adds the open-coded iterator style process file iterator > kfuncs bpf_iter_task_file_{new,next,destroy} that iterates over all > files opened by the specified process. > > bpf_iter_task_file_next returns a pointer to bpf_iter_task_file_item, > which currently contains *task, *file, fd. This is an extensible > structure that enables compatibility with different versions > through CO-RE. > > The reference to struct file acquired by the previous > bpf_iter_task_file_next() is released in the next > bpf_iter_task_file_next(), and the last reference is released in the > last bpf_iter_task_file_next() that returns NULL. > > In the bpf_iter_task_file_destroy(), if the iterator does not iterate to > the end, then the last struct file reference is released at this time. > > Signed-off-by: Juntong Deng <juntong.deng@xxxxxxxxxxx> All patches look fine, but we need an ack from Christian for patches 3 and 4 to proceed.