libasync_sys/
bindings.rs

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