chore(aya-ebpf): Rename bpf -> ebpf

Signed-off-by: Dave Tucker <dave@dtucker.co.uk>
pull/528/head
Dave Tucker 8 months ago
parent 70ac91dc1e
commit 41c61560ea

@ -15,7 +15,7 @@ members = [
"aya-log-ebpf-macros", "aya-log-ebpf-macros",
# ebpf crates # ebpf crates
"ebpf/aya-bpf", "ebpf/aya-ebpf",
"ebpf/aya-ebpf-bindings", "ebpf/aya-ebpf-bindings",
"ebpf/aya-log-ebpf", "ebpf/aya-log-ebpf",
"test/integration-ebpf", "test/integration-ebpf",

@ -1,7 +1,7 @@
[package] [package]
name = "aya-bpf-macros" name = "aya-bpf-macros"
version = "0.1.0" version = "0.1.0"
description = "Proc macros used by aya-bpf" description = "Proc macros used by aya-ebpf"
authors.workspace = true authors.workspace = true
license.workspace = true license.workspace = true
repository.workspace = true repository.workspace = true
@ -18,4 +18,4 @@ quote = { workspace = true }
syn = { workspace = true, default-features = true, features = ["full"] } syn = { workspace = true, default-features = true, features = ["full"] }
[dev-dependencies] [dev-dependencies]
aya-bpf = { path = "../ebpf/aya-bpf", version = "0.1.0", default-features = false } aya-ebpf = { path = "../ebpf/aya-ebpf", version = "0.1.0", default-features = false }

@ -34,7 +34,7 @@ impl BtfTracePoint {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = #fn_name(::aya_bpf::programs::BtfTracePointContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::BtfTracePointContext::new(ctx));
return 0; return 0;
#item #item
@ -65,7 +65,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "tp_btf"] #[link_section = "tp_btf"]
fn foo(ctx: *mut ::core::ffi::c_void) -> i32 { fn foo(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = foo(::aya_bpf::programs::BtfTracePointContext::new(ctx)); let _ = foo(::aya_ebpf::programs::BtfTracePointContext::new(ctx));
return 0; return 0;
fn foo(ctx: BtfTracePointContext) -> i32 { fn foo(ctx: BtfTracePointContext) -> i32 {
@ -92,7 +92,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "tp_btf/some_func"] #[link_section = "tp_btf/some_func"]
fn foo(ctx: *mut ::core::ffi::c_void) -> i32 { fn foo(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = foo(::aya_bpf::programs::BtfTracePointContext::new(ctx)); let _ = foo(::aya_ebpf::programs::BtfTracePointContext::new(ctx));
return 0; return 0;
fn foo(ctx: BtfTracePointContext) -> i32 { fn foo(ctx: BtfTracePointContext) -> i32 {

@ -23,8 +23,8 @@ impl CgroupDevice {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/dev"] #[link_section = "cgroup/dev"]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::bpf_cgroup_dev_ctx) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::bpf_cgroup_dev_ctx) -> i32 {
return #fn_name(::aya_bpf::programs::DeviceContext::new(ctx)); return #fn_name(::aya_ebpf::programs::DeviceContext::new(ctx));
#item #item
} }
@ -53,8 +53,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/dev"] #[link_section = "cgroup/dev"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_cgroup_dev_ctx) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_cgroup_dev_ctx) -> i32 {
return foo(::aya_bpf::programs::DeviceContext::new(ctx)); return foo(::aya_ebpf::programs::DeviceContext::new(ctx));
fn foo(ctx: DeviceContext) -> i32 { fn foo(ctx: DeviceContext) -> i32 {
0 0

@ -37,8 +37,8 @@ impl CgroupSkb {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return #fn_name(::aya_bpf::programs::SkBuffContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SkBuffContext::new(ctx));
#item #item
} }
@ -67,8 +67,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/skb"] #[link_section = "cgroup/skb"]
fn foo(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return foo(::aya_bpf::programs::SkBuffContext::new(ctx)); return foo(::aya_ebpf::programs::SkBuffContext::new(ctx));
fn foo(ctx: SkBuffContext) -> i32 { fn foo(ctx: SkBuffContext) -> i32 {
0 0
@ -93,8 +93,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup_skb/egress"] #[link_section = "cgroup_skb/egress"]
fn foo(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return foo(::aya_bpf::programs::SkBuffContext::new(ctx)); return foo(::aya_ebpf::programs::SkBuffContext::new(ctx));
fn foo(ctx: SkBuffContext) -> i32 { fn foo(ctx: SkBuffContext) -> i32 {
0 0
@ -119,8 +119,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup_skb/ingress"] #[link_section = "cgroup_skb/ingress"]
fn foo(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return foo(::aya_bpf::programs::SkBuffContext::new(ctx)); return foo(::aya_ebpf::programs::SkBuffContext::new(ctx));
fn foo(ctx: SkBuffContext) -> i32 { fn foo(ctx: SkBuffContext) -> i32 {
0 0
@ -145,8 +145,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup_skb/egress"] #[link_section = "cgroup_skb/egress"]
fn foo(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return foo(::aya_bpf::programs::SkBuffContext::new(ctx)); return foo(::aya_ebpf::programs::SkBuffContext::new(ctx));
fn foo(ctx: SkBuffContext) -> i32 { fn foo(ctx: SkBuffContext) -> i32 {
0 0
@ -171,8 +171,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup_skb/egress"] #[link_section = "cgroup_skb/egress"]
pub fn foo(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { pub fn foo(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return foo(::aya_bpf::programs::SkBuffContext::new(ctx)); return foo(::aya_ebpf::programs::SkBuffContext::new(ctx));
pub fn foo(ctx: SkBuffContext) -> i32 { pub fn foo(ctx: SkBuffContext) -> i32 {
0 0
@ -197,8 +197,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup_skb/egress"] #[link_section = "cgroup_skb/egress"]
pub(crate) fn foo(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { pub(crate) fn foo(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return foo(::aya_bpf::programs::SkBuffContext::new(ctx)); return foo(::aya_ebpf::programs::SkBuffContext::new(ctx));
pub(crate) fn foo(ctx: SkBuffContext) -> i32 { pub(crate) fn foo(ctx: SkBuffContext) -> i32 {
0 0

@ -35,8 +35,8 @@ impl CgroupSock {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::bpf_sock) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::bpf_sock) -> i32 {
return #fn_name(::aya_bpf::programs::SockContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SockContext::new(ctx));
#item #item
} }
@ -65,8 +65,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/post_bind4"] #[link_section = "cgroup/post_bind4"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock) -> i32 {
return foo(::aya_bpf::programs::SockContext::new(ctx)); return foo(::aya_ebpf::programs::SockContext::new(ctx));
fn foo(ctx: SockContext) -> i32 { fn foo(ctx: SockContext) -> i32 {
0 0
@ -91,8 +91,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/post_bind6"] #[link_section = "cgroup/post_bind6"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock) -> i32 {
return foo(::aya_bpf::programs::SockContext::new(ctx)); return foo(::aya_ebpf::programs::SockContext::new(ctx));
fn foo(ctx: SockContext) -> i32 { fn foo(ctx: SockContext) -> i32 {
0 0
@ -116,8 +116,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/sock_create"] #[link_section = "cgroup/sock_create"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock) -> i32 {
return foo(::aya_bpf::programs::SockContext::new(ctx)); return foo(::aya_ebpf::programs::SockContext::new(ctx));
fn foo(ctx: SockContext) -> i32 { fn foo(ctx: SockContext) -> i32 {
0 0
@ -141,8 +141,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/sock_release"] #[link_section = "cgroup/sock_release"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock) -> i32 {
return foo(::aya_bpf::programs::SockContext::new(ctx)); return foo(::aya_ebpf::programs::SockContext::new(ctx));
fn foo(ctx: SockContext) -> i32 { fn foo(ctx: SockContext) -> i32 {
0 0

@ -37,8 +37,8 @@ impl CgroupSockAddr {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return #fn_name(::aya_bpf::programs::SockAddrContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SockAddrContext::new(ctx));
#item #item
} }
@ -67,8 +67,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/connect4"] #[link_section = "cgroup/connect4"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -93,8 +93,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/connect6"] #[link_section = "cgroup/connect6"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -119,8 +119,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/bind4"] #[link_section = "cgroup/bind4"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -145,8 +145,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/bind6"] #[link_section = "cgroup/bind6"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -171,8 +171,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/getpeername4"] #[link_section = "cgroup/getpeername4"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -197,8 +197,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/getpeername6"] #[link_section = "cgroup/getpeername6"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -223,8 +223,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/getsockname4"] #[link_section = "cgroup/getsockname4"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -249,8 +249,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/getsockname6"] #[link_section = "cgroup/getsockname6"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -275,8 +275,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/sendmsg4"] #[link_section = "cgroup/sendmsg4"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -301,8 +301,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/sendmsg6"] #[link_section = "cgroup/sendmsg6"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -327,8 +327,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/recvmsg4"] #[link_section = "cgroup/recvmsg4"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0
@ -353,8 +353,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/recvmsg6"] #[link_section = "cgroup/recvmsg6"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sock_addr) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sock_addr) -> i32 {
return foo(::aya_bpf::programs::SockAddrContext::new(ctx)); return foo(::aya_ebpf::programs::SockAddrContext::new(ctx));
fn foo(ctx: CgroupSockAddrContext) -> i32 { fn foo(ctx: CgroupSockAddrContext) -> i32 {
0 0

@ -35,8 +35,8 @@ impl CgroupSockopt {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::bpf_sockopt) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::bpf_sockopt) -> i32 {
return #fn_name(::aya_bpf::programs::SockoptContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SockoptContext::new(ctx));
#item #item
} }
@ -65,8 +65,8 @@ mod tests {
let expected = quote!( let expected = quote!(
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/getsockopt"] #[link_section = "cgroup/getsockopt"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sockopt) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sockopt) -> i32 {
return foo(::aya_bpf::programs::SockoptContext::new(ctx)); return foo(::aya_ebpf::programs::SockoptContext::new(ctx));
fn foo(ctx: SockoptContext) -> i32 { fn foo(ctx: SockoptContext) -> i32 {
0 0
@ -91,8 +91,8 @@ mod tests {
let expected = quote!( let expected = quote!(
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/setsockopt"] #[link_section = "cgroup/setsockopt"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sockopt) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sockopt) -> i32 {
return foo(::aya_bpf::programs::SockoptContext::new(ctx)); return foo(::aya_ebpf::programs::SockoptContext::new(ctx));
fn foo(ctx: SockoptContext) -> i32 { fn foo(ctx: SockoptContext) -> i32 {
0 0

@ -23,8 +23,8 @@ impl CgroupSysctl {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/sysctl"] #[link_section = "cgroup/sysctl"]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::bpf_sysctl) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::bpf_sysctl) -> i32 {
return #fn_name(::aya_bpf::programs::SysctlContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SysctlContext::new(ctx));
#item #item
} }
@ -53,8 +53,8 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "cgroup/sysctl"] #[link_section = "cgroup/sysctl"]
fn foo(ctx: *mut ::aya_bpf::bindings::bpf_sysctl) -> i32 { fn foo(ctx: *mut ::aya_ebpf::bindings::bpf_sysctl) -> i32 {
return foo(::aya_bpf::programs::SysctlContext::new(ctx)); return foo(::aya_ebpf::programs::SysctlContext::new(ctx));
fn foo(ctx: SysctlContext) -> i32 { fn foo(ctx: SysctlContext) -> i32 {
0 0

@ -40,7 +40,7 @@ impl FEntry {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = #fn_name(::aya_bpf::programs::FEntryContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::FEntryContext::new(ctx));
return 0; return 0;
#item #item
@ -60,7 +60,7 @@ mod tests {
let prog = FEntry::parse( let prog = FEntry::parse(
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn sys_clone(ctx: &mut aya_bpf::programs::FEntryContext) -> i32 { fn sys_clone(ctx: &mut aya_ebpf::programs::FEntryContext) -> i32 {
0 0
} }
}, },
@ -71,10 +71,10 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "fentry"] #[link_section = "fentry"]
fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 { fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = sys_clone(::aya_bpf::programs::FEntryContext::new(ctx)); let _ = sys_clone(::aya_ebpf::programs::FEntryContext::new(ctx));
return 0; return 0;
fn sys_clone(ctx: &mut aya_bpf::programs::FEntryContext) -> i32 { fn sys_clone(ctx: &mut aya_ebpf::programs::FEntryContext) -> i32 {
0 0
} }
} }
@ -89,7 +89,7 @@ mod tests {
function = "sys_clone" function = "sys_clone"
}, },
parse_quote! { parse_quote! {
fn sys_clone(ctx: &mut aya_bpf::programs::FEntryContext) -> i32 { fn sys_clone(ctx: &mut aya_ebpf::programs::FEntryContext) -> i32 {
0 0
} }
}, },
@ -100,10 +100,10 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "fentry/sys_clone"] #[link_section = "fentry/sys_clone"]
fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 { fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = sys_clone(::aya_bpf::programs::FEntryContext::new(ctx)); let _ = sys_clone(::aya_ebpf::programs::FEntryContext::new(ctx));
return 0; return 0;
fn sys_clone(ctx: &mut aya_bpf::programs::FEntryContext) -> i32 { fn sys_clone(ctx: &mut aya_ebpf::programs::FEntryContext) -> i32 {
0 0
} }
} }
@ -118,7 +118,7 @@ mod tests {
sleepable sleepable
}, },
parse_quote! { parse_quote! {
fn sys_clone(ctx: &mut aya_bpf::programs::FEntryContext) -> i32 { fn sys_clone(ctx: &mut aya_ebpf::programs::FEntryContext) -> i32 {
0 0
} }
}, },
@ -129,10 +129,10 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "fentry.s"] #[link_section = "fentry.s"]
fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 { fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = sys_clone(::aya_bpf::programs::FEntryContext::new(ctx)); let _ = sys_clone(::aya_ebpf::programs::FEntryContext::new(ctx));
return 0; return 0;
fn sys_clone(ctx: &mut aya_bpf::programs::FEntryContext) -> i32 { fn sys_clone(ctx: &mut aya_ebpf::programs::FEntryContext) -> i32 {
0 0
} }
} }

@ -40,7 +40,7 @@ impl FExit {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = #fn_name(::aya_bpf::programs::FExitContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::FExitContext::new(ctx));
return 0; return 0;
#item #item
@ -71,7 +71,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "fexit"] #[link_section = "fexit"]
fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 { fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = sys_clone(::aya_bpf::programs::FExitContext::new(ctx)); let _ = sys_clone(::aya_ebpf::programs::FExitContext::new(ctx));
return 0; return 0;
fn sys_clone(ctx: &mut FExitContext) -> i32 { fn sys_clone(ctx: &mut FExitContext) -> i32 {
@ -100,7 +100,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "fexit/sys_clone"] #[link_section = "fexit/sys_clone"]
fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 { fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = sys_clone(::aya_bpf::programs::FExitContext::new(ctx)); let _ = sys_clone(::aya_ebpf::programs::FExitContext::new(ctx));
return 0; return 0;
fn sys_clone(ctx: &mut FExitContext) -> i32 { fn sys_clone(ctx: &mut FExitContext) -> i32 {
@ -129,7 +129,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "fexit.s/sys_clone"] #[link_section = "fexit.s/sys_clone"]
fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 { fn sys_clone(ctx: *mut ::core::ffi::c_void) -> i32 {
let _ = sys_clone(::aya_bpf::programs::FExitContext::new(ctx)); let _ = sys_clone(::aya_ebpf::programs::FExitContext::new(ctx));
return 0; return 0;
fn sys_clone(ctx: &mut FExitContext) -> i32 { fn sys_clone(ctx: &mut FExitContext) -> i32 {

@ -67,7 +67,7 @@ impl KProbe {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = #fn_name(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
#item #item
@ -100,7 +100,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "kprobe"] #[link_section = "kprobe"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {
@ -132,7 +132,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "kprobe/fib_lookup"] #[link_section = "kprobe/fib_lookup"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {
@ -165,7 +165,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "kprobe/fib_lookup+10"] #[link_section = "kprobe/fib_lookup+10"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {
@ -195,7 +195,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "kretprobe"] #[link_section = "kretprobe"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {

@ -142,7 +142,7 @@ pub fn sk_msg(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{bindings::xdp_action::XDP_PASS, macros::xdp, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action::XDP_PASS, macros::xdp, programs::XdpContext};
/// ///
/// #[xdp(frags)] /// #[xdp(frags)]
/// pub fn xdp(ctx: XdpContext) -> u32 { /// pub fn xdp(ctx: XdpContext) -> u32 {
@ -222,7 +222,7 @@ pub fn cgroup_skb(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::cgroup_sock_addr, programs::SockAddrContext}; /// use aya_ebpf::{macros::cgroup_sock_addr, programs::SockAddrContext};
/// ///
/// #[cgroup_sock_addr(connect4)] /// #[cgroup_sock_addr(connect4)]
/// pub fn connect4(ctx: SockAddrContext) -> i32 { /// pub fn connect4(ctx: SockAddrContext) -> i32 {
@ -300,7 +300,7 @@ pub fn perf_event(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::raw_tracepoint, programs::RawTracePointContext}; /// use aya_ebpf::{macros::raw_tracepoint, programs::RawTracePointContext};
/// ///
/// #[raw_tracepoint(tracepoint = "sys_enter")] /// #[raw_tracepoint(tracepoint = "sys_enter")]
/// pub fn sys_enter(ctx: RawTracePointContext) -> i32 { /// pub fn sys_enter(ctx: RawTracePointContext) -> i32 {
@ -347,7 +347,7 @@ pub fn raw_tracepoint(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::lsm, programs::LsmContext}; /// use aya_ebpf::{macros::lsm, programs::LsmContext};
/// ///
/// #[lsm(hook = "file_open")] /// #[lsm(hook = "file_open")]
/// pub fn file_open(ctx: LsmContext) -> i32 { /// pub fn file_open(ctx: LsmContext) -> i32 {
@ -387,7 +387,7 @@ pub fn lsm(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::btf_tracepoint, programs::BtfTracePointContext}; /// use aya_ebpf::{macros::btf_tracepoint, programs::BtfTracePointContext};
/// ///
/// #[btf_tracepoint(function = "sched_process_fork")] /// #[btf_tracepoint(function = "sched_process_fork")]
/// pub fn sched_process_fork(ctx: BtfTracePointContext) -> u32 { /// pub fn sched_process_fork(ctx: BtfTracePointContext) -> u32 {
@ -425,7 +425,7 @@ pub fn btf_tracepoint(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::stream_parser, programs::SkBuffContext}; /// use aya_ebpf::{macros::stream_parser, programs::SkBuffContext};
/// ///
/// ///
///#[stream_parser] ///#[stream_parser]
@ -456,7 +456,7 @@ pub fn stream_parser(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::stream_verdict, programs::SkBuffContext, bindings::sk_action}; /// use aya_ebpf::{macros::stream_verdict, programs::SkBuffContext, bindings::sk_action};
/// ///
/// ///
///#[stream_verdict] ///#[stream_verdict]
@ -497,7 +497,7 @@ fn sk_skb(kind: SkSkbKind, attrs: TokenStream, item: TokenStream) -> TokenStream
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::socket_filter, programs::SkBuffContext}; /// use aya_ebpf::{macros::socket_filter, programs::SkBuffContext};
/// ///
/// #[socket_filter] /// #[socket_filter]
/// pub fn accept_all(_ctx: SkBuffContext) -> i64 { /// pub fn accept_all(_ctx: SkBuffContext) -> i64 {
@ -529,7 +529,7 @@ pub fn socket_filter(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(non_camel_case_types)] /// # #![allow(non_camel_case_types)]
/// use aya_bpf::{macros::fentry, programs::FEntryContext}; /// use aya_ebpf::{macros::fentry, programs::FEntryContext};
/// # type filename = u32; /// # type filename = u32;
/// # type path = u32; /// # type path = u32;
/// ///
@ -574,7 +574,7 @@ pub fn fentry(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(non_camel_case_types)] /// # #![allow(non_camel_case_types)]
/// use aya_bpf::{macros::fexit, programs::FExitContext}; /// use aya_ebpf::{macros::fexit, programs::FExitContext};
/// # type filename = u32; /// # type filename = u32;
/// # type path = u32; /// # type path = u32;
/// ///
@ -615,7 +615,7 @@ pub fn fexit(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{macros::sk_lookup, programs::SkLookupContext}; /// use aya_ebpf::{macros::sk_lookup, programs::SkLookupContext};
/// ///
/// #[sk_lookup] /// #[sk_lookup]
/// pub fn accept_all(_ctx: SkLookupContext) -> u32 { /// pub fn accept_all(_ctx: SkLookupContext) -> u32 {
@ -645,7 +645,7 @@ pub fn sk_lookup(attrs: TokenStream, item: TokenStream) -> TokenStream {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::{ /// use aya_ebpf::{
/// macros::cgroup_device, /// macros::cgroup_device,
/// programs::DeviceContext, /// programs::DeviceContext,
/// }; /// };

@ -43,7 +43,7 @@ impl Lsm {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> i32 {
return #fn_name(::aya_bpf::programs::LsmContext::new(ctx)); return #fn_name(::aya_ebpf::programs::LsmContext::new(ctx));
#item #item
} }
@ -65,7 +65,7 @@ mod tests {
hook = "bprm_committed_creds" hook = "bprm_committed_creds"
}, },
parse_quote! { parse_quote! {
fn bprm_committed_creds(ctx: &mut ::aya_bpf::programs::LsmContext) -> i32 { fn bprm_committed_creds(ctx: &mut ::aya_ebpf::programs::LsmContext) -> i32 {
0 0
} }
}, },
@ -76,9 +76,9 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "lsm.s/bprm_committed_creds"] #[link_section = "lsm.s/bprm_committed_creds"]
fn bprm_committed_creds(ctx: *mut ::core::ffi::c_void) -> i32 { fn bprm_committed_creds(ctx: *mut ::core::ffi::c_void) -> i32 {
return bprm_committed_creds(::aya_bpf::programs::LsmContext::new(ctx)); return bprm_committed_creds(::aya_ebpf::programs::LsmContext::new(ctx));
fn bprm_committed_creds(ctx: &mut ::aya_bpf::programs::LsmContext) -> i32 { fn bprm_committed_creds(ctx: &mut ::aya_ebpf::programs::LsmContext) -> i32 {
0 0
} }
} }
@ -93,7 +93,7 @@ mod tests {
hook = "bprm_committed_creds" hook = "bprm_committed_creds"
}, },
parse_quote! { parse_quote! {
fn bprm_committed_creds(ctx: &mut ::aya_bpf::programs::LsmContext) -> i32 { fn bprm_committed_creds(ctx: &mut ::aya_ebpf::programs::LsmContext) -> i32 {
0 0
} }
}, },
@ -104,9 +104,9 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "lsm/bprm_committed_creds"] #[link_section = "lsm/bprm_committed_creds"]
fn bprm_committed_creds(ctx: *mut ::core::ffi::c_void) -> i32 { fn bprm_committed_creds(ctx: *mut ::core::ffi::c_void) -> i32 {
return bprm_committed_creds(::aya_bpf::programs::LsmContext::new(ctx)); return bprm_committed_creds(::aya_ebpf::programs::LsmContext::new(ctx));
fn bprm_committed_creds(ctx: &mut ::aya_bpf::programs::LsmContext) -> i32 { fn bprm_committed_creds(ctx: &mut ::aya_ebpf::programs::LsmContext) -> i32 {
0 0
} }
} }

@ -24,7 +24,7 @@ impl PerfEvent {
#[no_mangle] #[no_mangle]
#[link_section = "perf_event"] #[link_section = "perf_event"]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = #fn_name(::aya_bpf::programs::PerfEventContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::PerfEventContext::new(ctx));
return 0; return 0;
#item #item
@ -55,7 +55,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "perf_event"] #[link_section = "perf_event"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::PerfEventContext::new(ctx)); let _ = foo(::aya_ebpf::programs::PerfEventContext::new(ctx));
return 0; return 0;
fn foo(ctx: PerfEventContext) -> i32 { fn foo(ctx: PerfEventContext) -> i32 {

@ -33,7 +33,7 @@ impl RawTracePoint {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = #fn_name(::aya_bpf::programs::RawTracePointContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::RawTracePointContext::new(ctx));
return 0; return 0;
#item #item
@ -53,7 +53,7 @@ mod tests {
let prog = RawTracePoint::parse( let prog = RawTracePoint::parse(
parse_quote! { tracepoint = "sys_enter" }, parse_quote! { tracepoint = "sys_enter" },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::RawTracePointContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::RawTracePointContext) -> i32 {
0 0
} }
}, },
@ -64,10 +64,10 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "raw_tp/sys_enter"] #[link_section = "raw_tp/sys_enter"]
fn prog(ctx: *mut ::core::ffi::c_void) -> u32 { fn prog(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = prog(::aya_bpf::programs::RawTracePointContext::new(ctx)); let _ = prog(::aya_ebpf::programs::RawTracePointContext::new(ctx));
return 0; return 0;
fn prog(ctx: &mut ::aya_bpf::programs::RawTracePointContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::RawTracePointContext) -> i32 {
0 0
} }
} }

@ -23,8 +23,8 @@ impl SkLookup {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sk_lookup"] #[link_section = "sk_lookup"]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::bpf_sk_lookup) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::bpf_sk_lookup) -> u32 {
return #fn_name(::aya_bpf::programs::SkLookupContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SkLookupContext::new(ctx));
#item #item
} }
@ -43,7 +43,7 @@ mod tests {
let prog = SkLookup::parse( let prog = SkLookup::parse(
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::SkLookupContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkLookupContext) -> u32 {
0 0
} }
}, },
@ -53,10 +53,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sk_lookup"] #[link_section = "sk_lookup"]
fn prog(ctx: *mut ::aya_bpf::bindings::bpf_sk_lookup) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::bpf_sk_lookup) -> u32 {
return prog(::aya_bpf::programs::SkLookupContext::new(ctx)); return prog(::aya_ebpf::programs::SkLookupContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::SkLookupContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkLookupContext) -> u32 {
0 0
} }
} }

@ -23,8 +23,8 @@ impl SkMsg {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sk_msg"] #[link_section = "sk_msg"]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::sk_msg_md) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::sk_msg_md) -> u32 {
return #fn_name(::aya_bpf::programs::SkMsgContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SkMsgContext::new(ctx));
#item #item
} }
@ -43,7 +43,7 @@ mod tests {
let prog = SkMsg::parse( let prog = SkMsg::parse(
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::SkMsgContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkMsgContext) -> u32 {
0 0
} }
}, },
@ -53,10 +53,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sk_msg"] #[link_section = "sk_msg"]
fn prog(ctx: *mut ::aya_bpf::bindings:: sk_msg_md) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings:: sk_msg_md) -> u32 {
return prog(::aya_bpf::programs::SkMsgContext::new(ctx)); return prog(::aya_ebpf::programs::SkMsgContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::SkMsgContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkMsgContext) -> u32 {
0 0
} }
} }

@ -45,8 +45,8 @@ impl SkSkb {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> u32 {
return #fn_name(::aya_bpf::programs::SkBuffContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SkBuffContext::new(ctx));
#item #item
} }
@ -66,7 +66,7 @@ mod tests {
SkSkbKind::StreamParser, SkSkbKind::StreamParser,
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::SkBuffContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkBuffContext) -> u32 {
0 0
} }
}, },
@ -76,10 +76,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sk_skb/stream_parser"] #[link_section = "sk_skb/stream_parser"]
fn prog(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> u32 {
return prog(::aya_bpf::programs::SkBuffContext::new(ctx)); return prog(::aya_ebpf::programs::SkBuffContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::SkBuffContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkBuffContext) -> u32 {
0 0
} }
} }
@ -93,7 +93,7 @@ mod tests {
SkSkbKind::StreamVerdict, SkSkbKind::StreamVerdict,
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::SkBuffContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkBuffContext) -> u32 {
0 0
} }
}, },
@ -103,10 +103,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sk_skb/stream_verdict"] #[link_section = "sk_skb/stream_verdict"]
fn prog(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> u32 {
return prog(::aya_bpf::programs::SkBuffContext::new(ctx)); return prog(::aya_ebpf::programs::SkBuffContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::SkBuffContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SkBuffContext) -> u32 {
0 0
} }
} }

@ -23,8 +23,8 @@ impl SockOps {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sockops"] #[link_section = "sockops"]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::bpf_sock_ops) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::bpf_sock_ops) -> u32 {
return #fn_name(::aya_bpf::programs::SockOpsContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SockOpsContext::new(ctx));
#item #item
} }
@ -43,7 +43,7 @@ mod tests {
let prog = SockOps::parse( let prog = SockOps::parse(
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::SockOpsContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SockOpsContext) -> u32 {
0 0
} }
}, },
@ -53,10 +53,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "sockops"] #[link_section = "sockops"]
fn prog(ctx: *mut ::aya_bpf::bindings::bpf_sock_ops) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::bpf_sock_ops) -> u32 {
return prog(::aya_bpf::programs::SockOpsContext::new(ctx)); return prog(::aya_ebpf::programs::SockOpsContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::SockOpsContext) -> u32 { fn prog(ctx: &mut ::aya_ebpf::programs::SockOpsContext) -> u32 {
0 0
} }
} }

@ -23,8 +23,8 @@ impl SocketFilter {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = "socket"] #[link_section = "socket"]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i64 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i64 {
return #fn_name(::aya_bpf::programs::SkBuffContext::new(ctx)); return #fn_name(::aya_ebpf::programs::SkBuffContext::new(ctx));
#item #item
} }
@ -43,7 +43,7 @@ mod tests {
let prog = SocketFilter::parse( let prog = SocketFilter::parse(
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::SkBuffContext) -> i64 { fn prog(ctx: &mut ::aya_ebpf::programs::SkBuffContext) -> i64 {
0 0
} }
}, },
@ -53,10 +53,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "socket"] #[link_section = "socket"]
fn prog(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i64 { fn prog(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i64 {
return prog(::aya_bpf::programs::SkBuffContext::new(ctx)); return prog(::aya_ebpf::programs::SkBuffContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::SkBuffContext) -> i64 { fn prog(ctx: &mut ::aya_ebpf::programs::SkBuffContext) -> i64 {
0 0
} }
} }

@ -23,8 +23,8 @@ impl SchedClassifier {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = "classifier"] #[link_section = "classifier"]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return #fn_name(::aya_bpf::programs::TcContext::new(ctx)); return #fn_name(::aya_ebpf::programs::TcContext::new(ctx));
#item #item
} }
@ -43,7 +43,7 @@ mod tests {
let prog = SchedClassifier::parse( let prog = SchedClassifier::parse(
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::TcContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::TcContext) -> i32 {
0 0
} }
}, },
@ -53,10 +53,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "classifier"] #[link_section = "classifier"]
fn prog(ctx: *mut ::aya_bpf::bindings::__sk_buff) -> i32 { fn prog(ctx: *mut ::aya_ebpf::bindings::__sk_buff) -> i32 {
return prog(::aya_bpf::programs::TcContext::new(ctx)); return prog(::aya_ebpf::programs::TcContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::TcContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::TcContext) -> i32 {
0 0
} }
} }

@ -41,7 +41,7 @@ impl TracePoint {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = #fn_name(::aya_bpf::programs::TracePointContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::TracePointContext::new(ctx));
return 0; return 0;
#item #item
@ -61,7 +61,7 @@ mod tests {
let prog = TracePoint::parse( let prog = TracePoint::parse(
parse_quote! { name = "sys_enter_bind", category = "syscalls" }, parse_quote! { name = "sys_enter_bind", category = "syscalls" },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::TracePointContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::TracePointContext) -> i32 {
0 0
} }
}, },
@ -72,10 +72,10 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "tracepoint/syscalls/sys_enter_bind"] #[link_section = "tracepoint/syscalls/sys_enter_bind"]
fn prog(ctx: *mut ::core::ffi::c_void) -> u32 { fn prog(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = prog(::aya_bpf::programs::TracePointContext::new(ctx)); let _ = prog(::aya_ebpf::programs::TracePointContext::new(ctx));
return 0; return 0;
fn prog(ctx: &mut ::aya_bpf::programs::TracePointContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::TracePointContext) -> i32 {
0 0
} }
} }

@ -93,7 +93,7 @@ impl UProbe {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = #fn_name(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = #fn_name(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
#item #item
@ -126,7 +126,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "uprobe"] #[link_section = "uprobe"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {
@ -156,7 +156,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "uprobe.s"] #[link_section = "uprobe.s"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {
@ -189,7 +189,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "uprobe/self/proc/exe:trigger_uprobe"] #[link_section = "uprobe/self/proc/exe:trigger_uprobe"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {
@ -221,7 +221,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "uprobe/self/proc/exe:foo+123"] #[link_section = "uprobe/self/proc/exe:foo+123"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {
@ -251,7 +251,7 @@ mod tests {
#[no_mangle] #[no_mangle]
#[link_section = "uretprobe"] #[link_section = "uretprobe"]
fn foo(ctx: *mut ::core::ffi::c_void) -> u32 { fn foo(ctx: *mut ::core::ffi::c_void) -> u32 {
let _ = foo(::aya_bpf::programs::ProbeContext::new(ctx)); let _ = foo(::aya_ebpf::programs::ProbeContext::new(ctx));
return 0; return 0;
fn foo(ctx: ProbeContext) -> u32 { fn foo(ctx: ProbeContext) -> u32 {

@ -53,8 +53,8 @@ impl Xdp {
Ok(quote! { Ok(quote! {
#[no_mangle] #[no_mangle]
#[link_section = #section_name] #[link_section = #section_name]
#fn_vis fn #fn_name(ctx: *mut ::aya_bpf::bindings::xdp_md) -> u32 { #fn_vis fn #fn_name(ctx: *mut ::aya_ebpf::bindings::xdp_md) -> u32 {
return #fn_name(::aya_bpf::programs::XdpContext::new(ctx)); return #fn_name(::aya_ebpf::programs::XdpContext::new(ctx));
#item #item
} }
@ -73,7 +73,7 @@ mod tests {
let prog = Xdp::parse( let prog = Xdp::parse(
parse_quote! {}, parse_quote! {},
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
}, },
@ -83,10 +83,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "xdp"] #[link_section = "xdp"]
fn prog(ctx: *mut ::aya_bpf::bindings::xdp_md) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::xdp_md) -> u32 {
return prog(::aya_bpf::programs::XdpContext::new(ctx)); return prog(::aya_ebpf::programs::XdpContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
} }
@ -99,7 +99,7 @@ mod tests {
let prog = Xdp::parse( let prog = Xdp::parse(
parse_quote! { frags }, parse_quote! { frags },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
}, },
@ -109,10 +109,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "xdp.frags"] #[link_section = "xdp.frags"]
fn prog(ctx: *mut ::aya_bpf::bindings::xdp_md) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::xdp_md) -> u32 {
return prog(::aya_bpf::programs::XdpContext::new(ctx)); return prog(::aya_ebpf::programs::XdpContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
} }
@ -125,7 +125,7 @@ mod tests {
let prog = Xdp::parse( let prog = Xdp::parse(
parse_quote! { map = "cpumap" }, parse_quote! { map = "cpumap" },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
}, },
@ -135,10 +135,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "xdp/cpumap"] #[link_section = "xdp/cpumap"]
fn prog(ctx: *mut ::aya_bpf::bindings::xdp_md) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::xdp_md) -> u32 {
return prog(::aya_bpf::programs::XdpContext::new(ctx)); return prog(::aya_ebpf::programs::XdpContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
} }
@ -151,7 +151,7 @@ mod tests {
let prog = Xdp::parse( let prog = Xdp::parse(
parse_quote! { map = "devmap" }, parse_quote! { map = "devmap" },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
}, },
@ -161,10 +161,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "xdp/devmap"] #[link_section = "xdp/devmap"]
fn prog(ctx: *mut ::aya_bpf::bindings::xdp_md) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::xdp_md) -> u32 {
return prog(::aya_bpf::programs::XdpContext::new(ctx)); return prog(::aya_ebpf::programs::XdpContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
} }
@ -178,7 +178,7 @@ mod tests {
Xdp::parse( Xdp::parse(
parse_quote! { map = "badmap" }, parse_quote! { map = "badmap" },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
}, },
@ -191,7 +191,7 @@ mod tests {
let prog = Xdp::parse( let prog = Xdp::parse(
parse_quote! { frags, map = "cpumap" }, parse_quote! { frags, map = "cpumap" },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
}, },
@ -201,10 +201,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "xdp.frags/cpumap"] #[link_section = "xdp.frags/cpumap"]
fn prog(ctx: *mut ::aya_bpf::bindings::xdp_md) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::xdp_md) -> u32 {
return prog(::aya_bpf::programs::XdpContext::new(ctx)); return prog(::aya_ebpf::programs::XdpContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
} }
@ -217,7 +217,7 @@ mod tests {
let prog = Xdp::parse( let prog = Xdp::parse(
parse_quote! { frags, map = "devmap" }, parse_quote! { frags, map = "devmap" },
parse_quote! { parse_quote! {
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
}, },
@ -227,10 +227,10 @@ mod tests {
let expected = quote! { let expected = quote! {
#[no_mangle] #[no_mangle]
#[link_section = "xdp.frags/devmap"] #[link_section = "xdp.frags/devmap"]
fn prog(ctx: *mut ::aya_bpf::bindings::xdp_md) -> u32 { fn prog(ctx: *mut ::aya_ebpf::bindings::xdp_md) -> u32 {
return prog(::aya_bpf::programs::XdpContext::new(ctx)); return prog(::aya_ebpf::programs::XdpContext::new(ctx));
fn prog(ctx: &mut ::aya_bpf::programs::XdpContext) -> i32 { fn prog(ctx: &mut ::aya_ebpf::programs::XdpContext) -> i32 {
0 0
} }
} }

File diff suppressed because one or more lines are too long

@ -14,7 +14,7 @@ pub fn user_builder() -> Builder {
pub fn bpf_builder() -> Builder { pub fn bpf_builder() -> Builder {
bindgen::builder() bindgen::builder()
.use_core() .use_core()
.ctypes_prefix("::aya_bpf::cty") .ctypes_prefix("::aya_ebpf::cty")
.layout_tests(false) .layout_tests(false)
.generate_comments(false) .generate_comments(false)
.clang_arg("-Wno-unknown-attributes") .clang_arg("-Wno-unknown-attributes")

@ -1,5 +1,5 @@
[package] [package]
name = "aya-bpf" name = "aya-ebpf"
version = "0.1.0" version = "0.1.0"
description = "A library for writing eBPF programs" description = "A library for writing eBPF programs"
authors.workspace = true authors.workspace = true

@ -30,7 +30,7 @@ use crate::{
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::{c_int, c_long}, helpers::bpf_probe_read}; /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let kernel_ptr: *const c_int = 0 as _; /// # let kernel_ptr: *const c_int = 0 as _;
/// let my_int: c_int = unsafe { bpf_probe_read(kernel_ptr)? }; /// let my_int: c_int = unsafe { bpf_probe_read(kernel_ptr)? };
@ -67,7 +67,7 @@ pub unsafe fn bpf_probe_read<T>(src: *const T) -> Result<T, c_long> {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_buf}; /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_buf};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let ptr: *const u8 = 0 as _; /// # let ptr: *const u8 = 0 as _;
/// let mut buf = [0u8; 16]; /// let mut buf = [0u8; 16];
@ -103,7 +103,7 @@ pub unsafe fn bpf_probe_read_buf(src: *const u8, dst: &mut [u8]) -> Result<(), c
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user}; /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let user_ptr: *const c_int = 0 as _; /// # let user_ptr: *const c_int = 0 as _;
/// let my_int: c_int = unsafe { bpf_probe_read_user(user_ptr)? }; /// let my_int: c_int = unsafe { bpf_probe_read_user(user_ptr)? };
@ -138,7 +138,7 @@ pub unsafe fn bpf_probe_read_user<T>(src: *const T) -> Result<T, c_long> {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user_buf}; /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_user_buf};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let user_ptr: *const u8 = 0 as _; /// # let user_ptr: *const u8 = 0 as _;
/// let mut buf = [0u8; 16]; /// let mut buf = [0u8; 16];
@ -174,7 +174,7 @@ pub unsafe fn bpf_probe_read_user_buf(src: *const u8, dst: &mut [u8]) -> Result<
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel}; /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let kernel_ptr: *const c_int = 0 as _; /// # let kernel_ptr: *const c_int = 0 as _;
/// let my_int: c_int = unsafe { bpf_probe_read_kernel(kernel_ptr)? }; /// let my_int: c_int = unsafe { bpf_probe_read_kernel(kernel_ptr)? };
@ -209,7 +209,7 @@ pub unsafe fn bpf_probe_read_kernel<T>(src: *const T) -> Result<T, c_long> {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel_buf}; /// # use aya_ebpf::{cty::{c_int, c_long}, helpers::bpf_probe_read_kernel_buf};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let kernel_ptr: *const u8 = 0 as _; /// # let kernel_ptr: *const u8 = 0 as _;
/// let mut buf = [0u8; 16]; /// let mut buf = [0u8; 16];
@ -248,7 +248,7 @@ pub unsafe fn bpf_probe_read_kernel_buf(src: *const u8, dst: &mut [u8]) -> Resul
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_str}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_str};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let kernel_ptr: *const u8 = 0 as _; /// # let kernel_ptr: *const u8 = 0 as _;
/// let mut my_str = [0u8; 16]; /// let mut my_str = [0u8; 16];
@ -286,7 +286,7 @@ pub unsafe fn bpf_probe_read_str(src: *const u8, dest: &mut [u8]) -> Result<usiz
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_user_str}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let user_ptr: *const u8 = 0 as _; /// # let user_ptr: *const u8 = 0 as _;
/// let mut my_str = [0u8; 16]; /// let mut my_str = [0u8; 16];
@ -327,7 +327,7 @@ pub unsafe fn bpf_probe_read_user_str(src: *const u8, dest: &mut [u8]) -> Result
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let user_ptr: *const u8 = 0 as _; /// # let user_ptr: *const u8 = 0 as _;
/// let mut buf = [0u8; 16]; /// let mut buf = [0u8; 16];
@ -341,8 +341,8 @@ pub unsafe fn bpf_probe_read_user_str(src: *const u8, dest: &mut [u8]) -> Result
/// With a `PerCpuArray` (with size defined by us): /// With a `PerCpuArray` (with size defined by us):
/// ///
/// ```no_run /// ```no_run
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes};
/// use aya_bpf::{macros::map, maps::PerCpuArray}; /// use aya_ebpf::{macros::map, maps::PerCpuArray};
/// ///
/// #[repr(C)] /// #[repr(C)]
/// pub struct Buf { /// pub struct Buf {
@ -370,8 +370,8 @@ pub unsafe fn bpf_probe_read_user_str(src: *const u8, dest: &mut [u8]) -> Result
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_user_str_bytes};
/// # use aya_bpf::{macros::map, maps::PerCpuArray}; /// # use aya_ebpf::{macros::map, maps::PerCpuArray};
/// # #[repr(C)] /// # #[repr(C)]
/// # pub struct Buf { /// # pub struct Buf {
/// # pub buf: [u8; 4096], /// # pub buf: [u8; 4096],
@ -436,7 +436,7 @@ fn read_str_bytes(len: i64, dest: &[u8]) -> Result<&[u8], c_long> {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_kernel_str}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let kernel_ptr: *const u8 = 0 as _; /// # let kernel_ptr: *const u8 = 0 as _;
/// let mut my_str = [0u8; 16]; /// let mut my_str = [0u8; 16];
@ -477,7 +477,7 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes};
/// # fn try_test() -> Result<(), c_long> { /// # fn try_test() -> Result<(), c_long> {
/// # let kernel_ptr: *const u8 = 0 as _; /// # let kernel_ptr: *const u8 = 0 as _;
/// let mut buf = [0u8; 16]; /// let mut buf = [0u8; 16];
@ -492,8 +492,8 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes};
/// use aya_bpf::{macros::map, maps::PerCpuArray}; /// use aya_ebpf::{macros::map, maps::PerCpuArray};
/// ///
/// #[repr(C)] /// #[repr(C)]
/// pub struct Buf { /// pub struct Buf {
@ -521,8 +521,8 @@ pub unsafe fn bpf_probe_read_kernel_str(src: *const u8, dest: &mut [u8]) -> Resu
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes}; /// # use aya_ebpf::{cty::c_long, helpers::bpf_probe_read_kernel_str_bytes};
/// # use aya_bpf::{macros::map, maps::PerCpuArray}; /// # use aya_ebpf::{macros::map, maps::PerCpuArray};
/// # #[repr(C)] /// # #[repr(C)]
/// # pub struct Buf { /// # pub struct Buf {
/// # pub buf: [u8; 4096], /// # pub buf: [u8; 4096],
@ -567,7 +567,7 @@ pub unsafe fn bpf_probe_read_kernel_str_bytes(
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{ /// # use aya_ebpf::{
/// # cty::{c_int, c_long}, /// # cty::{c_int, c_long},
/// # helpers::bpf_probe_write_user, /// # helpers::bpf_probe_write_user,
/// # programs::ProbeContext, /// # programs::ProbeContext,
@ -606,7 +606,7 @@ pub unsafe fn bpf_probe_write_user<T>(dst: *mut T, src: *const T) -> Result<(),
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::helpers::bpf_get_current_comm; /// # use aya_ebpf::helpers::bpf_get_current_comm;
/// let comm = bpf_get_current_comm(); /// let comm = bpf_get_current_comm();
/// ///
/// // Do something with comm /// // Do something with comm
@ -643,7 +643,7 @@ pub fn bpf_get_current_comm() -> Result<[u8; 16], c_long> {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::helpers::bpf_get_current_pid_tgid; /// # use aya_ebpf::helpers::bpf_get_current_pid_tgid;
/// let tgid = (bpf_get_current_pid_tgid() >> 32) as u32; /// let tgid = (bpf_get_current_pid_tgid() >> 32) as u32;
/// let pid = bpf_get_current_pid_tgid() as u32; /// let pid = bpf_get_current_pid_tgid() as u32;
/// ///
@ -666,7 +666,7 @@ pub fn bpf_get_current_pid_tgid() -> u64 {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::helpers::bpf_get_current_uid_gid; /// # use aya_ebpf::helpers::bpf_get_current_uid_gid;
/// let gid = (bpf_get_current_uid_gid() >> 32) as u32; /// let gid = (bpf_get_current_uid_gid() >> 32) as u32;
/// let uid = bpf_get_current_uid_gid() as u32; /// let uid = bpf_get_current_uid_gid() as u32;
/// ///
@ -709,7 +709,7 @@ pub fn bpf_get_current_uid_gid() -> u64 {
/// # Example /// # Example
/// ///
/// ```no_run /// ```no_run
/// # use aya_bpf::helpers::bpf_printk; /// # use aya_ebpf::helpers::bpf_printk;
/// unsafe { /// unsafe {
/// bpf_printk!(b"hi there! dec: %d, hex: 0x%08X", 42, 0x1234); /// bpf_printk!(b"hi there! dec: %d, hex: 0x%08X", 42, 0x1234);
/// } /// }

@ -15,8 +15,8 @@ use crate::{
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// use aya_bpf::{macros::map, maps::ProgramArray, cty::c_long}; /// use aya_ebpf::{macros::map, maps::ProgramArray, cty::c_long};
/// # use aya_bpf::{programs::LsmContext}; /// # use aya_ebpf::{programs::LsmContext};
/// ///
/// #[map] /// #[map]
/// static JUMP_TABLE: ProgramArray = ProgramArray::with_max_entries(16, 0); /// static JUMP_TABLE: ProgramArray = ProgramArray::with_max_entries(16, 0);

@ -19,7 +19,7 @@ use crate::{
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::CpuMap, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::CpuMap, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static MAP: CpuMap = CpuMap::with_max_entries(8, 0); /// static MAP: CpuMap = CpuMap::with_max_entries(8, 0);
@ -47,7 +47,7 @@ impl CpuMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::CpuMap}; /// use aya_ebpf::{macros::map, maps::CpuMap};
/// ///
/// #[map] /// #[map]
/// static MAP: CpuMap = CpuMap::with_max_entries(8, 0); /// static MAP: CpuMap = CpuMap::with_max_entries(8, 0);
@ -74,7 +74,7 @@ impl CpuMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::CpuMap}; /// use aya_ebpf::{macros::map, maps::CpuMap};
/// ///
/// #[map] /// #[map]
/// static MAP: CpuMap = CpuMap::pinned(8, 0); /// static MAP: CpuMap = CpuMap::pinned(8, 0);
@ -101,7 +101,7 @@ impl CpuMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::CpuMap, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::CpuMap, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static MAP: CpuMap = CpuMap::with_max_entries(8, 0); /// static MAP: CpuMap = CpuMap::with_max_entries(8, 0);

@ -21,7 +21,7 @@ use crate::{
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMap, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMap, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMap = DevMap::with_max_entries(1, 0); /// static MAP: DevMap = DevMap::with_max_entries(1, 0);
@ -44,7 +44,7 @@ impl DevMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::DevMap}; /// use aya_ebpf::{macros::map, maps::DevMap};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMap = DevMap::with_max_entries(8, 0); /// static MAP: DevMap = DevMap::with_max_entries(8, 0);
@ -69,7 +69,7 @@ impl DevMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::DevMap}; /// use aya_ebpf::{macros::map, maps::DevMap};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMap = DevMap::pinned(8, 0); /// static MAP: DevMap = DevMap::pinned(8, 0);
@ -95,7 +95,7 @@ impl DevMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::DevMap}; /// use aya_ebpf::{macros::map, maps::DevMap};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMap = DevMap::with_max_entries(1, 0); /// static MAP: DevMap = DevMap::with_max_entries(1, 0);
@ -128,7 +128,7 @@ impl DevMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMap, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMap, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMap = DevMap::with_max_entries(8, 0); /// static MAP: DevMap = DevMap::with_max_entries(8, 0);

@ -23,7 +23,7 @@ use crate::{
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMapHash, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMapHash, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMapHash = DevMapHash::with_max_entries(1, 0); /// static MAP: DevMapHash = DevMapHash::with_max_entries(1, 0);
@ -46,7 +46,7 @@ impl DevMapHash {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::DevMapHash}; /// use aya_ebpf::{macros::map, maps::DevMapHash};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMapHash = DevMapHash::with_max_entries(8, 0); /// static MAP: DevMapHash = DevMapHash::with_max_entries(8, 0);
@ -71,7 +71,7 @@ impl DevMapHash {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::DevMapHash}; /// use aya_ebpf::{macros::map, maps::DevMapHash};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMapHash = DevMapHash::pinned(8, 0); /// static MAP: DevMapHash = DevMapHash::pinned(8, 0);
@ -97,7 +97,7 @@ impl DevMapHash {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::DevMapHash}; /// use aya_ebpf::{macros::map, maps::DevMapHash};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMapHash = DevMapHash::with_max_entries(1, 0); /// static MAP: DevMapHash = DevMapHash::with_max_entries(1, 0);
@ -128,7 +128,7 @@ impl DevMapHash {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMapHash, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::DevMapHash, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static MAP: DevMapHash = DevMapHash::with_max_entries(8, 0); /// static MAP: DevMapHash = DevMapHash::with_max_entries(8, 0);

@ -22,7 +22,7 @@ use crate::{
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::XskMap, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::XskMap, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static SOCKS: XskMap = XskMap::with_max_entries(8, 0); /// static SOCKS: XskMap = XskMap::with_max_entries(8, 0);
@ -65,7 +65,7 @@ impl XskMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::XskMap}; /// use aya_ebpf::{macros::map, maps::XskMap};
/// ///
/// #[map] /// #[map]
/// static SOCKS: XskMap = XskMap::with_max_entries(8, 0); /// static SOCKS: XskMap = XskMap::with_max_entries(8, 0);
@ -90,7 +90,7 @@ impl XskMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::XskMap}; /// use aya_ebpf::{macros::map, maps::XskMap};
/// ///
/// #[map] /// #[map]
/// static SOCKS: XskMap = XskMap::pinned(8, 0); /// static SOCKS: XskMap = XskMap::pinned(8, 0);
@ -116,7 +116,7 @@ impl XskMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{macros::map, maps::XskMap}; /// use aya_ebpf::{macros::map, maps::XskMap};
/// ///
/// #[map] /// #[map]
/// static SOCKS: XskMap = XskMap::with_max_entries(8, 0); /// static SOCKS: XskMap = XskMap::with_max_entries(8, 0);
@ -145,7 +145,7 @@ impl XskMap {
/// # Examples /// # Examples
/// ///
/// ```rust,no_run /// ```rust,no_run
/// use aya_bpf::{bindings::xdp_action, macros::{map, xdp}, maps::XskMap, programs::XdpContext}; /// use aya_ebpf::{bindings::xdp_action, macros::{map, xdp}, maps::XskMap, programs::XdpContext};
/// ///
/// #[map] /// #[map]
/// static SOCKS: XskMap = XskMap::with_max_entries(8, 0); /// static SOCKS: XskMap = XskMap::with_max_entries(8, 0);

@ -18,7 +18,7 @@ impl FEntryContext {
/// ```no_run /// ```no_run
/// # #![allow(non_camel_case_types)] /// # #![allow(non_camel_case_types)]
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_int, programs::FEntryContext}; /// # use aya_ebpf::{cty::c_int, programs::FEntryContext};
/// # type pid_t = c_int; /// # type pid_t = c_int;
/// # struct task_struct { /// # struct task_struct {
/// # pid: pid_t, /// # pid: pid_t,

@ -18,7 +18,7 @@ impl FExitContext {
/// ```no_run /// ```no_run
/// # #![allow(non_camel_case_types)] /// # #![allow(non_camel_case_types)]
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{cty::c_int, programs::FExitContext}; /// # use aya_ebpf::{cty::c_int, programs::FExitContext};
/// # type pid_t = c_int; /// # type pid_t = c_int;
/// # struct task_struct { /// # struct task_struct {
/// # pid: pid_t, /// # pid: pid_t,

@ -30,7 +30,7 @@ impl LsmContext {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{programs::LsmContext, cty::{c_int, c_ulong}}; /// # use aya_ebpf::{programs::LsmContext, cty::{c_int, c_ulong}};
/// unsafe fn try_lsm_mmap_addr(ctx: LsmContext) -> Result<i32, i32> { /// unsafe fn try_lsm_mmap_addr(ctx: LsmContext) -> Result<i32, i32> {
/// // In the kernel, this hook is defined as: /// // In the kernel, this hook is defined as:
/// // LSM_HOOK(int, 0, mmap_addr, unsigned long addr) /// // LSM_HOOK(int, 0, mmap_addr, unsigned long addr)

@ -26,7 +26,7 @@ impl ProbeContext {
/// ```no_run /// ```no_run
/// # #![allow(non_camel_case_types)] /// # #![allow(non_camel_case_types)]
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{programs::ProbeContext, cty::c_int, helpers::bpf_probe_read}; /// # use aya_ebpf::{programs::ProbeContext, cty::c_int, helpers::bpf_probe_read};
/// # type pid_t = c_int; /// # type pid_t = c_int;
/// # struct task_struct { /// # struct task_struct {
/// # pid: pid_t, /// # pid: pid_t,
@ -50,7 +50,7 @@ impl ProbeContext {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{programs::ProbeContext, cty::c_int}; /// # use aya_ebpf::{programs::ProbeContext, cty::c_int};
/// unsafe fn try_kretprobe_try_to_wake_up(ctx: ProbeContext) -> Result<u32, u32> { /// unsafe fn try_kretprobe_try_to_wake_up(ctx: ProbeContext) -> Result<u32, u32> {
/// let retval: c_int = ctx.ret().ok_or(1u32)?; /// let retval: c_int = ctx.ret().ok_or(1u32)?;
/// ///

@ -315,7 +315,7 @@ impl SkBuffContext {
/// ```no_run /// ```no_run
/// use core::mem; /// use core::mem;
/// ///
/// use aya_bpf::{bindings::TC_ACT_PIPE, macros::map, maps::PerCpuArray, programs::SkBuffContext}; /// use aya_ebpf::{bindings::TC_ACT_PIPE, macros::map, maps::PerCpuArray, programs::SkBuffContext};
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]
/// # struct ethhdr {}; /// # struct ethhdr {};
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]
@ -404,7 +404,7 @@ impl SkBuffContext {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::programs::SkBuffContext; /// use aya_ebpf::programs::SkBuffContext;
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]
/// # struct ethhdr {}; /// # struct ethhdr {};
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]

@ -67,7 +67,7 @@ impl TcContext {
/// ```no_run /// ```no_run
/// use core::mem; /// use core::mem;
/// ///
/// use aya_bpf::{bindings::TC_ACT_PIPE, macros::map, maps::PerCpuArray, programs::TcContext}; /// use aya_ebpf::{bindings::TC_ACT_PIPE, macros::map, maps::PerCpuArray, programs::TcContext};
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]
/// # struct ethhdr {}; /// # struct ethhdr {};
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]
@ -161,7 +161,7 @@ impl TcContext {
/// # Examples /// # Examples
/// ///
/// ```no_run /// ```no_run
/// use aya_bpf::programs::TcContext; /// use aya_ebpf::programs::TcContext;
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]
/// # struct ethhdr {}; /// # struct ethhdr {};
/// # #[allow(non_camel_case_types)] /// # #[allow(non_camel_case_types)]

@ -24,7 +24,7 @@ impl BtfTracePointContext {
/// ///
/// ```no_run /// ```no_run
/// # #![allow(dead_code)] /// # #![allow(dead_code)]
/// # use aya_bpf::{programs::BtfTracePointContext, cty::{c_int, c_ulong, c_char}}; /// # use aya_ebpf::{programs::BtfTracePointContext, cty::{c_int, c_ulong, c_char}};
/// unsafe fn try_tp_btf_sched_process_fork(ctx: BtfTracePointContext) -> Result<u32, u32> { /// unsafe fn try_tp_btf_sched_process_fork(ctx: BtfTracePointContext) -> Result<u32, u32> {
/// // Grab arguments /// // Grab arguments
/// let parent_comm: *const c_char = ctx.arg(0); /// let parent_comm: *const c_char = ctx.arg(0);

@ -9,7 +9,7 @@ homepage.workspace = true
edition.workspace = true edition.workspace = true
[dependencies] [dependencies]
aya-bpf = { path = "../aya-bpf" } aya-ebpf = { path = "../aya-ebpf" }
aya-log-common = { path = "../../aya-log-common" } aya-log-common = { path = "../../aya-log-common" }
aya-log-ebpf-macros = { path = "../../aya-log-ebpf-macros" } aya-log-ebpf-macros = { path = "../../aya-log-ebpf-macros" }

@ -2,8 +2,8 @@
#![warn(clippy::cast_lossless, clippy::cast_sign_loss)] #![warn(clippy::cast_lossless, clippy::cast_sign_loss)]
#[cfg(target_arch = "bpf")] #[cfg(target_arch = "bpf")]
use aya_bpf::macros::map; use aya_ebpf::macros::map;
use aya_bpf::maps::{PerCpuArray, PerfEventByteArray}; use aya_ebpf::maps::{PerCpuArray, PerfEventByteArray};
pub use aya_log_common::{write_record_header, Level, WriteToBuf, LOG_BUF_CAPACITY}; pub use aya_log_common::{write_record_header, Level, WriteToBuf, LOG_BUF_CAPACITY};
pub use aya_log_ebpf_macros::{debug, error, info, log, trace, warn}; pub use aya_log_ebpf_macros::{debug, error, info, log, trace, warn};

@ -9,7 +9,7 @@ homepage.workspace = true
edition.workspace = true edition.workspace = true
[dependencies] [dependencies]
aya-bpf = { path = "../../ebpf/aya-bpf" } aya-ebpf = { path = "../../ebpf/aya-ebpf" }
aya-log-ebpf = { path = "../../ebpf/aya-log-ebpf" } aya-log-ebpf = { path = "../../ebpf/aya-log-ebpf" }
[build-dependencies] [build-dependencies]

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{ use aya_ebpf::{
helpers::{bpf_probe_read_kernel_str_bytes, bpf_probe_read_user_str_bytes}, helpers::{bpf_probe_read_kernel_str_bytes, bpf_probe_read_user_str_bytes},
macros::{map, uprobe}, macros::{map, uprobe},
maps::Array, maps::Array,

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{macros::uprobe, programs::ProbeContext}; use aya_ebpf::{macros::uprobe, programs::ProbeContext};
use aya_log_ebpf::{debug, error, info, trace, warn}; use aya_log_ebpf::{debug, error, info, trace, warn};
#[uprobe] #[uprobe]

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{ use aya_ebpf::{
bindings::xdp_action, bindings::xdp_action,
macros::{map, xdp}, macros::{map, xdp},
maps::Array, maps::Array,

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext}; use aya_ebpf::{bindings::xdp_action, macros::xdp, programs::XdpContext};
#[xdp] #[xdp]
pub fn ihaveaverylongname(ctx: XdpContext) -> u32 { pub fn ihaveaverylongname(ctx: XdpContext) -> u32 {

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{bindings::xdp_action, macros::xdp, programs::XdpContext}; use aya_ebpf::{bindings::xdp_action, macros::xdp, programs::XdpContext};
// Note: the `frags` attribute causes this probe to be incompatible with kernel versions < 5.18.0. // Note: the `frags` attribute causes this probe to be incompatible with kernel versions < 5.18.0.
// See https://github.com/torvalds/linux/commit/c2f2cdb. // See https://github.com/torvalds/linux/commit/c2f2cdb.

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{ use aya_ebpf::{
bindings::xdp_action, bindings::xdp_action,
macros::{map, xdp}, macros::{map, xdp},
maps::{Array, CpuMap, DevMap, DevMapHash, XskMap}, maps::{Array, CpuMap, DevMap, DevMapHash, XskMap},

@ -3,7 +3,7 @@
use core::hint; use core::hint;
use aya_bpf::{ use aya_ebpf::{
macros::{map, uprobe}, macros::{map, uprobe},
maps::Array, maps::Array,
programs::ProbeContext, programs::ProbeContext,

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{ use aya_ebpf::{
macros::{map, uprobe}, macros::{map, uprobe},
maps::{PerCpuArray, RingBuf}, maps::{PerCpuArray, RingBuf},
programs::ProbeContext, programs::ProbeContext,

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{ use aya_ebpf::{
bindings::xdp_action, bindings::xdp_action,
macros::{kprobe, tracepoint, uprobe, xdp}, macros::{kprobe, tracepoint, uprobe, xdp},
programs::{ProbeContext, TracePointContext, XdpContext}, programs::{ProbeContext, TracePointContext, XdpContext},

@ -3,7 +3,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{macros::tracepoint, programs::TracePointContext}; use aya_ebpf::{macros::tracepoint, programs::TracePointContext};
#[tracepoint] #[tracepoint]
pub fn test_tracepoint_one(_ctx: TracePointContext) -> u32 { pub fn test_tracepoint_one(_ctx: TracePointContext) -> u32 {

@ -1,7 +1,7 @@
#![no_std] #![no_std]
#![no_main] #![no_main]
use aya_bpf::{bindings::xdp_action::XDP_PASS, macros::xdp, programs::XdpContext}; use aya_ebpf::{bindings::xdp_action::XDP_PASS, macros::xdp, programs::XdpContext};
macro_rules! probe { macro_rules! probe {
($name:ident, ($($arg:ident $(= $value:literal)?),*) ) => { ($name:ident, ($($arg:ident $(= $value:literal)?),*) ) => {

@ -24,7 +24,7 @@ pub fn codegen(opts: &SysrootOptions, libbpf_dir: &Path) -> Result<(), anyhow::E
let builder = || { let builder = || {
let mut bindgen = bindgen::bpf_builder() let mut bindgen = bindgen::bpf_builder()
.header(&*dir.join("include/bindings.h").to_string_lossy()) .header(&*dir.join("include/bindings.h").to_string_lossy())
// aya-tool uses aya_bpf::cty. We can't use that here since aya-bpf // aya-tool uses aya_ebpf::cty. We can't use that here since aya-bpf
// depends on aya-ebpf-bindings so it would create a circular dep. // depends on aya-ebpf-bindings so it would create a circular dep.
.ctypes_prefix("::aya_ebpf_cty") .ctypes_prefix("::aya_ebpf_cty")
.clang_args(&["-I", &*libbpf_dir.join("include/uapi").to_string_lossy()]) .clang_args(&["-I", &*libbpf_dir.join("include/uapi").to_string_lossy()])

@ -8,7 +8,10 @@ use xtask::exec;
pub fn docs(metadata: Metadata) -> Result<()> { pub fn docs(metadata: Metadata) -> Result<()> {
const PACKAGE_TO_DESCRIPTION: &[(&str, &str)] = &[ const PACKAGE_TO_DESCRIPTION: &[(&str, &str)] = &[
("aya", "User-space BPF program loading and manipulation"), ("aya", "User-space BPF program loading and manipulation"),
("aya-bpf", "Kernel-space BPF program implementation toolkit"), (
"aya-ebpf",
"Kernel-space BPF program implementation toolkit",
),
("aya-log-ebpf", "Kernel-space logging from BPF programs"), ("aya-log-ebpf", "Kernel-space logging from BPF programs"),
( (
"aya-log", "aya-log",

Loading…
Cancel
Save