Browse Source

bpf: rename PerfMap to PerfEventArray

Alessandro Decina 3 years ago
parent
commit
ea91fe08d3

+ 2 - 2
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;

+ 3 - 0
bpf/aya-bpf/src/maps/perf/mod.rs

@@ -0,0 +1,3 @@
+mod perf_event_array;
+
+pub use perf_event_array::PerfEventArray;

+ 8 - 8
bpf/aya-bpf/src/maps/perf_map.rs → bpf/aya-bpf/src/maps/perf/perf_event_array.rs

@@ -8,18 +8,18 @@ use crate::{
 };
 
 #[repr(transparent)]
-pub struct PerfMap<T> {
+pub struct PerfEventArray<T> {
     def: bpf_map_def,
     _t: PhantomData<T>,
 }
 
-impl<T> PerfMap<T> {
-    pub const fn new(flags: u32) -> PerfMap<T> {
-        PerfMap::with_max_entries(0, flags)
+impl<T> PerfEventArray<T> {
+    pub const fn new(flags: u32) -> PerfEventArray<T> {
+        PerfEventArray::with_max_entries(0, flags)
     }
 
-    pub const fn with_max_entries(max_entries: u32, flags: u32) -> PerfMap<T> {
-        PerfMap {
+    pub const fn with_max_entries(max_entries: u32, flags: u32) -> PerfEventArray<T> {
+        PerfEventArray {
             def: bpf_map_def {
                 type_: BPF_MAP_TYPE_PERF_EVENT_ARRAY,
                 key_size: mem::size_of::<u32>() as u32,
@@ -33,8 +33,8 @@ impl<T> PerfMap<T> {
         }
     }
 
-    pub const fn pinned(max_entries: u32, flags: u32) -> PerfMap<T> {
-        PerfMap {
+    pub const fn pinned(max_entries: u32, flags: u32) -> PerfEventArray<T> {
+        PerfEventArray {
             def: bpf_map_def {
                 type_: BPF_MAP_TYPE_PERF_EVENT_ARRAY,
                 key_size: mem::size_of::<u32>() as u32,