Extend map event_pipe to consume BPF ring buffer records, with plain and
JSON output and focused tests for records, shutdown and invalid arguments.

Changes in v4, addressing Quentin's review:
- Accept multiple map types in the completion helpers.
- Preserve the normal diagnostic for unknown arguments.
- Use p_err() for errors and drop the redundant ownership comment.
- Reuse detect_bpftool_path() and check the exec-error write result.
- Add a JSON regression for unknown arguments.

Rebased on current bpf-next. All 18 ringbuf subtests pass in an x86-64 VM,
including the existing perf event array path. Completion matching and
plain/JSON polling-error output were also checked.

v3: https://lore.kernel.org/r/[email protected]

Tianyi Chen (2):
  bpftool: Read ring buffer maps with event_pipe
  selftests/bpf: Cover bpftool ring buffer event_pipe

 .../bpf/bpftool/Documentation/bpftool-map.rst |  14 +-
 tools/bpf/bpftool/bash-completion/bpftool     |  53 ++-
 tools/bpf/bpftool/map_perf_ring.c             |  87 +++-
 tools/testing/selftests/bpf/bpftool_helpers.c |   2 +-
 tools/testing/selftests/bpf/bpftool_helpers.h |   1 +
 .../bpf/prog_tests/bpftool_ringbuf.c          | 417 ++++++++++++++++++
 .../selftests/bpf/progs/bpftool_ringbuf.c     |  47 ++
 7 files changed, 574 insertions(+), 47 deletions(-)
 create mode 100644 tools/testing/selftests/bpf/prog_tests/bpftool_ringbuf.c
 create mode 100644 tools/testing/selftests/bpf/progs/bpftool_ringbuf.c


base-commit: 559b90b855ce535572e743ed79a59f728ac30fb0
-- 
2.55.0


Reply via email to