1#![expect(non_camel_case_types)]
8
9use zx_types::*;
10
11pub type async_dispatcher_t = async_dispatcher;
12pub type async_guest_bell_trap_t = async_guest_bell_trap;
13pub type async_wait_t = async_wait;
14pub type async_task_t = async_task;
15pub type async_receiver_t = async_receiver;
16#[repr(C)]
17#[derive(Debug)]
18pub struct async_irq {
19 _unused: [u8; 0],
20}
21pub type async_irq_t = async_irq;
22pub type async_paged_vmo_t = async_paged_vmo;
23pub type async_sequence_id_t = async_sequence_id;
24#[repr(C)]
25#[derive(Debug, Default, Copy, Clone)]
26pub struct async_state_t {
27 pub reserved: [usize; 2usize],
28}
29#[allow(clippy::unnecessary_operation, clippy::identity_op)]
30const _: () = {
31 ["Size of async_state_t"][::core::mem::size_of::<async_state_t>() - 16usize];
32 ["Alignment of async_state_t"][::core::mem::align_of::<async_state_t>() - 8usize];
33 ["Offset of field: async_state_t::reserved"]
34 [::core::mem::offset_of!(async_state_t, reserved) - 0usize];
35};
36pub type async_ops_version_t = u32;
37pub const ASYNC_OPS_V1: async_ops_version_t = 1;
38pub const ASYNC_OPS_V2: async_ops_version_t = 2;
39pub const ASYNC_OPS_V3: async_ops_version_t = 3;
40pub const ASYNC_OPS_V4: async_ops_version_t = 4;
41#[repr(C)]
42#[derive(Debug, Default, Copy, Clone)]
43pub struct async_ops {
44 pub version: async_ops_version_t,
45 pub reserved: u32,
46 pub v1: async_ops_v1,
47 pub v2: async_ops_v2,
48 pub v3: async_ops_v3,
49 pub v4: async_ops_v4,
50}
51#[repr(C)]
52#[derive(Debug, Default, Copy, Clone)]
53pub struct async_ops_v1 {
54 pub now: ::core::option::Option<
55 unsafe extern "C" fn(dispatcher: *mut async_dispatcher_t) -> zx_time_t,
56 >,
57 pub begin_wait: ::core::option::Option<
58 unsafe extern "C" fn(
59 dispatcher: *mut async_dispatcher_t,
60 wait: *mut async_wait_t,
61 ) -> zx_status_t,
62 >,
63 pub cancel_wait: ::core::option::Option<
64 unsafe extern "C" fn(
65 dispatcher: *mut async_dispatcher_t,
66 wait: *mut async_wait_t,
67 ) -> zx_status_t,
68 >,
69 pub post_task: ::core::option::Option<
70 unsafe extern "C" fn(
71 dispatcher: *mut async_dispatcher_t,
72 task: *mut async_task_t,
73 ) -> zx_status_t,
74 >,
75 pub cancel_task: ::core::option::Option<
76 unsafe extern "C" fn(
77 dispatcher: *mut async_dispatcher_t,
78 task: *mut async_task_t,
79 ) -> zx_status_t,
80 >,
81 pub queue_packet: ::core::option::Option<
82 unsafe extern "C" fn(
83 dispatcher: *mut async_dispatcher_t,
84 receiver: *mut async_receiver_t,
85 data: *const zx_packet_user_t,
86 ) -> zx_status_t,
87 >,
88 pub set_guest_bell_trap: ::core::option::Option<
89 unsafe extern "C" fn(
90 dispatcher: *mut async_dispatcher_t,
91 trap: *mut async_guest_bell_trap_t,
92 guest: zx_handle_t,
93 addr: zx_vaddr_t,
94 length: usize,
95 ) -> zx_status_t,
96 >,
97}
98#[allow(clippy::unnecessary_operation, clippy::identity_op)]
99const _: () = {
100 ["Size of async_ops_v1"][::core::mem::size_of::<async_ops_v1>() - 56usize];
101 ["Alignment of async_ops_v1"][::core::mem::align_of::<async_ops_v1>() - 8usize];
102 ["Offset of field: async_ops_v1::now"][::core::mem::offset_of!(async_ops_v1, now) - 0usize];
103 ["Offset of field: async_ops_v1::begin_wait"]
104 [::core::mem::offset_of!(async_ops_v1, begin_wait) - 8usize];
105 ["Offset of field: async_ops_v1::cancel_wait"]
106 [::core::mem::offset_of!(async_ops_v1, cancel_wait) - 16usize];
107 ["Offset of field: async_ops_v1::post_task"]
108 [::core::mem::offset_of!(async_ops_v1, post_task) - 24usize];
109 ["Offset of field: async_ops_v1::cancel_task"]
110 [::core::mem::offset_of!(async_ops_v1, cancel_task) - 32usize];
111 ["Offset of field: async_ops_v1::queue_packet"]
112 [::core::mem::offset_of!(async_ops_v1, queue_packet) - 40usize];
113 ["Offset of field: async_ops_v1::set_guest_bell_trap"]
114 [::core::mem::offset_of!(async_ops_v1, set_guest_bell_trap) - 48usize];
115};
116#[repr(C)]
117#[derive(Debug, Default, Copy, Clone)]
118pub struct async_ops_v2 {
119 pub bind_irq: ::core::option::Option<
120 unsafe extern "C" fn(
121 dispatcher: *mut async_dispatcher_t,
122 irq: *mut async_irq_t,
123 ) -> zx_status_t,
124 >,
125 pub unbind_irq: ::core::option::Option<
126 unsafe extern "C" fn(
127 dispatcher: *mut async_dispatcher_t,
128 irq: *mut async_irq_t,
129 ) -> zx_status_t,
130 >,
131 pub create_paged_vmo: ::core::option::Option<
132 unsafe extern "C" fn(
133 dispatcher: *mut async_dispatcher_t,
134 paged_vmo: *mut async_paged_vmo_t,
135 options: u32,
136 pager: zx_handle_t,
137 vmo_size: u64,
138 vmo_out: *mut zx_handle_t,
139 ) -> zx_status_t,
140 >,
141 pub detach_paged_vmo: ::core::option::Option<
142 unsafe extern "C" fn(
143 dispatcher: *mut async_dispatcher_t,
144 paged_vmo: *mut async_paged_vmo_t,
145 ) -> zx_status_t,
146 >,
147}
148#[allow(clippy::unnecessary_operation, clippy::identity_op)]
149const _: () = {
150 ["Size of async_ops_v2"][::core::mem::size_of::<async_ops_v2>() - 32usize];
151 ["Alignment of async_ops_v2"][::core::mem::align_of::<async_ops_v2>() - 8usize];
152 ["Offset of field: async_ops_v2::bind_irq"]
153 [::core::mem::offset_of!(async_ops_v2, bind_irq) - 0usize];
154 ["Offset of field: async_ops_v2::unbind_irq"]
155 [::core::mem::offset_of!(async_ops_v2, unbind_irq) - 8usize];
156 ["Offset of field: async_ops_v2::create_paged_vmo"]
157 [::core::mem::offset_of!(async_ops_v2, create_paged_vmo) - 16usize];
158 ["Offset of field: async_ops_v2::detach_paged_vmo"]
159 [::core::mem::offset_of!(async_ops_v2, detach_paged_vmo) - 24usize];
160};
161#[repr(C)]
162#[derive(Debug, Default, Copy, Clone)]
163pub struct async_ops_v3 {
164 pub get_sequence_id: ::core::option::Option<
165 unsafe extern "C" fn(
166 dispatcher: *mut async_dispatcher_t,
167 out_sequence_id: *mut async_sequence_id_t,
168 out_error: *mut *const ::core::ffi::c_char,
169 ) -> zx_status_t,
170 >,
171 pub check_sequence_id: ::core::option::Option<
172 unsafe extern "C" fn(
173 dispatcher: *mut async_dispatcher_t,
174 sequence_id: async_sequence_id_t,
175 out_error: *mut *const ::core::ffi::c_char,
176 ) -> zx_status_t,
177 >,
178}
179#[allow(clippy::unnecessary_operation, clippy::identity_op)]
180const _: () = {
181 ["Size of async_ops_v3"][::core::mem::size_of::<async_ops_v3>() - 16usize];
182 ["Alignment of async_ops_v3"][::core::mem::align_of::<async_ops_v3>() - 8usize];
183 ["Offset of field: async_ops_v3::get_sequence_id"]
184 [::core::mem::offset_of!(async_ops_v3, get_sequence_id) - 0usize];
185 ["Offset of field: async_ops_v3::check_sequence_id"]
186 [::core::mem::offset_of!(async_ops_v3, check_sequence_id) - 8usize];
187};
188#[repr(C)]
189#[derive(Debug, Default, Copy, Clone)]
190pub struct async_ops_v4 {
191 pub acquire_shared_ref: ::core::option::Option<
192 unsafe extern "C" fn(dispatcher: *mut async_dispatcher_t) -> zx_status_t,
193 >,
194 pub release_shared_ref: ::core::option::Option<
195 unsafe extern "C" fn(dispatcher: *mut async_dispatcher_t) -> zx_status_t,
196 >,
197}
198#[allow(clippy::unnecessary_operation, clippy::identity_op)]
199const _: () = {
200 ["Size of async_ops_v4"][::core::mem::size_of::<async_ops_v4>() - 16usize];
201 ["Alignment of async_ops_v4"][::core::mem::align_of::<async_ops_v4>() - 8usize];
202 ["Offset of field: async_ops_v4::acquire_shared_ref"]
203 [::core::mem::offset_of!(async_ops_v4, acquire_shared_ref) - 0usize];
204 ["Offset of field: async_ops_v4::release_shared_ref"]
205 [::core::mem::offset_of!(async_ops_v4, release_shared_ref) - 8usize];
206};
207#[allow(clippy::unnecessary_operation, clippy::identity_op)]
208const _: () = {
209 ["Size of async_ops"][::core::mem::size_of::<async_ops>() - 128usize];
210 ["Alignment of async_ops"][::core::mem::align_of::<async_ops>() - 8usize];
211 ["Offset of field: async_ops::version"][::core::mem::offset_of!(async_ops, version) - 0usize];
212 ["Offset of field: async_ops::reserved"][::core::mem::offset_of!(async_ops, reserved) - 4usize];
213 ["Offset of field: async_ops::v1"][::core::mem::offset_of!(async_ops, v1) - 8usize];
214 ["Offset of field: async_ops::v2"][::core::mem::offset_of!(async_ops, v2) - 64usize];
215 ["Offset of field: async_ops::v3"][::core::mem::offset_of!(async_ops, v3) - 96usize];
216 ["Offset of field: async_ops::v4"][::core::mem::offset_of!(async_ops, v4) - 112usize];
217};
218pub type async_ops_t = async_ops;
219#[repr(C)]
220#[derive(Debug, Copy, Clone)]
221pub struct async_dispatcher {
222 pub ops: *const async_ops_t,
223}
224#[allow(clippy::unnecessary_operation, clippy::identity_op)]
225const _: () = {
226 ["Size of async_dispatcher"][::core::mem::size_of::<async_dispatcher>() - 8usize];
227 ["Alignment of async_dispatcher"][::core::mem::align_of::<async_dispatcher>() - 8usize];
228 ["Offset of field: async_dispatcher::ops"]
229 [::core::mem::offset_of!(async_dispatcher, ops) - 0usize];
230};
231impl Default for async_dispatcher {
232 fn default() -> Self {
233 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
234 unsafe {
235 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
236 s.assume_init()
237 }
238 }
239}
240unsafe extern "C" {
241 pub fn async_acquire_shared_ref(dispatcher: *mut async_dispatcher_t) -> zx_status_t;
242}
243unsafe extern "C" {
244 pub fn async_release_shared_ref(dispatcher: *mut async_dispatcher_t) -> zx_status_t;
245}
246pub type async_paged_vmo_handler_t = ::core::option::Option<
247 unsafe extern "C" fn(
248 dispatcher: *mut async_dispatcher_t,
249 paged_vmo: *mut async_paged_vmo_t,
250 status: zx_status_t,
251 request: *const zx_packet_page_request_t,
252 ),
253>;
254#[repr(C)]
255pub struct async_paged_vmo {
256 pub state: async_state_t,
257 pub handler: async_paged_vmo_handler_t,
258 pub pager: zx_handle_t,
259 pub vmo: zx_handle_t,
260}
261#[allow(clippy::unnecessary_operation, clippy::identity_op)]
262const _: () = {
263 ["Size of async_paged_vmo"][::core::mem::size_of::<async_paged_vmo>() - 32usize];
264 ["Alignment of async_paged_vmo"][::core::mem::align_of::<async_paged_vmo>() - 8usize];
265 ["Offset of field: async_paged_vmo::state"]
266 [::core::mem::offset_of!(async_paged_vmo, state) - 0usize];
267 ["Offset of field: async_paged_vmo::handler"]
268 [::core::mem::offset_of!(async_paged_vmo, handler) - 16usize];
269 ["Offset of field: async_paged_vmo::pager"]
270 [::core::mem::offset_of!(async_paged_vmo, pager) - 24usize];
271 ["Offset of field: async_paged_vmo::vmo"]
272 [::core::mem::offset_of!(async_paged_vmo, vmo) - 28usize];
273};
274impl Default for async_paged_vmo {
275 fn default() -> Self {
276 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
277 unsafe {
278 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
279 s.assume_init()
280 }
281 }
282}
283impl ::core::fmt::Debug for async_paged_vmo {
284 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
285 write!(f, "async_paged_vmo {{ state: {:?}, handler: {:?} }}", self.state, self.handler)
286 }
287}
288unsafe extern "C" {
289 pub fn async_create_paged_vmo(
290 dispatcher: *mut async_dispatcher_t,
291 paged_vmo: *mut async_paged_vmo_t,
292 options: u32,
293 pager: zx_handle_t,
294 vmo_size: u64,
295 vmo_out: *mut zx_handle_t,
296 ) -> zx_status_t;
297}
298unsafe extern "C" {
299 pub fn async_detach_paged_vmo(
300 dispatcher: *mut async_dispatcher_t,
301 paged_vmo: *mut async_paged_vmo_t,
302 ) -> zx_status_t;
303}
304pub type async_receiver_handler_t = ::core::option::Option<
305 unsafe extern "C" fn(
306 dispatcher: *mut async_dispatcher_t,
307 receiver: *mut async_receiver_t,
308 status: zx_status_t,
309 data: *const zx_packet_user_t,
310 ),
311>;
312#[repr(C)]
313#[derive(Debug, Default, Copy, Clone)]
314pub struct async_receiver {
315 pub state: async_state_t,
316 pub handler: async_receiver_handler_t,
317}
318#[allow(clippy::unnecessary_operation, clippy::identity_op)]
319const _: () = {
320 ["Size of async_receiver"][::core::mem::size_of::<async_receiver>() - 24usize];
321 ["Alignment of async_receiver"][::core::mem::align_of::<async_receiver>() - 8usize];
322 ["Offset of field: async_receiver::state"]
323 [::core::mem::offset_of!(async_receiver, state) - 0usize];
324 ["Offset of field: async_receiver::handler"]
325 [::core::mem::offset_of!(async_receiver, handler) - 16usize];
326};
327unsafe extern "C" {
328 pub fn async_queue_packet(
329 dispatcher: *mut async_dispatcher_t,
330 receiver: *mut async_receiver_t,
331 data: *const zx_packet_user_t,
332 ) -> zx_status_t;
333}
334#[repr(C)]
335#[derive(Debug, Default, Copy, Clone)]
336pub struct async_sequence_id {
337 pub value: u64,
338}
339#[allow(clippy::unnecessary_operation, clippy::identity_op)]
340const _: () = {
341 ["Size of async_sequence_id"][::core::mem::size_of::<async_sequence_id>() - 8usize];
342 ["Alignment of async_sequence_id"][::core::mem::align_of::<async_sequence_id>() - 8usize];
343 ["Offset of field: async_sequence_id::value"]
344 [::core::mem::offset_of!(async_sequence_id, value) - 0usize];
345};
346unsafe extern "C" {
347 pub fn async_get_sequence_id(
348 dispatcher: *mut async_dispatcher_t,
349 out_sequence_id: *mut async_sequence_id_t,
350 out_error: *mut *const ::core::ffi::c_char,
351 ) -> zx_status_t;
352}
353unsafe extern "C" {
354 pub fn async_check_sequence_id(
355 dispatcher: *mut async_dispatcher_t,
356 sequence_id: async_sequence_id_t,
357 out_error: *mut *const ::core::ffi::c_char,
358 ) -> zx_status_t;
359}
360pub type async_task_handler_t = ::core::option::Option<
361 unsafe extern "C" fn(
362 dispatcher: *mut async_dispatcher_t,
363 task: *mut async_task_t,
364 status: zx_status_t,
365 ),
366>;
367#[repr(C)]
368pub struct async_task {
369 pub state: async_state_t,
370 pub handler: async_task_handler_t,
371 pub deadline: zx_time_t,
372}
373#[allow(clippy::unnecessary_operation, clippy::identity_op)]
374const _: () = {
375 ["Size of async_task"][::core::mem::size_of::<async_task>() - 32usize];
376 ["Alignment of async_task"][::core::mem::align_of::<async_task>() - 8usize];
377 ["Offset of field: async_task::state"][::core::mem::offset_of!(async_task, state) - 0usize];
378 ["Offset of field: async_task::handler"]
379 [::core::mem::offset_of!(async_task, handler) - 16usize];
380 ["Offset of field: async_task::deadline"]
381 [::core::mem::offset_of!(async_task, deadline) - 24usize];
382};
383impl Default for async_task {
384 fn default() -> Self {
385 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
386 unsafe {
387 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
388 s.assume_init()
389 }
390 }
391}
392impl ::core::fmt::Debug for async_task {
393 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
394 write!(f, "async_task {{ state: {:?}, handler: {:?} }}", self.state, self.handler)
395 }
396}
397unsafe extern "C" {
398 pub fn async_post_task(
399 dispatcher: *mut async_dispatcher_t,
400 task: *mut async_task_t,
401 ) -> zx_status_t;
402}
403unsafe extern "C" {
404 pub fn async_cancel_task(
405 dispatcher: *mut async_dispatcher_t,
406 task: *mut async_task_t,
407 ) -> zx_status_t;
408}
409unsafe extern "C" {
410 pub fn async_now(dispatcher: *mut async_dispatcher_t) -> zx_time_t;
411}
412pub type async_guest_bell_trap_handler_t = ::core::option::Option<
413 unsafe extern "C" fn(
414 dispatcher: *mut async_dispatcher_t,
415 trap: *mut async_guest_bell_trap_t,
416 status: zx_status_t,
417 bell: *const zx_packet_guest_bell_t,
418 ),
419>;
420#[repr(C)]
421#[derive(Debug, Default, Copy, Clone)]
422pub struct async_guest_bell_trap {
423 pub state: async_state_t,
424 pub handler: async_guest_bell_trap_handler_t,
425}
426#[allow(clippy::unnecessary_operation, clippy::identity_op)]
427const _: () = {
428 ["Size of async_guest_bell_trap"][::core::mem::size_of::<async_guest_bell_trap>() - 24usize];
429 ["Alignment of async_guest_bell_trap"]
430 [::core::mem::align_of::<async_guest_bell_trap>() - 8usize];
431 ["Offset of field: async_guest_bell_trap::state"]
432 [::core::mem::offset_of!(async_guest_bell_trap, state) - 0usize];
433 ["Offset of field: async_guest_bell_trap::handler"]
434 [::core::mem::offset_of!(async_guest_bell_trap, handler) - 16usize];
435};
436unsafe extern "C" {
437 pub fn async_set_guest_bell_trap(
438 dispatcher: *mut async_dispatcher_t,
439 trap: *mut async_guest_bell_trap_t,
440 guest: zx_handle_t,
441 addr: zx_vaddr_t,
442 length: usize,
443 ) -> zx_status_t;
444}
445pub type async_wait_handler_t = ::core::option::Option<
446 unsafe extern "C" fn(
447 dispatcher: *mut async_dispatcher_t,
448 wait: *mut async_wait_t,
449 status: zx_status_t,
450 signal: *const zx_packet_signal_t,
451 ),
452>;
453#[repr(C)]
454pub struct async_wait {
455 pub state: async_state_t,
456 pub handler: async_wait_handler_t,
457 pub object: zx_handle_t,
458 pub trigger: zx_signals_t,
459 pub options: u32,
460}
461#[allow(clippy::unnecessary_operation, clippy::identity_op)]
462const _: () = {
463 ["Size of async_wait"][::core::mem::size_of::<async_wait>() - 40usize];
464 ["Alignment of async_wait"][::core::mem::align_of::<async_wait>() - 8usize];
465 ["Offset of field: async_wait::state"][::core::mem::offset_of!(async_wait, state) - 0usize];
466 ["Offset of field: async_wait::handler"]
467 [::core::mem::offset_of!(async_wait, handler) - 16usize];
468 ["Offset of field: async_wait::object"][::core::mem::offset_of!(async_wait, object) - 24usize];
469 ["Offset of field: async_wait::trigger"]
470 [::core::mem::offset_of!(async_wait, trigger) - 28usize];
471 ["Offset of field: async_wait::options"]
472 [::core::mem::offset_of!(async_wait, options) - 32usize];
473};
474impl Default for async_wait {
475 fn default() -> Self {
476 let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
477 unsafe {
478 ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
479 s.assume_init()
480 }
481 }
482}
483impl ::core::fmt::Debug for async_wait {
484 fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
485 write!(f, "async_wait {{ state: {:?}, handler: {:?} }}", self.state, self.handler)
486 }
487}
488unsafe extern "C" {
489 pub fn async_begin_wait(
490 dispatcher: *mut async_dispatcher_t,
491 wait: *mut async_wait_t,
492 ) -> zx_status_t;
493}
494unsafe extern "C" {
495 pub fn async_cancel_wait(
496 dispatcher: *mut async_dispatcher_t,
497 wait: *mut async_wait_t,
498 ) -> zx_status_t;
499}