libbpf_rs

Type Alias OpenMapMut

Source
pub type OpenMapMut<'obj> = OpenMapImpl<'obj, Mut>;
Expand description

A mutable parsed but not yet loaded BPF map.

Aliased Type§

struct OpenMapMut<'obj> { /* private fields */ }

Implementations§

Source§

impl<'obj> OpenMapMut<'obj>

Source

pub fn new_mut(object: &'obj mut bpf_map) -> Self

Create a new OpenMapMut from a ptr to a libbpf_sys::bpf_map.

Source

pub fn initial_value_mut(&mut self) -> Option<&mut [u8]>

Retrieve the initial value of the map.

Source

pub fn set_map_ifindex(&mut self, idx: u32)

Bind map to a particular network device.

Used for offloading maps to hardware.

Source

pub fn set_initial_value(&mut self, data: &[u8]) -> Result<()>

Set the initial value of the map.

Source

pub fn set_type(&mut self, ty: MapType) -> Result<()>

Set the type of the map.

Source

pub fn set_key_size(&mut self, size: u32) -> Result<()>

Set the key size of the map in bytes.

Source

pub fn set_value_size(&mut self, size: u32) -> Result<()>

Set the value size of the map in bytes.

Source

pub fn set_max_entries(&mut self, count: u32) -> Result<()>

Set the maximum number of entries this map can have.

Source

pub fn set_map_flags(&mut self, flags: u32) -> Result<()>

Set flags on this map.

Source

pub fn set_numa_node(&mut self, numa_node: u32) -> Result<()>

Source

pub fn set_inner_map_fd(&mut self, inner_map_fd: BorrowedFd<'_>) -> Result<()>

Source

pub fn set_map_extra(&mut self, map_extra: u64) -> Result<()>

Source

pub fn set_autocreate(&mut self, autocreate: bool) -> Result<()>

Set whether or not libbpf should automatically create this map during load phase.

Source

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.

Source

pub fn reuse_fd(&mut self, fd: BorrowedFd<'_>) -> Result<()>

Reuse an fd for a BPF map

Source

pub fn reuse_pinned_map<P: AsRef<Path>>(&mut self, path: P) -> Result<()>

Reuse an already-pinned map for self.

Methods from Deref<Target = OpenMap<'obj>>§

Source

pub fn name(&self) -> &OsStr

Retrieve the OpenMap’s name.

Source

pub fn map_type(&self) -> MapType

Retrieve type of the map.

Source

pub fn initial_value(&self) -> Option<&[u8]>

Retrieve the initial value of the map.

Trait Implementations§

Source§

impl<'obj> Deref for OpenMapMut<'obj>

Source§

type Target = OpenMapImpl<'obj>

The resulting type after dereferencing.
Source§

fn deref(&self) -> &Self::Target

Dereferences the value.