1 /* automatically generated by tools/bindgen-all-the-things */ 2 3 #![allow(clippy::missing_safety_doc)] 4 #![allow(clippy::upper_case_acronyms)] 5 #![allow(non_upper_case_globals)] 6 #![allow(non_camel_case_types)] 7 #![allow(non_snake_case)] 8 #![allow(dead_code)] 9 10 #[repr(C)] 11 #[derive(Default)] 12 pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]); 13 impl<T> __IncompleteArrayField<T> { 14 #[inline] new() -> Self15 pub const fn new() -> Self { 16 __IncompleteArrayField(::std::marker::PhantomData, []) 17 } 18 #[inline] as_ptr(&self) -> *const T19 pub fn as_ptr(&self) -> *const T { 20 self as *const _ as *const T 21 } 22 #[inline] as_mut_ptr(&mut self) -> *mut T23 pub fn as_mut_ptr(&mut self) -> *mut T { 24 self as *mut _ as *mut T 25 } 26 #[inline] as_slice(&self, len: usize) -> &[T]27 pub unsafe fn as_slice(&self, len: usize) -> &[T] { 28 ::std::slice::from_raw_parts(self.as_ptr(), len) 29 } 30 #[inline] as_mut_slice(&mut self, len: usize) -> &mut [T]31 pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] { 32 ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len) 33 } 34 } 35 impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> { fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result36 fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result { 37 fmt.write_str("__IncompleteArrayField") 38 } 39 } 40 pub const VRING_DESC_F_NEXT: u32 = 1; 41 pub const VRING_DESC_F_WRITE: u32 = 2; 42 pub const VRING_DESC_F_INDIRECT: u32 = 4; 43 pub const VRING_PACKED_DESC_F_AVAIL: u32 = 7; 44 pub const VRING_PACKED_DESC_F_USED: u32 = 15; 45 pub const VRING_USED_F_NO_NOTIFY: u32 = 1; 46 pub const VRING_AVAIL_F_NO_INTERRUPT: u32 = 1; 47 pub const VRING_PACKED_EVENT_FLAG_ENABLE: u32 = 0; 48 pub const VRING_PACKED_EVENT_FLAG_DISABLE: u32 = 1; 49 pub const VRING_PACKED_EVENT_FLAG_DESC: u32 = 2; 50 pub const VRING_PACKED_EVENT_F_WRAP_CTR: u32 = 15; 51 pub const VIRTIO_RING_F_INDIRECT_DESC: u32 = 28; 52 pub const VIRTIO_RING_F_EVENT_IDX: u32 = 29; 53 pub const VRING_AVAIL_ALIGN_SIZE: u32 = 2; 54 pub const VRING_USED_ALIGN_SIZE: u32 = 4; 55 pub const VRING_DESC_ALIGN_SIZE: u32 = 16; 56 pub type __le16 = u16; 57 pub type __le32 = u32; 58 pub type __le64 = u64; 59 pub type __virtio16 = u16; 60 pub type __virtio32 = u32; 61 pub type __virtio64 = u64; 62 #[repr(C)] 63 #[derive(Debug, Default, Copy, Clone)] 64 pub struct vring_desc { 65 pub addr: __virtio64, 66 pub len: __virtio32, 67 pub flags: __virtio16, 68 pub next: __virtio16, 69 } 70 #[repr(C)] 71 #[derive(Debug, Default)] 72 pub struct vring_avail { 73 pub flags: __virtio16, 74 pub idx: __virtio16, 75 pub ring: __IncompleteArrayField<__virtio16>, 76 } 77 #[repr(C)] 78 #[derive(Debug, Default, Copy, Clone)] 79 pub struct vring_used_elem { 80 pub id: __virtio32, 81 pub len: __virtio32, 82 } 83 pub type vring_used_elem_t = vring_used_elem; 84 #[repr(C)] 85 #[derive(Debug, Default)] 86 pub struct vring_used { 87 pub flags: __virtio16, 88 pub idx: __virtio16, 89 pub ring: __IncompleteArrayField<vring_used_elem_t>, 90 } 91 pub type vring_desc_t = vring_desc; 92 pub type vring_avail_t = vring_avail; 93 pub type vring_used_t = vring_used; 94 #[repr(C)] 95 #[derive(Debug, Copy, Clone)] 96 pub struct vring { 97 pub num: ::std::os::raw::c_uint, 98 pub desc: *mut vring_desc_t, 99 pub avail: *mut vring_avail_t, 100 pub used: *mut vring_used_t, 101 } 102 impl Default for vring { default() -> Self103 fn default() -> Self { 104 let mut s = ::std::mem::MaybeUninit::<Self>::uninit(); 105 unsafe { 106 ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1); 107 s.assume_init() 108 } 109 } 110 } 111 #[repr(C)] 112 #[derive(Debug, Default, Copy, Clone)] 113 pub struct vring_packed_desc_event { 114 pub off_wrap: __le16, 115 pub flags: __le16, 116 } 117 #[repr(C)] 118 #[derive(Debug, Default, Copy, Clone)] 119 pub struct vring_packed_desc { 120 pub addr: __le64, 121 pub len: __le32, 122 pub id: __le16, 123 pub flags: __le16, 124 } 125