Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ github = { repository = "libbpf/libbpf-sys" }
maintenance = { status = "passively-maintained" }

[build-dependencies]
bindgen = { version = "^0.71.1", optional = true }
bindgen = { version = "^0.72", optional = true }
cc = "^1.1.6"
pkg-config = "^0.3.30"
nix = { version = "^0.30.0", default-features = false, features = ["fs"] }
Expand Down
33 changes: 16 additions & 17 deletions src/bindings.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* automatically generated by rust-bindgen 0.71.1 */
/* automatically generated by rust-bindgen 0.72.0 */

#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
Expand Down Expand Up @@ -36,7 +36,9 @@ where
pub unsafe fn raw_get_bit(this: *const Self, index: usize) -> bool {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte = *(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize);
let byte = unsafe {
*(core::ptr::addr_of!((*this).storage) as *const u8).offset(byte_index as isize)
};
Self::extract_bit(byte, index)
}
#[inline]
Expand All @@ -47,11 +49,7 @@ where
index % 8
};
let mask = 1 << bit_index;
if val {
byte | mask
} else {
byte & !mask
}
if val { byte | mask } else { byte & !mask }
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {
Expand All @@ -64,9 +62,10 @@ where
pub unsafe fn raw_set_bit(this: *mut Self, index: usize, val: bool) {
debug_assert!(index / 8 < core::mem::size_of::<Storage>());
let byte_index = index / 8;
let byte =
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize);
*byte = Self::change_bit(*byte, index, val);
let byte = unsafe {
(core::ptr::addr_of_mut!((*this).storage) as *mut u8).offset(byte_index as isize)
};
unsafe { *byte = Self::change_bit(*byte, index, val) };
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
Expand All @@ -93,7 +92,7 @@ where
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= core::mem::size_of::<Storage>());
let mut val = 0;
for i in 0..(bit_width as usize) {
if Self::raw_get_bit(this, i + bit_offset) {
if unsafe { Self::raw_get_bit(this, i + bit_offset) } {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
Expand Down Expand Up @@ -133,7 +132,7 @@ where
} else {
i
};
Self::raw_set_bit(this, index + bit_offset, val_bit_is_set);
unsafe { Self::raw_set_bit(this, index + bit_offset, val_bit_is_set) };
}
}
}
Expand Down Expand Up @@ -7423,7 +7422,7 @@ unsafe extern "C" {
}
unsafe extern "C" {
pub fn btf__add_ptr(btf: *mut btf, ref_type_id: ::std::os::raw::c_int)
-> ::std::os::raw::c_int;
-> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn btf__add_array(
Expand Down Expand Up @@ -8427,7 +8426,7 @@ unsafe extern "C" {
}
unsafe extern "C" {
pub fn bpf_map__reuse_fd(map: *mut bpf_map, fd: ::std::os::raw::c_int)
-> ::std::os::raw::c_int;
-> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn bpf_map__name(map: *const bpf_map) -> *const ::std::os::raw::c_char;
Expand All @@ -8443,7 +8442,7 @@ unsafe extern "C" {
}
unsafe extern "C" {
pub fn bpf_map__set_max_entries(map: *mut bpf_map, max_entries: __u32)
-> ::std::os::raw::c_int;
-> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn bpf_map__map_flags(map: *const bpf_map) -> __u32;
Expand Down Expand Up @@ -8682,7 +8681,7 @@ unsafe extern "C" {
}
unsafe extern "C" {
pub fn bpf_tc_attach(hook: *const bpf_tc_hook, opts: *mut bpf_tc_opts)
-> ::std::os::raw::c_int;
-> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn bpf_tc_detach(
Expand Down Expand Up @@ -8891,7 +8890,7 @@ unsafe extern "C" {
}
unsafe extern "C" {
pub fn perf_buffer__buffer_fd(pb: *const perf_buffer, buf_idx: size_t)
-> ::std::os::raw::c_int;
-> ::std::os::raw::c_int;
}
unsafe extern "C" {
pub fn perf_buffer__buffer(
Expand Down