profile-bee-aya 0.13.2

An eBPF library with a focus on developer experience and operability. Fork of aya for profile-bee.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
//! Support for BPF maps that contain references to other maps.
mod array;
mod hash_map;

pub use array::ArrayOfMaps;
pub use hash_map::HashOfMaps;

use super::{FromMapData, MapData, MapError};

/// Converts a map ID returned by the kernel into a typed map.
///
/// The kernel's map-of-maps API is asymmetric: update takes the FD of the inner map,
/// but lookup returns the ID. This helper converts the ID back to an FD and constructs
/// the typed map via [`FromMapData`].
fn map_from_id<M: FromMapData>(id: u32) -> Result<M, MapError> {
    let map_data = MapData::from_id(id)?;
    M::from_map_data(map_data)
}