Browse Source

Merge pull request #355 from dave-tucker/rm-map-pin-path

aya: Remove MapError::InvalidPinPath
Dave Tucker 2 years ago
parent
commit
55a7e3c4d0
1 changed files with 1 additions and 15 deletions
  1. 1 15
      aya/src/maps/mod.rs

+ 1 - 15
aya/src/maps/mod.rs

@@ -102,13 +102,6 @@ pub enum MapError {
         name: String,
     },
 
-    /// Pin path is invalid
-    #[error("invalid map path `{error}`")]
-    InvalidPinPath {
-        /// The error message
-        error: String,
-    },
-
     /// The map has not been created
     #[error("the map has not been created")]
     NotCreated,
@@ -300,14 +293,7 @@ impl Map {
             return Err(MapError::AlreadyCreated { name: name.into() });
         }
         let map_path = path.as_ref().join(name);
-        let path_string = match CString::new(map_path.to_str().unwrap()) {
-            Ok(s) => s,
-            Err(e) => {
-                return Err(MapError::InvalidPinPath {
-                    error: e.to_string(),
-                })
-            }
-        };
+        let path_string = CString::new(map_path.to_str().unwrap()).unwrap();
         let fd =
             bpf_get_object(&path_string).map_err(|(code, io_error)| MapError::SyscallError {
                 call: "BPF_OBJ_GET".to_string(),