Re: [PATCH bpf-next v3 16/21] tools/libbpf: add bpf_iter support

Andrii Nakryiko
2020-05-08T19:47:04Z

On Wed, May 6, 2020 at 10:42 PM Yonghong Song <yhs@fb.com> wrote:
>
> Two new libbpf APIs are added to support bpf_iter:
> - bpf_program__attach_iter
> Given a bpf program and additional parameters, which is
> none now, returns a bpf_link.
> - bpf_iter_create
> syscall level API to create a bpf iterator.
>
> The macro BPF_SEQ_PRINTF are also introduced. The format
> looks like:
> BPF_SEQ_PRINTF(seq, "task id %d\n", pid);
>
> This macro can help bpf program writers with
> nicer bpf_seq_printf syntax similar to the kernel one.
>
> Signed-off-by: Yonghong Song <yhs@fb.com>
> ---

Looks great!

Acked-by: Andrii Nakryiko <andriin@fb.com>

> tools/lib/bpf/bpf.c | 10 +++++++
> tools/lib/bpf/bpf.h | 2 ++
> tools/lib/bpf/bpf_tracing.h | 16 ++++++++++++
> tools/lib/bpf/libbpf.c | 52 +++++++++++++++++++++++++++++++++++++
> tools/lib/bpf/libbpf.h | 9 +++++++
> tools/lib/bpf/libbpf.map | 2 ++
> 6 files changed, 91 insertions(+)
> …