From 23a70382b2b2292c8fda882580a1c99cb9f054a8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=C2=A0Decina?= Date: Sat, 2 Oct 2021 05:33:50 +0000 Subject: [PATCH] bpf: PerfEventArray: tweak output API --- bpf/aya-bpf/src/maps/perf/perf_event_array.rs | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-) diff --git a/bpf/aya-bpf/src/maps/perf/perf_event_array.rs b/bpf/aya-bpf/src/maps/perf/perf_event_array.rs index 5587a039..b102c871 100644 --- a/bpf/aya-bpf/src/maps/perf/perf_event_array.rs +++ b/bpf/aya-bpf/src/maps/perf/perf_event_array.rs @@ -49,18 +49,11 @@ impl PerfEventArray { } pub fn output(&mut self, ctx: &C, data: &T, flags: u32) { - self.output_at_index(ctx, None, data, flags) + self.output_at_index(ctx, BPF_F_CURRENT_CPU as u32, data, flags) } - pub fn output_at_index( - &mut self, - ctx: &C, - index: Option, - data: &T, - flags: u32, - ) { - let index = index.unwrap_or(BPF_F_CURRENT_CPU as u32) as u64; - let flags = (flags as u64) << 32 | index; + pub fn output_at_index(&mut self, ctx: &C, index: u32, data: &T, flags: u32) { + let flags = (flags as u64) << 32 | index as u64; unsafe { bpf_perf_event_output( ctx.as_ptr(),