linux/tools/lib/bpf
Daniel Borkmann 3dca21156b bpf, libbpf: simplify and cleanup perf ring buffer walk
Simplify bpf_perf_event_read_simple() a bit and fix up some minor
things along the way: the return code in the header is not of type
int but enum bpf_perf_event_ret instead. Once callback indicated
to break the loop walking event data, it also needs to be consumed
in data_tail since it has been processed already.

Moreover, bpf_perf_event_print_t callback should avoid void * as
we actually get a pointer to struct perf_event_header and thus
applications can make use of container_of() to have type checks.
The walk also doesn't have to use modulo op since the ring size is
required to be power of two.

Signed-off-by: Daniel Borkmann <daniel@iogearbox.net>
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
2018-10-20 23:13:32 -07:00
..
.gitignore tools lib bpf: Change FEATURE-DUMP to FEATURE-DUMP.libbpf 2015-11-05 12:47:51 -03:00
Build Merge git://git.kernel.org/pub/scm/linux/kernel/git/bpf/bpf-next 2018-09-25 20:29:38 -07:00
Makefile libbpf: Per-symbol visibility for DSO 2018-10-16 15:16:47 -07:00
bpf.c selftests/bpf: add test cases for queue and stack maps 2018-10-19 13:24:31 -07:00
bpf.h selftests/bpf: add test cases for queue and stack maps 2018-10-19 13:24:31 -07:00
btf.c libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-Clause 2018-10-08 10:09:48 +02:00
btf.h libbpf: Per-symbol visibility for DSO 2018-10-16 15:16:47 -07:00
libbpf.c bpf, libbpf: simplify and cleanup perf ring buffer walk 2018-10-20 23:13:32 -07:00
libbpf.h bpf, libbpf: simplify and cleanup perf ring buffer walk 2018-10-20 23:13:32 -07:00
libbpf_errno.c libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-Clause 2018-10-08 10:09:48 +02:00
netlink.c libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-Clause 2018-10-08 10:09:48 +02:00
nlattr.c libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-Clause 2018-10-08 10:09:48 +02:00
nlattr.h libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-Clause 2018-10-08 10:09:48 +02:00
str_error.c libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-Clause 2018-10-08 10:09:48 +02:00
str_error.h libbpf: relicense libbpf as LGPL-2.1 OR BSD-2-Clause 2018-10-08 10:09:48 +02:00