pub type OpenMapMut<'obj> = OpenMapImpl<'obj, Mut>;
Expand description
A mutable parsed but not yet loaded BPF map.
Aliased Type§
pub struct OpenMapMut<'obj> { /* private fields */ }
Implementations§
Source§impl<'obj> OpenMapMut<'obj>
impl<'obj> OpenMapMut<'obj>
Sourcepub fn new_mut(object: &'obj mut bpf_map) -> Self
pub fn new_mut(object: &'obj mut bpf_map) -> Self
Create a new OpenMapMut
from a ptr to a libbpf_sys::bpf_map
.
Sourcepub fn initial_value_mut(&mut self) -> Option<&mut [u8]>
pub fn initial_value_mut(&mut self) -> Option<&mut [u8]>
Retrieve the initial value of the map.
Sourcepub fn set_map_ifindex(&mut self, idx: u32)
pub fn set_map_ifindex(&mut self, idx: u32)
Bind map to a particular network device.
Used for offloading maps to hardware.
Sourcepub fn set_initial_value(&mut self, data: &[u8]) -> Result<()>
pub fn set_initial_value(&mut self, data: &[u8]) -> Result<()>
Set the initial value of the map.
Sourcepub fn set_key_size(&mut self, size: u32) -> Result<()>
pub fn set_key_size(&mut self, size: u32) -> Result<()>
Set the key size of the map in bytes.
Sourcepub fn set_value_size(&mut self, size: u32) -> Result<()>
pub fn set_value_size(&mut self, size: u32) -> Result<()>
Set the value size of the map in bytes.
Sourcepub fn set_max_entries(&mut self, count: u32) -> Result<()>
pub fn set_max_entries(&mut self, count: u32) -> Result<()>
Set the maximum number of entries this map can have.
Sourcepub fn set_map_flags(&mut self, flags: u32) -> Result<()>
pub fn set_map_flags(&mut self, flags: u32) -> Result<()>
Set flags on this map.
Sourcepub fn set_numa_node(&mut self, numa_node: u32) -> Result<()>
pub fn set_numa_node(&mut self, numa_node: u32) -> Result<()>
Set the NUMA node for this map.
This can be used to ensure that the map is allocated on a particular NUMA node, which can be useful for performance-critical applications.
Sourcepub fn set_inner_map_fd(&mut self, inner_map_fd: BorrowedFd<'_>) -> Result<()>
pub fn set_inner_map_fd(&mut self, inner_map_fd: BorrowedFd<'_>) -> Result<()>
Set the inner map FD.
This is used for nested maps, where the value type of the outer map is a pointer to the inner map.
Sourcepub fn set_map_extra(&mut self, map_extra: u64) -> Result<()>
pub fn set_map_extra(&mut self, map_extra: u64) -> Result<()>
Set the map_extra
field for this map.
Allows users to pass additional data to the
kernel when loading the map. The kernel will store this value in the
bpf_map_info
struct associated with the map.
This can be used to pass data to the kernel that is not otherwise
representable via the existing bpf_map_def
fields.
Sourcepub fn set_autocreate(&mut self, autocreate: bool) -> Result<()>
pub fn set_autocreate(&mut self, autocreate: bool) -> Result<()>
Set whether or not libbpf should automatically create this map during load phase.
Sourcepub fn set_pin_path<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
pub fn set_pin_path<P: AsRef<Path>>(&mut self, path: P) -> Result<()>
Set where the map should be pinned.
Note this does not actually create the pin.
Sourcepub fn reuse_fd(&mut self, fd: BorrowedFd<'_>) -> Result<()>
pub fn reuse_fd(&mut self, fd: BorrowedFd<'_>) -> Result<()>
Reuse an fd for a BPF map
Methods from Deref<Target = OpenMap<'obj>>§
Sourcepub fn initial_value(&self) -> Option<&[u8]>
pub fn initial_value(&self) -> Option<&[u8]>
Retrieve the initial value of the map.
Sourcepub fn max_entries(&self) -> u32
pub fn max_entries(&self) -> u32
Retrieve the maximum number of entries of the map.