From d7ef47686b903a3608e78d6a858cf54ef7184907 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alessandro=C2=A0Decina?= Date: Sun, 29 Aug 2021 07:40:51 +0000 Subject: [PATCH] bpf: update bindings against libbpf 8bdc267e7b853ca08ed762b21fecc0e019ddc332 --- bpf/aya-bpf-bindings/src/aarch64/bindings.rs | 16 ++++++- bpf/aya-bpf-bindings/src/aarch64/getters.rs | 1 + bpf/aya-bpf-bindings/src/aarch64/helpers.rs | 49 ++++++++++++++++++++ bpf/aya-bpf-bindings/src/armv7/bindings.rs | 16 ++++++- bpf/aya-bpf-bindings/src/armv7/getters.rs | 1 + bpf/aya-bpf-bindings/src/armv7/helpers.rs | 49 ++++++++++++++++++++ bpf/aya-bpf-bindings/src/x86_64/bindings.rs | 16 ++++++- bpf/aya-bpf-bindings/src/x86_64/getters.rs | 1 + bpf/aya-bpf-bindings/src/x86_64/helpers.rs | 49 ++++++++++++++++++++ 9 files changed, 192 insertions(+), 6 deletions(-) diff --git a/bpf/aya-bpf-bindings/src/aarch64/bindings.rs b/bpf/aya-bpf-bindings/src/aarch64/bindings.rs index 0e8a177d..e3946da5 100644 --- a/bpf/aya-bpf-bindings/src/aarch64/bindings.rs +++ b/bpf/aya-bpf-bindings/src/aarch64/bindings.rs @@ -228,8 +228,6 @@ pub const SO_TIMESTAMPING_NEW: u32 = 65; pub const SO_RCVTIMEO_NEW: u32 = 66; pub const SO_SNDTIMEO_NEW: u32 = 67; pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; -pub const SO_PREFER_BUSY_POLL: u32 = 69; -pub const SO_BUSY_POLL_BUDGET: u32 = 70; pub const SO_TIMESTAMP: u32 = 29; pub const SO_TIMESTAMPNS: u32 = 35; pub const SO_TIMESTAMPING: u32 = 37; @@ -1054,6 +1052,20 @@ pub struct bpf_spin_lock { pub val: __u32, } #[repr(C)] +#[repr(align(8))] +#[derive(Debug, Copy, Clone)] +pub struct bpf_timer { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>, +} +impl bpf_timer { + #[inline] + pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 16usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default(); + __bindgen_bitfield_unit + } +} +#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct bpf_sysctl { pub write: __u32, diff --git a/bpf/aya-bpf-bindings/src/aarch64/getters.rs b/bpf/aya-bpf-bindings/src/aarch64/getters.rs index 0bc7b54b..39534eb9 100644 --- a/bpf/aya-bpf-bindings/src/aarch64/getters.rs +++ b/bpf/aya-bpf-bindings/src/aarch64/getters.rs @@ -1025,6 +1025,7 @@ impl bpf_spin_lock { unsafe { crate::bpf_probe_read(&self.val) }.ok() } } +impl bpf_timer {} impl bpf_sysctl { pub fn write(&self) -> Option<__u32> { unsafe { crate::bpf_probe_read(&self.write) }.ok() diff --git a/bpf/aya-bpf-bindings/src/aarch64/helpers.rs b/bpf/aya-bpf-bindings/src/aarch64/helpers.rs index 01c5600e..8ce046b6 100644 --- a/bpf/aya-bpf-bindings/src/aarch64/helpers.rs +++ b/bpf/aya-bpf-bindings/src/aarch64/helpers.rs @@ -1710,3 +1710,52 @@ pub unsafe fn bpf_sys_close(fd: __u32) -> ::aya_bpf_cty::c_long { ::core::mem::transmute(168usize); fun(fd) } +pub unsafe fn bpf_timer_init( + timer: *mut bpf_timer, + map: *mut ::aya_bpf_cty::c_void, + flags: __u64, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + map: *mut ::aya_bpf_cty::c_void, + flags: __u64, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(169usize); + fun(timer, map, flags) +} +pub unsafe fn bpf_timer_set_callback( + timer: *mut bpf_timer, + callback_fn: *mut ::aya_bpf_cty::c_void, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + callback_fn: *mut ::aya_bpf_cty::c_void, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(170usize); + fun(timer, callback_fn) +} +pub unsafe fn bpf_timer_start( + timer: *mut bpf_timer, + nsecs: __u64, + flags: __u64, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + nsecs: __u64, + flags: __u64, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(171usize); + fun(timer, nsecs, flags) +} +pub unsafe fn bpf_timer_cancel(timer: *mut bpf_timer) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn(timer: *mut bpf_timer) -> ::aya_bpf_cty::c_long = + ::core::mem::transmute(172usize); + fun(timer) +} +pub unsafe fn bpf_get_func_ip(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 { + let fun: unsafe extern "C" fn(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 = + ::core::mem::transmute(173usize); + fun(ctx) +} +pub unsafe fn bpf_get_attach_cookie(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 { + let fun: unsafe extern "C" fn(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 = + ::core::mem::transmute(174usize); + fun(ctx) +} diff --git a/bpf/aya-bpf-bindings/src/armv7/bindings.rs b/bpf/aya-bpf-bindings/src/armv7/bindings.rs index 0e8a177d..e3946da5 100644 --- a/bpf/aya-bpf-bindings/src/armv7/bindings.rs +++ b/bpf/aya-bpf-bindings/src/armv7/bindings.rs @@ -228,8 +228,6 @@ pub const SO_TIMESTAMPING_NEW: u32 = 65; pub const SO_RCVTIMEO_NEW: u32 = 66; pub const SO_SNDTIMEO_NEW: u32 = 67; pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; -pub const SO_PREFER_BUSY_POLL: u32 = 69; -pub const SO_BUSY_POLL_BUDGET: u32 = 70; pub const SO_TIMESTAMP: u32 = 29; pub const SO_TIMESTAMPNS: u32 = 35; pub const SO_TIMESTAMPING: u32 = 37; @@ -1054,6 +1052,20 @@ pub struct bpf_spin_lock { pub val: __u32, } #[repr(C)] +#[repr(align(8))] +#[derive(Debug, Copy, Clone)] +pub struct bpf_timer { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>, +} +impl bpf_timer { + #[inline] + pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 16usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default(); + __bindgen_bitfield_unit + } +} +#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct bpf_sysctl { pub write: __u32, diff --git a/bpf/aya-bpf-bindings/src/armv7/getters.rs b/bpf/aya-bpf-bindings/src/armv7/getters.rs index 0bc7b54b..39534eb9 100644 --- a/bpf/aya-bpf-bindings/src/armv7/getters.rs +++ b/bpf/aya-bpf-bindings/src/armv7/getters.rs @@ -1025,6 +1025,7 @@ impl bpf_spin_lock { unsafe { crate::bpf_probe_read(&self.val) }.ok() } } +impl bpf_timer {} impl bpf_sysctl { pub fn write(&self) -> Option<__u32> { unsafe { crate::bpf_probe_read(&self.write) }.ok() diff --git a/bpf/aya-bpf-bindings/src/armv7/helpers.rs b/bpf/aya-bpf-bindings/src/armv7/helpers.rs index 01c5600e..8ce046b6 100644 --- a/bpf/aya-bpf-bindings/src/armv7/helpers.rs +++ b/bpf/aya-bpf-bindings/src/armv7/helpers.rs @@ -1710,3 +1710,52 @@ pub unsafe fn bpf_sys_close(fd: __u32) -> ::aya_bpf_cty::c_long { ::core::mem::transmute(168usize); fun(fd) } +pub unsafe fn bpf_timer_init( + timer: *mut bpf_timer, + map: *mut ::aya_bpf_cty::c_void, + flags: __u64, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + map: *mut ::aya_bpf_cty::c_void, + flags: __u64, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(169usize); + fun(timer, map, flags) +} +pub unsafe fn bpf_timer_set_callback( + timer: *mut bpf_timer, + callback_fn: *mut ::aya_bpf_cty::c_void, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + callback_fn: *mut ::aya_bpf_cty::c_void, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(170usize); + fun(timer, callback_fn) +} +pub unsafe fn bpf_timer_start( + timer: *mut bpf_timer, + nsecs: __u64, + flags: __u64, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + nsecs: __u64, + flags: __u64, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(171usize); + fun(timer, nsecs, flags) +} +pub unsafe fn bpf_timer_cancel(timer: *mut bpf_timer) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn(timer: *mut bpf_timer) -> ::aya_bpf_cty::c_long = + ::core::mem::transmute(172usize); + fun(timer) +} +pub unsafe fn bpf_get_func_ip(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 { + let fun: unsafe extern "C" fn(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 = + ::core::mem::transmute(173usize); + fun(ctx) +} +pub unsafe fn bpf_get_attach_cookie(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 { + let fun: unsafe extern "C" fn(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 = + ::core::mem::transmute(174usize); + fun(ctx) +} diff --git a/bpf/aya-bpf-bindings/src/x86_64/bindings.rs b/bpf/aya-bpf-bindings/src/x86_64/bindings.rs index 0e8a177d..e3946da5 100644 --- a/bpf/aya-bpf-bindings/src/x86_64/bindings.rs +++ b/bpf/aya-bpf-bindings/src/x86_64/bindings.rs @@ -228,8 +228,6 @@ pub const SO_TIMESTAMPING_NEW: u32 = 65; pub const SO_RCVTIMEO_NEW: u32 = 66; pub const SO_SNDTIMEO_NEW: u32 = 67; pub const SO_DETACH_REUSEPORT_BPF: u32 = 68; -pub const SO_PREFER_BUSY_POLL: u32 = 69; -pub const SO_BUSY_POLL_BUDGET: u32 = 70; pub const SO_TIMESTAMP: u32 = 29; pub const SO_TIMESTAMPNS: u32 = 35; pub const SO_TIMESTAMPING: u32 = 37; @@ -1054,6 +1052,20 @@ pub struct bpf_spin_lock { pub val: __u32, } #[repr(C)] +#[repr(align(8))] +#[derive(Debug, Copy, Clone)] +pub struct bpf_timer { + pub _bitfield_align_1: [u8; 0], + pub _bitfield_1: __BindgenBitfieldUnit<[u8; 16usize]>, +} +impl bpf_timer { + #[inline] + pub fn new_bitfield_1() -> __BindgenBitfieldUnit<[u8; 16usize]> { + let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 16usize]> = Default::default(); + __bindgen_bitfield_unit + } +} +#[repr(C)] #[derive(Debug, Copy, Clone)] pub struct bpf_sysctl { pub write: __u32, diff --git a/bpf/aya-bpf-bindings/src/x86_64/getters.rs b/bpf/aya-bpf-bindings/src/x86_64/getters.rs index 0bc7b54b..39534eb9 100644 --- a/bpf/aya-bpf-bindings/src/x86_64/getters.rs +++ b/bpf/aya-bpf-bindings/src/x86_64/getters.rs @@ -1025,6 +1025,7 @@ impl bpf_spin_lock { unsafe { crate::bpf_probe_read(&self.val) }.ok() } } +impl bpf_timer {} impl bpf_sysctl { pub fn write(&self) -> Option<__u32> { unsafe { crate::bpf_probe_read(&self.write) }.ok() diff --git a/bpf/aya-bpf-bindings/src/x86_64/helpers.rs b/bpf/aya-bpf-bindings/src/x86_64/helpers.rs index 01c5600e..8ce046b6 100644 --- a/bpf/aya-bpf-bindings/src/x86_64/helpers.rs +++ b/bpf/aya-bpf-bindings/src/x86_64/helpers.rs @@ -1710,3 +1710,52 @@ pub unsafe fn bpf_sys_close(fd: __u32) -> ::aya_bpf_cty::c_long { ::core::mem::transmute(168usize); fun(fd) } +pub unsafe fn bpf_timer_init( + timer: *mut bpf_timer, + map: *mut ::aya_bpf_cty::c_void, + flags: __u64, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + map: *mut ::aya_bpf_cty::c_void, + flags: __u64, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(169usize); + fun(timer, map, flags) +} +pub unsafe fn bpf_timer_set_callback( + timer: *mut bpf_timer, + callback_fn: *mut ::aya_bpf_cty::c_void, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + callback_fn: *mut ::aya_bpf_cty::c_void, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(170usize); + fun(timer, callback_fn) +} +pub unsafe fn bpf_timer_start( + timer: *mut bpf_timer, + nsecs: __u64, + flags: __u64, +) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn( + timer: *mut bpf_timer, + nsecs: __u64, + flags: __u64, + ) -> ::aya_bpf_cty::c_long = ::core::mem::transmute(171usize); + fun(timer, nsecs, flags) +} +pub unsafe fn bpf_timer_cancel(timer: *mut bpf_timer) -> ::aya_bpf_cty::c_long { + let fun: unsafe extern "C" fn(timer: *mut bpf_timer) -> ::aya_bpf_cty::c_long = + ::core::mem::transmute(172usize); + fun(timer) +} +pub unsafe fn bpf_get_func_ip(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 { + let fun: unsafe extern "C" fn(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 = + ::core::mem::transmute(173usize); + fun(ctx) +} +pub unsafe fn bpf_get_attach_cookie(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 { + let fun: unsafe extern "C" fn(ctx: *mut ::aya_bpf_cty::c_void) -> __u64 = + ::core::mem::transmute(174usize); + fun(ctx) +}