From ea91fe08d3b5a41a93a92e521d13c07f6d4cbcd1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=C2=A0Decina?= Date: Sat, 2 Oct 2021 05:30:53 +0000 Subject: [PATCH] bpf: rename PerfMap to PerfEventArray --- bpf/aya-bpf/src/maps/mod.rs | 4 ++-- bpf/aya-bpf/src/maps/perf/mod.rs | 3 +++ .../{perf_map.rs => perf/perf_event_array.rs} | 16 ++++++++-------- 3 files changed, 13 insertions(+), 10 deletions(-) create mode 100644 bpf/aya-bpf/src/maps/perf/mod.rs rename bpf/aya-bpf/src/maps/{perf_map.rs => perf/perf_event_array.rs} (85%) diff --git a/bpf/aya-bpf/src/maps/mod.rs b/bpf/aya-bpf/src/maps/mod.rs index b6cd3c65..bc766c70 100644 --- a/bpf/aya-bpf/src/maps/mod.rs +++ b/bpf/aya-bpf/src/maps/mod.rs @@ -8,7 +8,7 @@ pub(crate) enum PinningType { pub mod array; pub mod hash_map; pub mod per_cpu_array; -pub mod perf_map; +pub mod perf; pub mod queue; pub mod sock_hash; pub mod sock_map; @@ -17,7 +17,7 @@ pub mod stack_trace; pub use array::Array; pub use hash_map::HashMap; pub use per_cpu_array::PerCpuArray; -pub use perf_map::PerfMap; +pub use perf::PerfEventArray; pub use queue::Queue; pub use sock_hash::SockHash; pub use sock_map::SockMap; diff --git a/bpf/aya-bpf/src/maps/perf/mod.rs b/bpf/aya-bpf/src/maps/perf/mod.rs new file mode 100644 index 00000000..0faba365 --- /dev/null +++ b/bpf/aya-bpf/src/maps/perf/mod.rs @@ -0,0 +1,3 @@ +mod perf_event_array; + +pub use perf_event_array::PerfEventArray; diff --git a/bpf/aya-bpf/src/maps/perf_map.rs b/bpf/aya-bpf/src/maps/perf/perf_event_array.rs similarity index 85% rename from bpf/aya-bpf/src/maps/perf_map.rs rename to bpf/aya-bpf/src/maps/perf/perf_event_array.rs index bd3d7fd4..5587a039 100644 --- a/bpf/aya-bpf/src/maps/perf_map.rs +++ b/bpf/aya-bpf/src/maps/perf/perf_event_array.rs @@ -8,18 +8,18 @@ use crate::{ }; #[repr(transparent)] -pub struct PerfMap { +pub struct PerfEventArray { def: bpf_map_def, _t: PhantomData, } -impl PerfMap { - pub const fn new(flags: u32) -> PerfMap { - PerfMap::with_max_entries(0, flags) +impl PerfEventArray { + pub const fn new(flags: u32) -> PerfEventArray { + PerfEventArray::with_max_entries(0, flags) } - pub const fn with_max_entries(max_entries: u32, flags: u32) -> PerfMap { - PerfMap { + pub const fn with_max_entries(max_entries: u32, flags: u32) -> PerfEventArray { + PerfEventArray { def: bpf_map_def { type_: BPF_MAP_TYPE_PERF_EVENT_ARRAY, key_size: mem::size_of::() as u32, @@ -33,8 +33,8 @@ impl PerfMap { } } - pub const fn pinned(max_entries: u32, flags: u32) -> PerfMap { - PerfMap { + pub const fn pinned(max_entries: u32, flags: u32) -> PerfEventArray { + PerfEventArray { def: bpf_map_def { type_: BPF_MAP_TYPE_PERF_EVENT_ARRAY, key_size: mem::size_of::() as u32,