Struct redbpf::Map [−][src]
Fields
name: String
kind: 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");