bpf: rename PerfMap to PerfEventArray

pull/66/head
Alessandro Decina 3 years ago
parent 52c51895ba
commit ea91fe08d3

@ -8,7 +8,7 @@ pub(crate) enum PinningType {
pub mod array; pub mod array;
pub mod hash_map; pub mod hash_map;
pub mod per_cpu_array; pub mod per_cpu_array;
pub mod perf_map; pub mod perf;
pub mod queue; pub mod queue;
pub mod sock_hash; pub mod sock_hash;
pub mod sock_map; pub mod sock_map;
@ -17,7 +17,7 @@ pub mod stack_trace;
pub use array::Array; pub use array::Array;
pub use hash_map::HashMap; pub use hash_map::HashMap;
pub use per_cpu_array::PerCpuArray; pub use per_cpu_array::PerCpuArray;
pub use perf_map::PerfMap; pub use perf::PerfEventArray;
pub use queue::Queue; pub use queue::Queue;
pub use sock_hash::SockHash; pub use sock_hash::SockHash;
pub use sock_map::SockMap; pub use sock_map::SockMap;

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

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