/// Map data defined in `maps` or `.maps` sections
#[derive(Debug, Clone)]
pubenumMap{
/// A map defined in the `maps` section
Legacy(LegacyMap),
/// A map defined in the `.maps` section
Btf(BtfMap),
}
implMap{
/// Returns the map type
pubfnmap_type(&self)-> u32{
matchself{
Map::Legacy(m)=>m.def.map_type,
Map::Btf(m)=>m.def.map_type,
}
}
/// Returns the key size in bytes
pubfnkey_size(&self)-> u32{
matchself{
Map::Legacy(m)=>m.def.key_size,
Map::Btf(m)=>m.def.key_size,
}
}
/// Returns the value size in bytes
pubfnvalue_size(&self)-> u32{
matchself{
Map::Legacy(m)=>m.def.value_size,
Map::Btf(m)=>m.def.value_size,
}
}
/// Returns the max entry number
pubfnmax_entries(&self)-> u32{
matchself{
Map::Legacy(m)=>m.def.max_entries,
Map::Btf(m)=>m.def.max_entries,
}
}
/// Sets the max entry number
pubfnset_max_entries(&mutself,v: u32){
matchself{
Map::Legacy(m)=>m.def.max_entries=v,
Map::Btf(m)=>m.def.max_entries=v,
}
}
/// Returns the map flags
pubfnmap_flags(&self)-> u32{
matchself{
Map::Legacy(m)=>m.def.map_flags,
Map::Btf(m)=>m.def.map_flags,
}
}
/// Returns the pinning type of the map
pubfnpinning(&self)-> PinningType{
matchself{
Map::Legacy(m)=>m.def.pinning,
Map::Btf(m)=>m.def.pinning,
}
}
/// Returns the map data
pubfndata(&self)-> &[u8]{
matchself{
Map::Legacy(m)=>&m.data,
Map::Btf(m)=>&m.data,
}
}
/// Returns the map data as mutable
pubfndata_mut(&mutself)-> &mutVec<u8>{
matchself{
Map::Legacy(m)=>m.data.as_mut(),
Map::Btf(m)=>m.data.as_mut(),
}
}
/// Returns the map kind
pubfnkind(&self)-> MapKind{
matchself{
Map::Legacy(m)=>m.kind,
Map::Btf(m)=>m.kind,
}
}
/// Returns the section index
pubfnsection_index(&self)-> usize{
matchself{
Map::Legacy(m)=>m.section_index,
Map::Btf(m)=>m.section_index,
}
}
/// Returns the symbol index
pubfnsymbol_index(&self)-> usize{
matchself{
Map::Legacy(m)=>m.symbol_index,
Map::Btf(m)=>m.symbol_index,
}
}
}
/// A map declared with legacy BPF map declaration style, most likely from a `maps` section.
///
/// See [Drop support for legacy BPF map declaration syntax - Libbpf: the road to v1.0](https://github.com/libbpf/libbpf/wiki/Libbpf:-the-road-to-v1.0#drop-support-for-legacy-bpf-map-declaration-syntax)
/// for more info.
#[derive(Debug, Clone)]
pubstructLegacyMap{
/// The definition of the map
pubdef: bpf_map_def,
/// The section index
pubsection_index: usize,
/// The symbol index
pubsymbol_index: usize,
/// The map data
pubdata: Vec<u8>,
/// The map kind
pubkind: MapKind,
}
/// A BTF-defined map, most likely from a `.maps` section.