#[repr(C)]
#[derive(Copy, Clone, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
pub struct __BindgenBitfieldUnit<Storage> {
storage: Storage,
}
impl<Storage> __BindgenBitfieldUnit<Storage> {
#[inline]
pub const fn new(storage: Storage) -> Self {
Self { storage }
}
}
impl<Storage> __BindgenBitfieldUnit<Storage>
where
Storage: AsRef<[u8]> + AsMut<[u8]>,
{
#[inline]
pub fn get_bit(&self, index: usize) -> bool {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = self.storage.as_ref()[byte_index];
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
byte & mask == mask
}
#[inline]
pub fn set_bit(&mut self, index: usize, val: bool) {
debug_assert!(index / 8 < self.storage.as_ref().len());
let byte_index = index / 8;
let byte = &mut self.storage.as_mut()[byte_index];
let bit_index = if cfg!(target_endian = "big") {
7 - (index % 8)
} else {
index % 8
};
let mask = 1 << bit_index;
if val {
*byte |= mask;
} else {
*byte &= !mask;
}
}
#[inline]
pub fn get(&self, bit_offset: usize, bit_width: u8) -> u64 {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
let mut val = 0;
for i in 0..(bit_width as usize) {
if self.get_bit(i + bit_offset) {
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
val |= 1 << index;
}
}
val
}
#[inline]
pub fn set(&mut self, bit_offset: usize, bit_width: u8, val: u64) {
debug_assert!(bit_width <= 64);
debug_assert!(bit_offset / 8 < self.storage.as_ref().len());
debug_assert!((bit_offset + (bit_width as usize)) / 8 <= self.storage.as_ref().len());
for i in 0..(bit_width as usize) {
let mask = 1 << i;
let val_bit_is_set = val & mask == mask;
let index = if cfg!(target_endian = "big") {
bit_width as usize - 1 - i
} else {
i
};
self.set_bit(index + bit_offset, val_bit_is_set);
}
}
}
pub const EXMAP_PAGE_LEN_BITS: u32 = 12;
pub const EXMAP_PAGE_MAX_PAGES: u32 = 4096;
pub const EXMAP_USER_INTERFACE_PAGES: u32 = 512;
pub const EXMAP_OFF_EXMAP: u32 = 0;
pub const EXMAP_OFF_INTERFACE_BASE: i64 = -2305843009213693952;
pub const EXMAP_OFF_INTERFACE_MAX: i64 = -1152921504606846976;
#[repr(C)]
#[derive(Copy, Clone)]
pub struct exmap_iov {
pub anon1: exmap_iov__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union exmap_iov__bindgen_ty_1 {
pub value: u64,
pub anon1: ExmapIov,
pub anon2: exmap_iov__bindgen_ty_1__bindgen_ty_2,
}
#[repr(C)]
#[repr(align(8))]
#[derive(Debug, Default, Copy, Clone)]
pub struct ExmapIov {
pub _bitfield_align_1: [u64; 0],
pub _bitfield_1: __BindgenBitfieldUnit<[u8; 8usize]>,
}
#[test]
fn bindgen_test_layout_ExmapIov() {
assert_eq!(
::core::mem::size_of::<ExmapIov>(),
8usize,
concat!("Size of: ", stringify!(ExmapIov))
);
assert_eq!(
::core::mem::align_of::<ExmapIov>(),
8usize,
concat!("Alignment of ", stringify!(ExmapIov))
);
}
impl ExmapIov {
#[inline]
pub fn page(&self) -> u64 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(0usize, 52u8) as u64) }
}
#[inline]
pub fn set_page(&mut self, val: u64) {
unsafe {
let val: u64 = ::core::mem::transmute(val);
self._bitfield_1.set(0usize, 52u8, val as u64)
}
}
#[inline]
pub fn len(&self) -> u64 {
unsafe { ::core::mem::transmute(self._bitfield_1.get(52usize, 12u8) as u64) }
}
#[inline]
pub fn set_len(&mut self, val: u64) {
unsafe {
let val: u64 = ::core::mem::transmute(val);
self._bitfield_1.set(52usize, 12u8, val as u64)
}
}
#[inline]
pub fn new_bitfield_1(page: u64, len: u64) -> __BindgenBitfieldUnit<[u8; 8usize]> {
let mut __bindgen_bitfield_unit: __BindgenBitfieldUnit<[u8; 8usize]> = Default::default();
__bindgen_bitfield_unit.set(0usize, 52u8, {
let page: u64 = unsafe { ::core::mem::transmute(page) };
page as u64
});
__bindgen_bitfield_unit.set(52usize, 12u8, {
let len: u64 = unsafe { ::core::mem::transmute(len) };
len as u64
});
__bindgen_bitfield_unit
}
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct exmap_iov__bindgen_ty_1__bindgen_ty_2 {
pub res: i32,
pub pages: i16,
}
#[test]
fn bindgen_test_layout_exmap_iov__bindgen_ty_1__bindgen_ty_2() {
const UNINIT: ::core::mem::MaybeUninit<exmap_iov__bindgen_ty_1__bindgen_ty_2> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<exmap_iov__bindgen_ty_1__bindgen_ty_2>(),
8usize,
concat!(
"Size of: ",
stringify!(exmap_iov__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
::core::mem::align_of::<exmap_iov__bindgen_ty_1__bindgen_ty_2>(),
4usize,
concat!(
"Alignment of ",
stringify!(exmap_iov__bindgen_ty_1__bindgen_ty_2)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).res) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(exmap_iov__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(res)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).pages) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(exmap_iov__bindgen_ty_1__bindgen_ty_2),
"::",
stringify!(pages)
)
);
}
#[test]
fn bindgen_test_layout_exmap_iov__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<exmap_iov__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<exmap_iov__bindgen_ty_1>(),
8usize,
concat!("Size of: ", stringify!(exmap_iov__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<exmap_iov__bindgen_ty_1>(),
8usize,
concat!("Alignment of ", stringify!(exmap_iov__bindgen_ty_1))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).value) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(exmap_iov__bindgen_ty_1),
"::",
stringify!(value)
)
);
}
impl Default for exmap_iov__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[test]
fn bindgen_test_layout_exmap_iov() {
assert_eq!(
::core::mem::size_of::<exmap_iov>(),
8usize,
concat!("Size of: ", stringify!(exmap_iov))
);
assert_eq!(
::core::mem::align_of::<exmap_iov>(),
8usize,
concat!("Alignment of ", stringify!(exmap_iov))
);
}
impl Default for exmap_iov {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Copy, Clone)]
pub struct exmap_user_interface {
pub anon1: exmap_user_interface__bindgen_ty_1,
}
#[repr(C)]
#[derive(Copy, Clone)]
pub union exmap_user_interface__bindgen_ty_1 {
pub iov: [exmap_iov; 512usize],
}
#[test]
fn bindgen_test_layout_exmap_user_interface__bindgen_ty_1() {
const UNINIT: ::core::mem::MaybeUninit<exmap_user_interface__bindgen_ty_1> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<exmap_user_interface__bindgen_ty_1>(),
4096usize,
concat!("Size of: ", stringify!(exmap_user_interface__bindgen_ty_1))
);
assert_eq!(
::core::mem::align_of::<exmap_user_interface__bindgen_ty_1>(),
8usize,
concat!(
"Alignment of ",
stringify!(exmap_user_interface__bindgen_ty_1)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iov) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(exmap_user_interface__bindgen_ty_1),
"::",
stringify!(iov)
)
);
}
impl Default for exmap_user_interface__bindgen_ty_1 {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[test]
fn bindgen_test_layout_exmap_user_interface() {
assert_eq!(
::core::mem::size_of::<exmap_user_interface>(),
4096usize,
concat!("Size of: ", stringify!(exmap_user_interface))
);
assert_eq!(
::core::mem::align_of::<exmap_user_interface>(),
8usize,
concat!("Alignment of ", stringify!(exmap_user_interface))
);
}
impl Default for exmap_user_interface {
fn default() -> Self {
let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
unsafe {
::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
s.assume_init()
}
}
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct exmap_ioctl_setup {
pub fd: ::core::ffi::c_int,
pub max_interfaces: ::core::ffi::c_int,
pub buffer_size: usize,
pub flags: u64,
}
#[test]
fn bindgen_test_layout_exmap_ioctl_setup() {
const UNINIT: ::core::mem::MaybeUninit<exmap_ioctl_setup> = ::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<exmap_ioctl_setup>(),
24usize,
concat!("Size of: ", stringify!(exmap_ioctl_setup))
);
assert_eq!(
::core::mem::align_of::<exmap_ioctl_setup>(),
8usize,
concat!("Alignment of ", stringify!(exmap_ioctl_setup))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).fd) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(exmap_ioctl_setup),
"::",
stringify!(fd)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).max_interfaces) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(exmap_ioctl_setup),
"::",
stringify!(max_interfaces)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).buffer_size) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(exmap_ioctl_setup),
"::",
stringify!(buffer_size)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
16usize,
concat!(
"Offset of field: ",
stringify!(exmap_ioctl_setup),
"::",
stringify!(flags)
)
);
}
#[repr(C)]
#[derive(Debug, Default, Copy, Clone)]
pub struct exmap_action_params {
pub interface: u16,
pub iov_len: u16,
pub opcode: u16,
pub flags: u64,
}
#[test]
fn bindgen_test_layout_exmap_action_params() {
const UNINIT: ::core::mem::MaybeUninit<exmap_action_params> =
::core::mem::MaybeUninit::uninit();
let ptr = UNINIT.as_ptr();
assert_eq!(
::core::mem::size_of::<exmap_action_params>(),
16usize,
concat!("Size of: ", stringify!(exmap_action_params))
);
assert_eq!(
::core::mem::align_of::<exmap_action_params>(),
8usize,
concat!("Alignment of ", stringify!(exmap_action_params))
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).interface) as usize - ptr as usize },
0usize,
concat!(
"Offset of field: ",
stringify!(exmap_action_params),
"::",
stringify!(interface)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).iov_len) as usize - ptr as usize },
2usize,
concat!(
"Offset of field: ",
stringify!(exmap_action_params),
"::",
stringify!(iov_len)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).opcode) as usize - ptr as usize },
4usize,
concat!(
"Offset of field: ",
stringify!(exmap_action_params),
"::",
stringify!(opcode)
)
);
assert_eq!(
unsafe { ::core::ptr::addr_of!((*ptr).flags) as usize - ptr as usize },
8usize,
concat!(
"Offset of field: ",
stringify!(exmap_action_params),
"::",
stringify!(flags)
)
);
}
pub const EXMAP_OP_READ: exmap_opcode = 0;
pub const EXMAP_OP_ALLOC: exmap_opcode = 1;
pub const EXMAP_OP_FREE: exmap_opcode = 2;
pub const EXMAP_OP_WRITE: exmap_opcode = 3;
pub type exmap_opcode = ::core::ffi::c_uint;
pub const EXMAP_ALLOC_PROBE: exmap_flags = 1;
pub type exmap_flags = ::core::ffi::c_uint;
pub const Fix753_EXMAP_IOCTL_ACTION: ::core::ffi::c_ulong = 1074817794;
pub const Fix753_EXMAP_IOCTL_SETUP: ::core::ffi::c_ulong = 1075342081;