|
|
@ -1,8 +1,10 @@
|
|
|
|
use core::{cell::UnsafeCell, marker::PhantomData, mem, ptr::NonNull};
|
|
|
|
use core::{cell::UnsafeCell, marker::PhantomData, mem, ptr::NonNull};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
use aya_ebpf_cty::c_long;
|
|
|
|
|
|
|
|
|
|
|
|
use crate::{
|
|
|
|
use crate::{
|
|
|
|
bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_ARRAY},
|
|
|
|
bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_ARRAY},
|
|
|
|
lookup,
|
|
|
|
insert, lookup,
|
|
|
|
maps::PinningType,
|
|
|
|
maps::PinningType,
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
@ -65,4 +67,10 @@ impl<T> Array<T> {
|
|
|
|
unsafe fn lookup(&self, index: u32) -> Option<NonNull<T>> {
|
|
|
|
unsafe fn lookup(&self, index: u32) -> Option<NonNull<T>> {
|
|
|
|
lookup(self.def.get(), &index)
|
|
|
|
lookup(self.def.get(), &index)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/// Sets the value of the element at the given index.
|
|
|
|
|
|
|
|
#[inline(always)]
|
|
|
|
|
|
|
|
pub fn set(&self, index: u32, value: &T, flags: u64) -> Result<(), c_long> {
|
|
|
|
|
|
|
|
insert(self.def.get(), &index, value, flags)
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|