Merge pull request #813 from tamird/sort-variants

maps: sort variants
pull/814/head
Tamir Duberstein 1 year ago committed by GitHub
commit ae612a0a10
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -243,44 +243,44 @@ fn maybe_warn_rlimit() {
pub enum Map { pub enum Map {
/// An [`Array`] map. /// An [`Array`] map.
Array(MapData), Array(MapData),
/// A [`PerCpuArray`] map. /// A [`BloomFilter`] map.
PerCpuArray(MapData), BloomFilter(MapData),
/// A [`ProgramArray`] map. /// A [`CpuMap`] map.
ProgramArray(MapData), CpuMap(MapData),
/// A [`DevMap`] map.
DevMap(MapData),
/// A [`DevMapHash`] map.
DevMapHash(MapData),
/// A [`HashMap`] map. /// A [`HashMap`] map.
HashMap(MapData), HashMap(MapData),
/// A [`PerCpuHashMap`] map. /// A [`LpmTrie`] map.
PerCpuHashMap(MapData), LpmTrie(MapData),
/// A [`HashMap`] map that uses a LRU eviction policy. /// A [`HashMap`] map that uses a LRU eviction policy.
LruHashMap(MapData), LruHashMap(MapData),
/// A [`PerCpuArray`] map.
PerCpuArray(MapData),
/// A [`PerCpuHashMap`] map.
PerCpuHashMap(MapData),
/// A [`PerCpuHashMap`] map that uses a LRU eviction policy. /// A [`PerCpuHashMap`] map that uses a LRU eviction policy.
PerCpuLruHashMap(MapData), PerCpuLruHashMap(MapData),
/// A [`PerfEventArray`] map. /// A [`PerfEventArray`] map.
PerfEventArray(MapData), PerfEventArray(MapData),
/// A [`SockMap`] map. /// A [`ProgramArray`] map.
SockMap(MapData), ProgramArray(MapData),
/// A [`Queue`] map.
Queue(MapData),
/// A [`SockHash`] map. /// A [`SockHash`] map.
SockHash(MapData), SockHash(MapData),
/// A [`BloomFilter`] map. /// A [`SockMap`] map.
BloomFilter(MapData), SockMap(MapData),
/// A [`LpmTrie`] map.
LpmTrie(MapData),
/// A [`Stack`] map. /// A [`Stack`] map.
Stack(MapData), Stack(MapData),
/// A [`StackTraceMap`] map. /// A [`StackTraceMap`] map.
StackTraceMap(MapData), StackTraceMap(MapData),
/// A [`Queue`] map.
Queue(MapData),
/// A [`CpuMap`] map.
CpuMap(MapData),
/// A [`DevMap`] map.
DevMap(MapData),
/// A [`DevMapHash`] map.
DevMapHash(MapData),
/// A [`XskMap`] map.
XskMap(MapData),
/// An unsupported map type. /// An unsupported map type.
Unsupported(MapData), Unsupported(MapData),
/// A [`XskMap`] map.
XskMap(MapData),
} }
impl Map { impl Map {
@ -288,25 +288,25 @@ impl Map {
fn map_type(&self) -> u32 { fn map_type(&self) -> u32 {
match self { match self {
Self::Array(map) => map.obj.map_type(), Self::Array(map) => map.obj.map_type(),
Self::PerCpuArray(map) => map.obj.map_type(), Self::BloomFilter(map) => map.obj.map_type(),
Self::ProgramArray(map) => map.obj.map_type(), Self::CpuMap(map) => map.obj.map_type(),
Self::DevMap(map) => map.obj.map_type(),
Self::DevMapHash(map) => map.obj.map_type(),
Self::HashMap(map) => map.obj.map_type(), Self::HashMap(map) => map.obj.map_type(),
Self::LpmTrie(map) => map.obj.map_type(),
Self::LruHashMap(map) => map.obj.map_type(), Self::LruHashMap(map) => map.obj.map_type(),
Self::PerCpuArray(map) => map.obj.map_type(),
Self::PerCpuHashMap(map) => map.obj.map_type(), Self::PerCpuHashMap(map) => map.obj.map_type(),
Self::PerCpuLruHashMap(map) => map.obj.map_type(), Self::PerCpuLruHashMap(map) => map.obj.map_type(),
Self::PerfEventArray(map) => map.obj.map_type(), Self::PerfEventArray(map) => map.obj.map_type(),
Self::ProgramArray(map) => map.obj.map_type(),
Self::Queue(map) => map.obj.map_type(),
Self::SockHash(map) => map.obj.map_type(), Self::SockHash(map) => map.obj.map_type(),
Self::SockMap(map) => map.obj.map_type(), Self::SockMap(map) => map.obj.map_type(),
Self::BloomFilter(map) => map.obj.map_type(),
Self::LpmTrie(map) => map.obj.map_type(),
Self::Stack(map) => map.obj.map_type(), Self::Stack(map) => map.obj.map_type(),
Self::StackTraceMap(map) => map.obj.map_type(), Self::StackTraceMap(map) => map.obj.map_type(),
Self::Queue(map) => map.obj.map_type(),
Self::CpuMap(map) => map.obj.map_type(),
Self::DevMap(map) => map.obj.map_type(),
Self::DevMapHash(map) => map.obj.map_type(),
Self::XskMap(map) => map.obj.map_type(),
Self::Unsupported(map) => map.obj.map_type(), Self::Unsupported(map) => map.obj.map_type(),
Self::XskMap(map) => map.obj.map_type(),
} }
} }
@ -442,13 +442,13 @@ macro_rules! impl_try_from_map {
} }
impl_try_from_map!(() { impl_try_from_map!(() {
ProgramArray,
SockMap,
PerfEventArray,
StackTraceMap,
CpuMap, CpuMap,
DevMap, DevMap,
DevMapHash, DevMapHash,
PerfEventArray,
ProgramArray,
SockMap,
StackTraceMap,
XskMap, XskMap,
}); });
@ -460,17 +460,17 @@ impl_try_from_map!(() {
impl_try_from_map!((V) { impl_try_from_map!((V) {
Array, Array,
PerCpuArray,
SockHash,
BloomFilter, BloomFilter,
PerCpuArray,
Queue, Queue,
SockHash,
Stack, Stack,
}); });
impl_try_from_map!((K, V) { impl_try_from_map!((K, V) {
HashMap from HashMap|LruHashMap, HashMap from HashMap|LruHashMap,
PerCpuHashMap from PerCpuHashMap|PerCpuLruHashMap,
LpmTrie, LpmTrie,
PerCpuHashMap from PerCpuHashMap|PerCpuLruHashMap,
}); });
pub(crate) fn check_bounds(map: &MapData, index: u32) -> Result<(), MapError> { pub(crate) fn check_bounds(map: &MapData, index: u32) -> Result<(), MapError> {

Loading…
Cancel
Save