Skip to content

Commit

Permalink
chore: Use aya, aya-ebpf and aya-log from crates.io
Browse files Browse the repository at this point in the history
  • Loading branch information
vadorovsky committed Apr 16, 2024
1 parent 97e817d commit f642921
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 10 deletions.
2 changes: 1 addition & 1 deletion {{project-name}}-common/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
4 changes: 2 additions & 2 deletions {{project-name}}-ebpf/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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]]
Expand Down
4 changes: 2 additions & 2 deletions {{project-name}}/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
Expand Down
10 changes: 5 additions & 5 deletions {{project-name}}/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 -%}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit f642921

Please sign in to comment.