Răsfoiți Sursa

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

Signed-off-by: Dave Tucker <[email protected]>
Dave Tucker 1 an în urmă
părinte
comite
fd48c55466
2 a modificat fișierele cu 13 adăugiri și 11 ștergeri
  1. 11 9
      aya-obj/src/relocation.rs
  2. 2 2
      aya/src/bpf.rs

+ 11 - 9
aya-obj/src/relocation.rs

@@ -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`]
 #[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<usize>,
-    ) -> 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<usize>,
-    ) -> 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);
         }

+ 2 - 2
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")]