feat(aya-obj)!: Rename BpfRelocationError -> EbpfRelocationError

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/528/head
Dave Tucker 7 months ago
parent d7af6acb42
commit fd48c55466

@ -24,7 +24,7 @@ pub(crate) const INS_SIZE: usize = mem::size_of::<bpf_insn>();
/// The error type returned by [`Object::relocate_maps`] and [`Object::relocate_calls`] /// The error type returned by [`Object::relocate_maps`] and [`Object::relocate_calls`]
#[derive(thiserror::Error, Debug)] #[derive(thiserror::Error, Debug)]
#[error("error relocating `{function}`")] #[error("error relocating `{function}`")]
pub struct BpfRelocationError { pub struct EbpfRelocationError {
/// The function name /// The function name
function: String, function: String,
#[source] #[source]
@ -108,7 +108,7 @@ impl Object {
&mut self, &mut self,
maps: I, maps: I,
text_sections: &HashSet<usize>, text_sections: &HashSet<usize>,
) -> Result<(), BpfRelocationError> { ) -> Result<(), EbpfRelocationError> {
let mut maps_by_section = HashMap::new(); let mut maps_by_section = HashMap::new();
let mut maps_by_symbol = HashMap::new(); let mut maps_by_symbol = HashMap::new();
for (name, fd, map) in maps { for (name, fd, map) in maps {
@ -128,7 +128,7 @@ impl Object {
&self.symbol_table, &self.symbol_table,
text_sections, text_sections,
) )
.map_err(|error| BpfRelocationError { .map_err(|error| EbpfRelocationError {
function: function.name.clone(), function: function.name.clone(),
error, error,
})?; })?;
@ -142,7 +142,7 @@ impl Object {
pub fn relocate_calls( pub fn relocate_calls(
&mut self, &mut self,
text_sections: &HashSet<usize>, text_sections: &HashSet<usize>,
) -> Result<(), BpfRelocationError> { ) -> Result<(), EbpfRelocationError> {
for (name, program) in self.programs.iter() { for (name, program) in self.programs.iter() {
let linker = FunctionLinker::new( let linker = FunctionLinker::new(
&self.functions, &self.functions,
@ -154,7 +154,7 @@ impl Object {
let func_orig = let func_orig =
self.functions self.functions
.get(&program.function_key()) .get(&program.function_key())
.ok_or_else(|| BpfRelocationError { .ok_or_else(|| EbpfRelocationError {
function: name.clone(), function: name.clone(),
error: RelocationError::UnknownProgram { error: RelocationError::UnknownProgram {
section_index: program.section_index, section_index: program.section_index,
@ -162,10 +162,12 @@ impl Object {
}, },
})?; })?;
let func = linker.link(func_orig).map_err(|error| BpfRelocationError { let func = linker
function: name.to_owned(), .link(func_orig)
error, .map_err(|error| EbpfRelocationError {
})?; function: name.to_owned(),
error,
})?;
self.functions.insert(program.function_key(), func); self.functions.insert(program.function_key(), func);
} }

@ -13,7 +13,7 @@ use std::{
use aya_obj::{ use aya_obj::{
btf::{BtfFeatures, BtfRelocationError}, btf::{BtfFeatures, BtfRelocationError},
generated::{BPF_F_SLEEPABLE, BPF_F_XDP_HAS_FRAGS}, generated::{BPF_F_SLEEPABLE, BPF_F_XDP_HAS_FRAGS},
relocation::BpfRelocationError, relocation::EbpfRelocationError,
EbpfSectionKind, Features, EbpfSectionKind, Features,
}; };
use log::{debug, warn}; use log::{debug, warn};
@ -1092,7 +1092,7 @@ pub enum BpfError {
/// Error performing relocations /// Error performing relocations
#[error("error relocating function")] #[error("error relocating function")]
RelocationError(#[from] BpfRelocationError), RelocationError(#[from] EbpfRelocationError),
/// Error performing relocations /// Error performing relocations
#[error("error relocating section")] #[error("error relocating section")]

Loading…
Cancel
Save