diff --git a/Cargo.toml b/Cargo.toml index 8b9668c..d0d3678 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,6 +9,7 @@ default-members = ["{{project-name}}", "{{project-name}}-common"] [workspace.package] license = "MIT OR Apache-2.0" +edition = "2024" [workspace.dependencies] aya = { version = "0.13.1", default-features = false } diff --git a/{{project-name}}-common/Cargo.toml b/{{project-name}}-common/Cargo.toml index 9665847..cb8ad24 100644 --- a/{{project-name}}-common/Cargo.toml +++ b/{{project-name}}-common/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "{{project-name}}-common" version = "0.1.0" -edition = "2021" +edition.workspace = true license.workspace = true diff --git a/{{project-name}}-ebpf/Cargo.toml b/{{project-name}}-ebpf/Cargo.toml index 8c4a0f3..370ea43 100644 --- a/{{project-name}}-ebpf/Cargo.toml +++ b/{{project-name}}-ebpf/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "{{ project-name }}-ebpf" version = "0.1.0" -edition = "2021" +edition.workspace = true [dependencies] {{ project-name }}-common = { path = "../{{ project-name }}-common" } diff --git a/{{project-name}}-ebpf/src/main.rs b/{{project-name}}-ebpf/src/main.rs index b9eb9cf..18233ae 100644 --- a/{{project-name}}-ebpf/src/main.rs +++ b/{{project-name}}-ebpf/src/main.rs @@ -290,7 +290,7 @@ fn try_{{crate_name}}(ctx: RawTracePointContext) -> Result { } {%- when "perf_event" %} use aya_ebpf::{ - helpers::bpf_get_smp_processor_id, macros::perf_event, programs::PerfEventContext, EbpfContext, + EbpfContext, helpers::bpf_get_smp_processor_id, macros::perf_event, programs::PerfEventContext, }; use aya_log_ebpf::info; @@ -325,6 +325,6 @@ fn panic(_info: &core::panic::PanicInfo) -> ! { loop {} } -#[link_section = "license"] -#[no_mangle] +#[unsafe(link_section = "license")] +#[unsafe(no_mangle)] static LICENSE: [u8; 13] = *b"Dual MIT/GPL\0"; diff --git a/{{project-name}}/Cargo.toml b/{{project-name}}/Cargo.toml index eb69e56..5b34957 100644 --- a/{{project-name}}/Cargo.toml +++ b/{{project-name}}/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "{{project-name}}" version = "0.1.0" -edition = "2021" +edition.workspace = true license.workspace = true diff --git a/{{project-name}}/build.rs b/{{project-name}}/build.rs index 2e7e132..6e2ce43 100644 --- a/{{project-name}}/build.rs +++ b/{{project-name}}/build.rs @@ -1,4 +1,4 @@ -use anyhow::{anyhow, Context as _}; +use anyhow::{Context as _, anyhow}; use aya_build::cargo_metadata; fn main() -> anyhow::Result<()> { diff --git a/{{project-name}}/src/main.rs b/{{project-name}}/src/main.rs index c1d3483..5c6e8b9 100644 --- a/{{project-name}}/src/main.rs +++ b/{{project-name}}/src/main.rs @@ -3,15 +3,15 @@ use aya::programs::KProbe; {%- when "fentry" -%} use anyhow::Context as _; -use aya::{programs::FEntry, Btf}; +use aya::{Btf, programs::FEntry}; {%- when "fexit" -%} use anyhow::Context as _; -use aya::{programs::FExit, Btf}; +use aya::{Btf, programs::FExit}; {%- when "uprobe", "uretprobe" -%} use aya::programs::UProbe; {%- when "sock_ops" -%} use anyhow::Context as _; -use aya::programs::{links::CgroupAttachMode, SockOps}; +use aya::programs::{SockOps, links::CgroupAttachMode}; {%- when "sk_msg" -%} use aya::{maps::SockHash, programs::SkMsg}; use {{crate_name}}_common::SockKey; @@ -19,27 +19,27 @@ use {{crate_name}}_common::SockKey; use anyhow::Context as _; use aya::programs::{Xdp, XdpFlags}; {%- when "classifier" -%} -use aya::programs::{tc, SchedClassifier, TcAttachType}; +use aya::programs::{SchedClassifier, TcAttachType, tc}; {%- when "cgroup_skb" -%} use anyhow::Context as _; -use aya::programs::{links::CgroupAttachMode, CgroupSkb, CgroupSkbAttachType}; +use aya::programs::{CgroupSkb, CgroupSkbAttachType, links::CgroupAttachMode}; {%- when "cgroup_sysctl" -%} use anyhow::Context as _; -use aya::programs::{links::CgroupAttachMode, CgroupSysctl}; +use aya::programs::{CgroupSysctl, links::CgroupAttachMode}; {%- when "cgroup_sockopt" -%} use anyhow::Context as _; -use aya::programs::{links::CgroupAttachMode, CgroupSockopt}; +use aya::programs::{CgroupSockopt, links::CgroupAttachMode}; {%- when "tracepoint" -%} use aya::programs::TracePoint; {%- when "lsm" -%} -use aya::{programs::Lsm, Btf}; +use aya::{Btf, programs::Lsm}; {%- when "perf_event" -%} use aya::{ - programs::{perf_event, PerfEvent}, + programs::{PerfEvent, perf_event}, util::online_cpus, }; {%- when "tp_btf" -%} -use aya::{programs::BtfTracePoint, Btf}; +use aya::{Btf, programs::BtfTracePoint}; {%- when "socket_filter" -%} use aya::programs::SocketFilter; {%- when "raw_tracepoint" -%}