Ver Fonte

chore(aya-ebpf): Rename BpfContext -> EbpfContext

Signed-off-by: Dave Tucker <[email protected]>
Dave Tucker há 1 ano atrás
pai
commit
d7af6acb42

+ 1 - 1
ebpf/aya-ebpf/src/lib.rs

@@ -36,7 +36,7 @@ use helpers::{bpf_get_current_comm, bpf_get_current_pid_tgid, bpf_get_current_ui
 
 pub const TASK_COMM_LEN: usize = 16;
 
-pub trait BpfContext {
+pub trait EbpfContext {
     fn as_ptr(&self) -> *mut c_void;
 
     #[inline]

+ 3 - 3
ebpf/aya-ebpf/src/maps/perf/perf_event_array.rs

@@ -4,7 +4,7 @@ use crate::{
     bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_F_CURRENT_CPU},
     helpers::bpf_perf_event_output,
     maps::PinningType,
-    BpfContext,
+    EbpfContext,
 };
 
 #[repr(transparent)]
@@ -50,11 +50,11 @@ impl<T> PerfEventArray<T> {
         }
     }
 
-    pub fn output<C: BpfContext>(&self, ctx: &C, data: &T, flags: u32) {
+    pub fn output<C: EbpfContext>(&self, ctx: &C, data: &T, flags: u32) {
         self.output_at_index(ctx, BPF_F_CURRENT_CPU as u32, data, flags)
     }
 
-    pub fn output_at_index<C: BpfContext>(&self, ctx: &C, index: u32, data: &T, flags: u32) {
+    pub fn output_at_index<C: EbpfContext>(&self, ctx: &C, index: u32, data: &T, flags: u32) {
         let flags = u64::from(flags) << 32 | u64::from(index);
         unsafe {
             bpf_perf_event_output(

+ 3 - 3
ebpf/aya-ebpf/src/maps/perf/perf_event_byte_array.rs

@@ -4,7 +4,7 @@ use crate::{
     bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_PERF_EVENT_ARRAY, BPF_F_CURRENT_CPU},
     helpers::bpf_perf_event_output,
     maps::PinningType,
-    BpfContext,
+    EbpfContext,
 };
 
 #[repr(transparent)]
@@ -47,11 +47,11 @@ impl PerfEventByteArray {
         }
     }
 
-    pub fn output<C: BpfContext>(&self, ctx: &C, data: &[u8], flags: u32) {
+    pub fn output<C: EbpfContext>(&self, ctx: &C, data: &[u8], flags: u32) {
         self.output_at_index(ctx, BPF_F_CURRENT_CPU as u32, data, flags)
     }
 
-    pub fn output_at_index<C: BpfContext>(&self, ctx: &C, index: u32, data: &[u8], flags: u32) {
+    pub fn output_at_index<C: EbpfContext>(&self, ctx: &C, index: u32, data: &[u8], flags: u32) {
         let flags = u64::from(flags) << 32 | u64::from(index);
         unsafe {
             bpf_perf_event_output(

+ 3 - 3
ebpf/aya-ebpf/src/maps/program_array.rs

@@ -6,7 +6,7 @@ use crate::{
     bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_PROG_ARRAY},
     helpers::bpf_tail_call,
     maps::PinningType,
-    BpfContext,
+    EbpfContext,
 };
 
 /// A BPF map that stores an array of program indices for tail calling.
@@ -81,7 +81,7 @@ impl ProgramArray {
     /// On success, this function **does not return** into the original program.
     /// On failure, a negative error is returned, wrapped in `Err()`.
     #[cfg(not(unstable))]
-    pub unsafe fn tail_call<C: BpfContext>(&self, ctx: &C, index: u32) -> Result<(), c_long> {
+    pub unsafe fn tail_call<C: EbpfContext>(&self, ctx: &C, index: u32) -> Result<(), c_long> {
         let res = bpf_tail_call(ctx.as_ptr(), self.def.get() as *mut _, index);
         if res != 0 {
             Err(res)
@@ -104,7 +104,7 @@ impl ProgramArray {
     /// On success, this function **does not return** into the original program.
     /// On failure, a negative error is returned, wrapped in `Err()`.
     #[cfg(unstable)]
-    pub unsafe fn tail_call<C: BpfContext>(&self, ctx: &C, index: u32) -> Result<!, c_long> {
+    pub unsafe fn tail_call<C: EbpfContext>(&self, ctx: &C, index: u32) -> Result<!, c_long> {
         let res = bpf_tail_call(ctx.as_ptr(), self.def.get() as *mut _, index);
         if res != 0 {
             Err(res)

+ 1 - 1
ebpf/aya-ebpf/src/maps/sock_hash.rs

@@ -10,7 +10,7 @@ use crate::{
     },
     maps::PinningType,
     programs::{SkBuffContext, SkLookupContext, SkMsgContext},
-    BpfContext,
+    EbpfContext,
 };
 
 #[repr(transparent)]

+ 1 - 1
ebpf/aya-ebpf/src/maps/sock_map.rs

@@ -10,7 +10,7 @@ use crate::{
     },
     maps::PinningType,
     programs::{SkBuffContext, SkLookupContext, SkMsgContext},
-    BpfContext,
+    EbpfContext,
 };
 
 #[repr(transparent)]

+ 2 - 2
ebpf/aya-ebpf/src/maps/stack_trace.rs

@@ -4,7 +4,7 @@ use crate::{
     bindings::{bpf_map_def, bpf_map_type::BPF_MAP_TYPE_STACK_TRACE},
     helpers::bpf_get_stackid,
     maps::PinningType,
-    BpfContext,
+    EbpfContext,
 };
 
 #[repr(transparent)]
@@ -45,7 +45,7 @@ impl StackTrace {
         }
     }
 
-    pub unsafe fn get_stackid<C: BpfContext>(&self, ctx: &C, flags: u64) -> Result<i64, i64> {
+    pub unsafe fn get_stackid<C: EbpfContext>(&self, ctx: &C, flags: u64) -> Result<i64, i64> {
         let ret = bpf_get_stackid(ctx.as_ptr(), self.def.get() as *mut _, flags);
         if ret < 0 {
             Err(ret)

+ 2 - 2
ebpf/aya-ebpf/src/programs/device.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{bindings::bpf_cgroup_dev_ctx, BpfContext};
+use crate::{bindings::bpf_cgroup_dev_ctx, EbpfContext};
 
 pub struct DeviceContext {
     pub device: *mut bpf_cgroup_dev_ctx,
@@ -12,7 +12,7 @@ impl DeviceContext {
     }
 }
 
-impl BpfContext for DeviceContext {
+impl EbpfContext for DeviceContext {
     fn as_ptr(&self) -> *mut c_void {
         self.device as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/fentry.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{args::FromBtfArgument, BpfContext};
+use crate::{args::FromBtfArgument, EbpfContext};
 
 pub struct FEntryContext {
     ctx: *mut c_void,
@@ -36,7 +36,7 @@ impl FEntryContext {
     }
 }
 
-impl BpfContext for FEntryContext {
+impl EbpfContext for FEntryContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/fexit.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{args::FromBtfArgument, BpfContext};
+use crate::{args::FromBtfArgument, EbpfContext};
 
 pub struct FExitContext {
     ctx: *mut c_void,
@@ -36,7 +36,7 @@ impl FExitContext {
     }
 }
 
-impl BpfContext for FExitContext {
+impl EbpfContext for FExitContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/lsm.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{args::FromBtfArgument, BpfContext};
+use crate::{args::FromBtfArgument, EbpfContext};
 
 pub struct LsmContext {
     ctx: *mut c_void,
@@ -55,7 +55,7 @@ impl LsmContext {
     }
 }
 
-impl BpfContext for LsmContext {
+impl EbpfContext for LsmContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/perf_event.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::BpfContext;
+use crate::EbpfContext;
 
 pub struct PerfEventContext {
     ctx: *mut c_void,
@@ -12,7 +12,7 @@ impl PerfEventContext {
     }
 }
 
-impl BpfContext for PerfEventContext {
+impl EbpfContext for PerfEventContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/probe.rs

@@ -6,7 +6,7 @@ use crate::bindings::pt_regs;
 use crate::bindings::user_pt_regs as pt_regs;
 #[cfg(bpf_target_arch = "riscv64")]
 use crate::bindings::user_regs_struct as pt_regs;
-use crate::{args::FromPtRegs, BpfContext};
+use crate::{args::FromPtRegs, EbpfContext};
 
 pub struct ProbeContext {
     pub regs: *mut pt_regs,
@@ -64,7 +64,7 @@ impl ProbeContext {
     }
 }
 
-impl BpfContext for ProbeContext {
+impl EbpfContext for ProbeContext {
     fn as_ptr(&self) -> *mut c_void {
         self.regs as *mut c_void
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/raw_tracepoint.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::BpfContext;
+use crate::EbpfContext;
 
 pub struct RawTracePointContext {
     ctx: *mut c_void,
@@ -12,7 +12,7 @@ impl RawTracePointContext {
     }
 }
 
-impl BpfContext for RawTracePointContext {
+impl EbpfContext for RawTracePointContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sk_buff.rs

@@ -10,7 +10,7 @@ use aya_ebpf_bindings::helpers::{
 };
 use aya_ebpf_cty::c_long;
 
-use crate::{bindings::__sk_buff, BpfContext};
+use crate::{bindings::__sk_buff, EbpfContext};
 
 pub struct SkBuff {
     pub skb: *mut __sk_buff,
@@ -430,7 +430,7 @@ impl SkBuffContext {
     }
 }
 
-impl BpfContext for SkBuffContext {
+impl EbpfContext for SkBuffContext {
     fn as_ptr(&self) -> *mut c_void {
         self.skb.as_ptr()
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sk_lookup.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{bindings::bpf_sk_lookup, BpfContext};
+use crate::{bindings::bpf_sk_lookup, EbpfContext};
 
 pub struct SkLookupContext {
     pub lookup: *mut bpf_sk_lookup,
@@ -12,7 +12,7 @@ impl SkLookupContext {
     }
 }
 
-impl BpfContext for SkLookupContext {
+impl EbpfContext for SkLookupContext {
     fn as_ptr(&self) -> *mut c_void {
         self.lookup as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sk_msg.rs

@@ -3,7 +3,7 @@ use core::ffi::c_void;
 use crate::{
     bindings::sk_msg_md,
     helpers::{bpf_msg_pop_data, bpf_msg_push_data},
-    BpfContext,
+    EbpfContext,
 };
 
 pub struct SkMsgContext {
@@ -46,7 +46,7 @@ impl SkMsgContext {
     }
 }
 
-impl BpfContext for SkMsgContext {
+impl EbpfContext for SkMsgContext {
     fn as_ptr(&self) -> *mut c_void {
         self.msg as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sock.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{bindings::bpf_sock, BpfContext};
+use crate::{bindings::bpf_sock, EbpfContext};
 
 pub struct SockContext {
     pub sock: *mut bpf_sock,
@@ -12,7 +12,7 @@ impl SockContext {
     }
 }
 
-impl BpfContext for SockContext {
+impl EbpfContext for SockContext {
     fn as_ptr(&self) -> *mut c_void {
         self.sock as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sock_addr.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{bindings::bpf_sock_addr, BpfContext};
+use crate::{bindings::bpf_sock_addr, EbpfContext};
 
 pub struct SockAddrContext {
     pub sock_addr: *mut bpf_sock_addr,
@@ -12,7 +12,7 @@ impl SockAddrContext {
     }
 }
 
-impl BpfContext for SockAddrContext {
+impl EbpfContext for SockAddrContext {
     fn as_ptr(&self) -> *mut c_void {
         self.sock_addr as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sock_ops.rs

@@ -2,7 +2,7 @@ use core::ffi::c_void;
 
 use aya_ebpf_bindings::helpers::bpf_sock_ops_cb_flags_set;
 
-use crate::{bindings::bpf_sock_ops, BpfContext};
+use crate::{bindings::bpf_sock_ops, EbpfContext};
 
 pub struct SockOpsContext {
     pub ops: *mut bpf_sock_ops,
@@ -63,7 +63,7 @@ impl SockOpsContext {
     }
 }
 
-impl BpfContext for SockOpsContext {
+impl EbpfContext for SockOpsContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ops as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sockopt.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{bindings::bpf_sockopt, BpfContext};
+use crate::{bindings::bpf_sockopt, EbpfContext};
 
 pub struct SockoptContext {
     pub sockopt: *mut bpf_sockopt,
@@ -12,7 +12,7 @@ impl SockoptContext {
     }
 }
 
-impl BpfContext for SockoptContext {
+impl EbpfContext for SockoptContext {
     fn as_ptr(&self) -> *mut c_void {
         self.sockopt as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/sysctl.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{bindings::bpf_sysctl, BpfContext};
+use crate::{bindings::bpf_sysctl, EbpfContext};
 
 pub struct SysctlContext {
     pub sysctl: *mut bpf_sysctl,
@@ -12,7 +12,7 @@ impl SysctlContext {
     }
 }
 
-impl BpfContext for SysctlContext {
+impl EbpfContext for SysctlContext {
     fn as_ptr(&self) -> *mut c_void {
         self.sysctl as *mut _
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/tc.rs

@@ -1,6 +1,6 @@
 use aya_ebpf_cty::{c_long, c_void};
 
-use crate::{bindings::__sk_buff, programs::sk_buff::SkBuff, BpfContext};
+use crate::{bindings::__sk_buff, programs::sk_buff::SkBuff, EbpfContext};
 
 pub struct TcContext {
     pub skb: SkBuff,
@@ -187,7 +187,7 @@ impl TcContext {
     }
 }
 
-impl BpfContext for TcContext {
+impl EbpfContext for TcContext {
     fn as_ptr(&self) -> *mut c_void {
         self.skb.as_ptr()
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/tp_btf.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{args::FromBtfArgument, BpfContext};
+use crate::{args::FromBtfArgument, EbpfContext};
 
 pub struct BtfTracePointContext {
     ctx: *mut c_void,
@@ -45,7 +45,7 @@ impl BtfTracePointContext {
     }
 }
 
-impl BpfContext for BtfTracePointContext {
+impl EbpfContext for BtfTracePointContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/tracepoint.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{helpers::bpf_probe_read, BpfContext};
+use crate::{helpers::bpf_probe_read, EbpfContext};
 
 pub struct TracePointContext {
     ctx: *mut c_void,
@@ -16,7 +16,7 @@ impl TracePointContext {
     }
 }
 
-impl BpfContext for TracePointContext {
+impl EbpfContext for TracePointContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx
     }

+ 2 - 2
ebpf/aya-ebpf/src/programs/xdp.rs

@@ -1,6 +1,6 @@
 use core::ffi::c_void;
 
-use crate::{bindings::xdp_md, BpfContext};
+use crate::{bindings::xdp_md, EbpfContext};
 
 pub struct XdpContext {
     pub ctx: *mut xdp_md,
@@ -34,7 +34,7 @@ impl XdpContext {
     }
 }
 
-impl BpfContext for XdpContext {
+impl EbpfContext for XdpContext {
     fn as_ptr(&self) -> *mut c_void {
         self.ctx as *mut _
     }