From f04f2d033a66db8cf20f9ade1efa980223decc05 Mon Sep 17 00:00:00 2001 From: Tamir Duberstein Date: Mon, 18 Sep 2023 11:46:18 -0400 Subject: [PATCH] maps: sort variants --- aya/src/maps/mod.rs | 78 ++++++++++++++++++++++----------------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/aya/src/maps/mod.rs b/aya/src/maps/mod.rs index ae32e541f..43cfc5be1 100644 --- a/aya/src/maps/mod.rs +++ b/aya/src/maps/mod.rs @@ -194,7 +194,7 @@ pub enum MapError { } // Note that this is not just derived using #[from] because InvalidMapTypeError cannot implement -// Error due the the fact that aya-obj is nostd and error_in_core is not stabilized +// Error due the the fact that aya-obj is no_std and error_in_core is not stabilized // (https://github.com/rust-lang/rust/issues/103765). impl From for MapError { fn from(e: InvalidMapTypeError) -> Self { @@ -253,44 +253,44 @@ fn maybe_warn_rlimit() { pub enum Map { /// An [`Array`] map. Array(MapData), - /// A [`PerCpuArray`] map. - PerCpuArray(MapData), - /// A [`ProgramArray`] map. - ProgramArray(MapData), + /// A [`BloomFilter`] map. + BloomFilter(MapData), + /// A [`CpuMap`] map. + CpuMap(MapData), + /// A [`DevMap`] map. + DevMap(MapData), + /// A [`DevMapHash`] map. + DevMapHash(MapData), /// A [`HashMap`] map. HashMap(MapData), - /// A [`PerCpuHashMap`] map. - PerCpuHashMap(MapData), + /// A [`LpmTrie`] map. + LpmTrie(MapData), /// A [`HashMap`] map that uses a LRU eviction policy. LruHashMap(MapData), + /// A [`PerCpuArray`] map + PerCpuArray(MapData), + /// A [`PerCpuHashMap`] map + PerCpuHashMap(MapData), /// A [`PerCpuHashMap`] map that uses a LRU eviction policy. PerCpuLruHashMap(MapData), /// A [`PerfEventArray`] map. PerfEventArray(MapData), - /// A [`SockMap`] map. - SockMap(MapData), + /// A [`ProgramArray`] map. + ProgramArray(MapData), + /// A [`Queue`] map. + Queue(MapData), /// A [`SockHash`] map. SockHash(MapData), - /// A [`BloomFilter`] map. - BloomFilter(MapData), - /// A [`LpmTrie`] map. - LpmTrie(MapData), + /// A [`SockMap`] map. + SockMap(MapData), /// A [`Stack`] map. Stack(MapData), /// A [`StackTraceMap`] map. 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. Unsupported(MapData), + /// A [`XskMap`] map. + XskMap(MapData), } impl Map { @@ -298,25 +298,25 @@ impl Map { fn map_type(&self) -> u32 { match self { Self::Array(map) => map.obj.map_type(), - Self::PerCpuArray(map) => map.obj.map_type(), - Self::ProgramArray(map) => map.obj.map_type(), + Self::BloomFilter(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::LpmTrie(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::PerCpuLruHashMap(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::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::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::XskMap(map) => map.obj.map_type(), } } } @@ -371,13 +371,13 @@ macro_rules! impl_try_from_map { } impl_try_from_map!(() { - ProgramArray, - SockMap, - PerfEventArray, - StackTraceMap, CpuMap, DevMap, DevMapHash, + PerfEventArray, + ProgramArray, + SockMap, + StackTraceMap, XskMap, }); @@ -389,17 +389,17 @@ impl_try_from_map!(() { impl_try_from_map!((V) { Array, - PerCpuArray, - SockHash, BloomFilter, + PerCpuArray, Queue, + SockHash, Stack, }); impl_try_from_map!((K, V) { HashMap from HashMap|LruHashMap, - PerCpuHashMap from PerCpuHashMap|PerCpuLruHashMap, LpmTrie, + PerCpuHashMap from PerCpuHashMap|PerCpuLruHashMap, }); pub(crate) fn check_bounds(map: &MapData, index: u32) -> Result<(), MapError> {