From fd48c55466a23953ce7a4912306e1acf059b498b Mon Sep 17 00:00:00 2001 From: Dave Tucker Date: Tue, 5 Mar 2024 11:09:19 +0000 Subject: [PATCH] feat(aya-obj)!: Rename BpfRelocationError -> EbpfRelocationError Signed-off-by: Dave Tucker --- aya-obj/src/relocation.rs | 20 +++++++++++--------- aya/src/bpf.rs | 4 ++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/aya-obj/src/relocation.rs b/aya-obj/src/relocation.rs index 776e06c6..b05648ba 100644 --- a/aya-obj/src/relocation.rs +++ b/aya-obj/src/relocation.rs @@ -24,7 +24,7 @@ pub(crate) const INS_SIZE: usize = mem::size_of::(); /// The error type returned by [`Object::relocate_maps`] and [`Object::relocate_calls`] #[derive(thiserror::Error, Debug)] #[error("error relocating `{function}`")] -pub struct BpfRelocationError { +pub struct EbpfRelocationError { /// The function name function: String, #[source] @@ -108,7 +108,7 @@ impl Object { &mut self, maps: I, text_sections: &HashSet, - ) -> Result<(), BpfRelocationError> { + ) -> Result<(), EbpfRelocationError> { let mut maps_by_section = HashMap::new(); let mut maps_by_symbol = HashMap::new(); for (name, fd, map) in maps { @@ -128,7 +128,7 @@ impl Object { &self.symbol_table, text_sections, ) - .map_err(|error| BpfRelocationError { + .map_err(|error| EbpfRelocationError { function: function.name.clone(), error, })?; @@ -142,7 +142,7 @@ impl Object { pub fn relocate_calls( &mut self, text_sections: &HashSet, - ) -> Result<(), BpfRelocationError> { + ) -> Result<(), EbpfRelocationError> { for (name, program) in self.programs.iter() { let linker = FunctionLinker::new( &self.functions, @@ -154,7 +154,7 @@ impl Object { let func_orig = self.functions .get(&program.function_key()) - .ok_or_else(|| BpfRelocationError { + .ok_or_else(|| EbpfRelocationError { function: name.clone(), error: RelocationError::UnknownProgram { section_index: program.section_index, @@ -162,10 +162,12 @@ impl Object { }, })?; - let func = linker.link(func_orig).map_err(|error| BpfRelocationError { - function: name.to_owned(), - error, - })?; + let func = linker + .link(func_orig) + .map_err(|error| EbpfRelocationError { + function: name.to_owned(), + error, + })?; self.functions.insert(program.function_key(), func); } diff --git a/aya/src/bpf.rs b/aya/src/bpf.rs index ceae409f..fa3ecb03 100644 --- a/aya/src/bpf.rs +++ b/aya/src/bpf.rs @@ -13,7 +13,7 @@ use std::{ use aya_obj::{ btf::{BtfFeatures, BtfRelocationError}, generated::{BPF_F_SLEEPABLE, BPF_F_XDP_HAS_FRAGS}, - relocation::BpfRelocationError, + relocation::EbpfRelocationError, EbpfSectionKind, Features, }; use log::{debug, warn}; @@ -1092,7 +1092,7 @@ pub enum BpfError { /// Error performing relocations #[error("error relocating function")] - RelocationError(#[from] BpfRelocationError), + RelocationError(#[from] EbpfRelocationError), /// Error performing relocations #[error("error relocating section")]