Struct redbpf::Map[][src]

pub struct Map {
    pub name: String,
    pub kind: u32,
    // some fields omitted
}
Expand description

A base BPF map data structure

It is a base data structure that contains a map definition and auxiliary data. It just hods data but it does not provide any useful API to users. See HashMap, LruHashMap, PerCpuHashMap, LruPerCpuHashMap, Array, PerCpuArray that wrap Map to provide API of BPF maps to userspace programs.

Fields

name: Stringkind: u32

Implementations

Create Map from a file which represents pinned map

Example
use redbpf::{Array, Map};
let map = Map::from_pin_file("/sys/fs/bpf/persist_map").expect("error on creating map from file");
let array = Array::<u64>::new(&map).expect("error on creating array");

Pin map to BPF FS

Example
use redbpf::Module;
use redbpf::load::Loader;
let mut loaded = Loader::load_file("file.elf").expect("error loading probe");
loaded.map_mut("persist_map").expect("map not found").pin("/sys/fs/bpf/persist_map").expect("error on pinning");

Unpin map

Example
use redbpf::Module;
use redbpf::load::Loader;
let mut loaded = Loader::load_file("file.elf").expect("error loading probe");
let persist_map = loaded.map_mut("persist_map").expect("map not found");
persist_map.pin("/sys/fs/bpf/persist_map").expect("error on pinning");
// do some stuff...
persist_map.unpin().expect("error on unpinning");

Trait Implementations

Formats the value using the given formatter. Read more

Executes the destructor for this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more