From f642921feec9feaaae38eaf90a35d369750bac4e Mon Sep 17 00:00:00 2001 From: Michal Rostecki Date: Fri, 12 Apr 2024 09:21:06 +0200 Subject: [PATCH] chore: Use `aya`, `aya-ebpf` and `aya-log` from crates.io --- {{project-name}}-common/Cargo.toml | 2 +- {{project-name}}-ebpf/Cargo.toml | 4 ++-- {{project-name}}/Cargo.toml | 4 ++-- {{project-name}}/src/main.rs | 10 +++++----- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/{{project-name}}-common/Cargo.toml b/{{project-name}}-common/Cargo.toml index 6cd39be..d7532fc 100644 --- a/{{project-name}}-common/Cargo.toml +++ b/{{project-name}}-common/Cargo.toml @@ -8,7 +8,7 @@ default = [] user = ["aya"] [dependencies] -aya = { git = "https://github.com/aya-rs/aya", optional = true } +aya = { version = "0.12", optional = true } [lib] path = "src/lib.rs" diff --git a/{{project-name}}-ebpf/Cargo.toml b/{{project-name}}-ebpf/Cargo.toml index 01cfaa2..95b15cc 100644 --- a/{{project-name}}-ebpf/Cargo.toml +++ b/{{project-name}}-ebpf/Cargo.toml @@ -4,8 +4,8 @@ version = "0.1.0" edition = "2021" [dependencies] -aya-ebpf = { git = "https://github.com/aya-rs/aya" } -aya-log-ebpf = { git = "https://github.com/aya-rs/aya" } +aya-ebpf = "0.1.0" +aya-log-ebpf = "0.1.0" {{ project-name }}-common = { path = "../{{ project-name }}-common" } [[bin]] diff --git a/{{project-name}}/Cargo.toml b/{{project-name}}/Cargo.toml index a869e6e..a6a655d 100644 --- a/{{project-name}}/Cargo.toml +++ b/{{project-name}}/Cargo.toml @@ -5,8 +5,8 @@ edition = "2021" publish = false [dependencies] -aya = { git = "https://github.com/aya-rs/aya", features = ["async_tokio"] } -aya-log = { git = "https://github.com/aya-rs/aya" } +aya = "0.12" +aya-log = "0.2" {% if program_types_with_opts contains program_type -%} clap = { version = "4.1", features = ["derive"] } {% endif -%} diff --git a/{{project-name}}/src/main.rs b/{{project-name}}/src/main.rs index c6a1fa3..b7ceca5 100644 --- a/{{project-name}}/src/main.rs +++ b/{{project-name}}/src/main.rs @@ -39,8 +39,8 @@ use aya::programs::SocketFilter; {%- when "raw_tracepoint" -%} use aya::programs::RawTracePoint; {%- endcase %} -use aya::{include_bytes_aligned, Ebpf}; -use aya_log::EbpfLogger; +use aya::{include_bytes_aligned, Bpf}; +use aya_log::BpfLogger; {% if program_types_with_opts contains program_type -%} use clap::Parser; {% endif -%} @@ -86,14 +86,14 @@ async fn main() -> Result<(), anyhow::Error> { // like to specify the eBPF program at runtime rather than at compile-time, you can // reach for `Bpf::load_file` instead. #[cfg(debug_assertions)] - let mut bpf = Ebpf::load(include_bytes_aligned!( + let mut bpf = Bpf::load(include_bytes_aligned!( "../../target/bpfel-unknown-none/debug/{{project-name}}" ))?; #[cfg(not(debug_assertions))] - let mut bpf = Ebpf::load(include_bytes_aligned!( + let mut bpf = Bpf::load(include_bytes_aligned!( "../../target/bpfel-unknown-none/release/{{project-name}}" ))?; - if let Err(e) = EbpfLogger::init(&mut bpf) { + if let Err(e) = BpfLogger::init(&mut bpf) { // This can happen if you remove all log statements from your eBPF program. warn!("failed to initialize eBPF logger: {}", e); }