From ed53f7470b386f3a870e34399bbb52c6ea72d07d Mon Sep 17 00:00:00 2001 From: Alessandro Decina Date: Wed, 24 Feb 2021 05:58:08 +0000 Subject: [PATCH] aya: maps: add Map::name() and Map::map_type() --- aya/src/maps/mod.rs | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/aya/src/maps/mod.rs b/aya/src/maps/mod.rs index cd58eac8..c730bf53 100644 --- a/aya/src/maps/mod.rs +++ b/aya/src/maps/mod.rs @@ -104,6 +104,14 @@ impl Map { Ok(fd) } + pub fn name(&self) -> &str { + &self.obj.name + } + + pub fn map_type(&self) -> Result { + bpf_map_type::try_from(self.obj.def.map_type) + } + pub(crate) fn fd_or_err(&self) -> Result { self.fd.ok_or_else(|| MapError::NotCreated { name: self.obj.name.clone(),