diff options
| author | Andrii Nakryiko <[email protected]> | 2021-11-11 05:36:24 +0000 |
|---|---|---|
| committer | Alexei Starovoitov <[email protected]> | 2021-11-12 00:54:06 +0000 |
| commit | 164b04f27fbd769f57905dfddd2a8953974eeef4 (patch) | |
| tree | e168c3961048232aba7e298b28a526890d5b468b /tools/bpf/bpftool/map_perf_ring.c | |
| parent | tools/runqslower: Update perf_buffer__new() calls (diff) | |
| download | kernel-164b04f27fbd769f57905dfddd2a8953974eeef4.tar.gz kernel-164b04f27fbd769f57905dfddd2a8953974eeef4.zip | |
bpftool: Update btf_dump__new() and perf_buffer__new_raw() calls
Use v1.0-compatible variants of btf_dump and perf_buffer "constructors".
This is also a demonstration of reusing struct perf_buffer_raw_opts as
OPTS-style option struct for new perf_buffer__new_raw() API.
Signed-off-by: Andrii Nakryiko <[email protected]>
Signed-off-by: Alexei Starovoitov <[email protected]>
Link: https://lore.kernel.org/bpf/[email protected]
Diffstat (limited to 'tools/bpf/bpftool/map_perf_ring.c')
| -rw-r--r-- | tools/bpf/bpftool/map_perf_ring.c | 9 |
1 files changed, 3 insertions, 6 deletions
diff --git a/tools/bpf/bpftool/map_perf_ring.c b/tools/bpf/bpftool/map_perf_ring.c index b98ea702d284..6b0c410152de 100644 --- a/tools/bpf/bpftool/map_perf_ring.c +++ b/tools/bpf/bpftool/map_perf_ring.c @@ -124,7 +124,7 @@ int do_event_pipe(int argc, char **argv) .wakeup_events = 1, }; struct bpf_map_info map_info = {}; - struct perf_buffer_raw_opts opts = {}; + LIBBPF_OPTS(perf_buffer_raw_opts, opts); struct event_pipe_ctx ctx = { .all_cpus = true, .cpu = -1, @@ -190,14 +190,11 @@ int do_event_pipe(int argc, char **argv) ctx.idx = 0; } - opts.attr = &perf_attr; - opts.event_cb = print_bpf_output; - opts.ctx = &ctx; opts.cpu_cnt = ctx.all_cpus ? 0 : 1; opts.cpus = &ctx.cpu; opts.map_keys = &ctx.idx; - - pb = perf_buffer__new_raw(map_fd, MMAP_PAGE_CNT, &opts); + pb = perf_buffer__new_raw(map_fd, MMAP_PAGE_CNT, &perf_attr, + print_bpf_output, &ctx, &opts); err = libbpf_get_error(pb); if (err) { p_err("failed to create perf buffer: %s (%d)", |
