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

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

@ -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,
Loading…
Cancel
Save