aya: Remove MapError::InvalidPinPath

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/355/head
Dave Tucker 2 years ago
parent 8e6c9ad0d2
commit 03a15b9864

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

Loading…
Cancel
Save