xref: /aosp_15_r20/external/crosvm/virtio_sys/src/vhost.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 /* automatically generated by tools/bindgen-all-the-things */
2 
3 #![allow(clippy::missing_safety_doc)]
4 #![allow(clippy::undocumented_unsafe_blocks)]
5 #![allow(clippy::upper_case_acronyms)]
6 #![allow(non_upper_case_globals)]
7 #![allow(non_camel_case_types)]
8 #![allow(non_snake_case)]
9 #![allow(dead_code)]
10 
11 #[repr(C)]
12 #[derive(Default)]
13 pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
14 impl<T> __IncompleteArrayField<T> {
15     #[inline]
new() -> Self16     pub const fn new() -> Self {
17         __IncompleteArrayField(::std::marker::PhantomData, [])
18     }
19     #[inline]
as_ptr(&self) -> *const T20     pub fn as_ptr(&self) -> *const T {
21         self as *const _ as *const T
22     }
23     #[inline]
as_mut_ptr(&mut self) -> *mut T24     pub fn as_mut_ptr(&mut self) -> *mut T {
25         self as *mut _ as *mut T
26     }
27     #[inline]
as_slice(&self, len: usize) -> &[T]28     pub unsafe fn as_slice(&self, len: usize) -> &[T] {
29         ::std::slice::from_raw_parts(self.as_ptr(), len)
30     }
31     #[inline]
as_mut_slice(&mut self, len: usize) -> &mut [T]32     pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
33         ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
34     }
35 }
36 impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result37     fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
38         fmt.write_str("__IncompleteArrayField")
39     }
40 }
41 pub const VHOST_VRING_F_LOG: u32 = 0;
42 pub const VHOST_ACCESS_RO: u32 = 1;
43 pub const VHOST_ACCESS_WO: u32 = 2;
44 pub const VHOST_ACCESS_RW: u32 = 3;
45 pub const VHOST_IOTLB_MISS: u32 = 1;
46 pub const VHOST_IOTLB_UPDATE: u32 = 2;
47 pub const VHOST_IOTLB_INVALIDATE: u32 = 3;
48 pub const VHOST_IOTLB_ACCESS_FAIL: u32 = 4;
49 pub const VHOST_IOTLB_BATCH_BEGIN: u32 = 5;
50 pub const VHOST_IOTLB_BATCH_END: u32 = 6;
51 pub const VHOST_IOTLB_MSG: u32 = 1;
52 pub const VHOST_IOTLB_MSG_V2: u32 = 2;
53 pub const VHOST_PAGE_SIZE: u32 = 4096;
54 pub const VHOST_SCSI_ABI_VERSION: u32 = 1;
55 pub const VHOST_F_LOG_ALL: u32 = 26;
56 pub const VHOST_NET_F_VIRTIO_NET_HDR: u32 = 27;
57 pub const VHOST_BACKEND_F_IOTLB_MSG_V2: u32 = 1;
58 pub const VHOST_BACKEND_F_IOTLB_BATCH: u32 = 2;
59 pub const VHOST_BACKEND_F_IOTLB_ASID: u32 = 3;
60 pub const VHOST_BACKEND_F_SUSPEND: u32 = 4;
61 pub const VHOST_BACKEND_F_RESUME: u32 = 5;
62 pub const VHOST_BACKEND_F_ENABLE_AFTER_DRIVER_OK: u32 = 6;
63 pub const VHOST_FILE_UNBIND: i32 = -1;
64 pub const VHOST_VIRTIO: u32 = 175;
65 pub const VHOST_VRING_LITTLE_ENDIAN: u32 = 0;
66 pub const VHOST_VRING_BIG_ENDIAN: u32 = 1;
67 #[repr(C)]
68 #[derive(Debug, Default, Copy, Clone)]
69 pub struct vhost_vring_state {
70     pub index: ::std::os::raw::c_uint,
71     pub num: ::std::os::raw::c_uint,
72 }
73 #[repr(C)]
74 #[derive(Debug, Default, Copy, Clone)]
75 pub struct vhost_vring_file {
76     pub index: ::std::os::raw::c_uint,
77     pub fd: ::std::os::raw::c_int,
78 }
79 #[repr(C)]
80 #[derive(Debug, Default, Copy, Clone)]
81 pub struct vhost_vring_addr {
82     pub index: ::std::os::raw::c_uint,
83     pub flags: ::std::os::raw::c_uint,
84     pub desc_user_addr: u64,
85     pub used_user_addr: u64,
86     pub avail_user_addr: u64,
87     pub log_guest_addr: u64,
88 }
89 #[repr(C)]
90 #[derive(Debug, Default, Copy, Clone)]
91 pub struct vhost_worker_state {
92     pub worker_id: ::std::os::raw::c_uint,
93 }
94 #[repr(C)]
95 #[derive(Debug, Default, Copy, Clone)]
96 pub struct vhost_vring_worker {
97     pub index: ::std::os::raw::c_uint,
98     pub worker_id: ::std::os::raw::c_uint,
99 }
100 #[repr(C)]
101 #[derive(Debug, Default, Copy, Clone)]
102 pub struct vhost_iotlb_msg {
103     pub iova: u64,
104     pub size: u64,
105     pub uaddr: u64,
106     pub perm: u8,
107     pub type_: u8,
108 }
109 #[repr(C)]
110 #[derive(Copy, Clone)]
111 pub struct vhost_msg {
112     pub type_: ::std::os::raw::c_int,
113     pub __bindgen_anon_1: vhost_msg__bindgen_ty_1,
114 }
115 #[repr(C)]
116 #[derive(Copy, Clone)]
117 pub union vhost_msg__bindgen_ty_1 {
118     pub iotlb: vhost_iotlb_msg,
119     pub padding: [u8; 64usize],
120 }
121 impl Default for vhost_msg__bindgen_ty_1 {
default() -> Self122     fn default() -> Self {
123         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
124         unsafe {
125             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
126             s.assume_init()
127         }
128     }
129 }
130 impl Default for vhost_msg {
default() -> Self131     fn default() -> Self {
132         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
133         unsafe {
134             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
135             s.assume_init()
136         }
137     }
138 }
139 #[repr(C)]
140 #[derive(Copy, Clone)]
141 pub struct vhost_msg_v2 {
142     pub type_: u32,
143     pub asid: u32,
144     pub __bindgen_anon_1: vhost_msg_v2__bindgen_ty_1,
145 }
146 #[repr(C)]
147 #[derive(Copy, Clone)]
148 pub union vhost_msg_v2__bindgen_ty_1 {
149     pub iotlb: vhost_iotlb_msg,
150     pub padding: [u8; 64usize],
151 }
152 impl Default for vhost_msg_v2__bindgen_ty_1 {
default() -> Self153     fn default() -> Self {
154         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
155         unsafe {
156             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
157             s.assume_init()
158         }
159     }
160 }
161 impl Default for vhost_msg_v2 {
default() -> Self162     fn default() -> Self {
163         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
164         unsafe {
165             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
166             s.assume_init()
167         }
168     }
169 }
170 #[repr(C)]
171 #[derive(Debug, Default, Copy, Clone)]
172 pub struct vhost_memory_region {
173     pub guest_phys_addr: u64,
174     pub memory_size: u64,
175     pub userspace_addr: u64,
176     pub flags_padding: u64,
177 }
178 #[repr(C)]
179 #[derive(Debug, Default)]
180 pub struct vhost_memory {
181     pub nregions: u32,
182     pub padding: u32,
183     pub regions: __IncompleteArrayField<vhost_memory_region>,
184 }
185 #[repr(C)]
186 #[derive(Debug, Copy, Clone)]
187 pub struct vhost_scsi_target {
188     pub abi_version: ::std::os::raw::c_int,
189     pub vhost_wwpn: [::std::os::raw::c_char; 224usize],
190     pub vhost_tpgt: ::std::os::raw::c_ushort,
191     pub reserved: ::std::os::raw::c_ushort,
192 }
193 impl Default for vhost_scsi_target {
default() -> Self194     fn default() -> Self {
195         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
196         unsafe {
197             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
198             s.assume_init()
199         }
200     }
201 }
202 #[repr(C)]
203 #[derive(Debug, Default)]
204 pub struct vhost_vdpa_config {
205     pub off: u32,
206     pub len: u32,
207     pub buf: __IncompleteArrayField<u8>,
208 }
209 #[repr(C)]
210 #[derive(Debug, Default, Copy, Clone)]
211 pub struct vhost_vdpa_iova_range {
212     pub first: u64,
213     pub last: u64,
214 }
215