fdf_sys/
bindings.rs

1// Copyright 2024 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/bindgen.sh using bindgen 0.72.0
6
7#![allow(dead_code)]
8#![allow(non_camel_case_types)]
9#![allow(non_snake_case)]
10
11pub use zx_types::*;
12
13pub const DRIVER_REGISTRATION_VERSION_1: u32 = 1;
14pub const DRIVER_REGISTRATION_VERSION_MAX: u32 = 1;
15pub type async_dispatcher_t = async_dispatcher;
16pub type async_guest_bell_trap_t = async_guest_bell_trap;
17pub type async_wait_t = async_wait;
18pub type async_task_t = async_task;
19pub type async_receiver_t = async_receiver;
20#[repr(C)]
21#[derive(Debug, Copy, Clone)]
22pub struct async_irq {
23    _unused: [u8; 0],
24}
25pub type async_irq_t = async_irq;
26pub type async_paged_vmo_t = async_paged_vmo;
27pub type async_sequence_id_t = async_sequence_id;
28#[repr(C)]
29#[derive(Debug, Default, Copy, Clone)]
30pub struct async_state_t {
31    pub reserved: [usize; 2usize],
32}
33#[allow(clippy::unnecessary_operation, clippy::identity_op)]
34const _: () = {
35    ["Size of async_state_t"][::core::mem::size_of::<async_state_t>() - 16usize];
36    ["Alignment of async_state_t"][::core::mem::align_of::<async_state_t>() - 8usize];
37    ["Offset of field: async_state_t::reserved"]
38        [::core::mem::offset_of!(async_state_t, reserved) - 0usize];
39};
40pub type async_ops_version_t = u32;
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}
50#[repr(C)]
51#[derive(Debug, Default, Copy, Clone)]
52pub struct async_ops_v1 {
53    pub now: ::core::option::Option<
54        unsafe extern "C" fn(dispatcher: *mut async_dispatcher_t) -> zx_time_t,
55    >,
56    pub begin_wait: ::core::option::Option<
57        unsafe extern "C" fn(
58            dispatcher: *mut async_dispatcher_t,
59            wait: *mut async_wait_t,
60        ) -> zx_status_t,
61    >,
62    pub cancel_wait: ::core::option::Option<
63        unsafe extern "C" fn(
64            dispatcher: *mut async_dispatcher_t,
65            wait: *mut async_wait_t,
66        ) -> zx_status_t,
67    >,
68    pub post_task: ::core::option::Option<
69        unsafe extern "C" fn(
70            dispatcher: *mut async_dispatcher_t,
71            task: *mut async_task_t,
72        ) -> zx_status_t,
73    >,
74    pub cancel_task: ::core::option::Option<
75        unsafe extern "C" fn(
76            dispatcher: *mut async_dispatcher_t,
77            task: *mut async_task_t,
78        ) -> zx_status_t,
79    >,
80    pub queue_packet: ::core::option::Option<
81        unsafe extern "C" fn(
82            dispatcher: *mut async_dispatcher_t,
83            receiver: *mut async_receiver_t,
84            data: *const zx_packet_user_t,
85        ) -> zx_status_t,
86    >,
87    pub set_guest_bell_trap: ::core::option::Option<
88        unsafe extern "C" fn(
89            dispatcher: *mut async_dispatcher_t,
90            trap: *mut async_guest_bell_trap_t,
91            guest: zx_handle_t,
92            addr: zx_vaddr_t,
93            length: usize,
94        ) -> zx_status_t,
95    >,
96}
97#[allow(clippy::unnecessary_operation, clippy::identity_op)]
98const _: () = {
99    ["Size of async_ops_v1"][::core::mem::size_of::<async_ops_v1>() - 56usize];
100    ["Alignment of async_ops_v1"][::core::mem::align_of::<async_ops_v1>() - 8usize];
101    ["Offset of field: async_ops_v1::now"][::core::mem::offset_of!(async_ops_v1, now) - 0usize];
102    ["Offset of field: async_ops_v1::begin_wait"]
103        [::core::mem::offset_of!(async_ops_v1, begin_wait) - 8usize];
104    ["Offset of field: async_ops_v1::cancel_wait"]
105        [::core::mem::offset_of!(async_ops_v1, cancel_wait) - 16usize];
106    ["Offset of field: async_ops_v1::post_task"]
107        [::core::mem::offset_of!(async_ops_v1, post_task) - 24usize];
108    ["Offset of field: async_ops_v1::cancel_task"]
109        [::core::mem::offset_of!(async_ops_v1, cancel_task) - 32usize];
110    ["Offset of field: async_ops_v1::queue_packet"]
111        [::core::mem::offset_of!(async_ops_v1, queue_packet) - 40usize];
112    ["Offset of field: async_ops_v1::set_guest_bell_trap"]
113        [::core::mem::offset_of!(async_ops_v1, set_guest_bell_trap) - 48usize];
114};
115#[repr(C)]
116#[derive(Debug, Default, Copy, Clone)]
117pub struct async_ops_v2 {
118    pub bind_irq: ::core::option::Option<
119        unsafe extern "C" fn(
120            dispatcher: *mut async_dispatcher_t,
121            irq: *mut async_irq_t,
122        ) -> zx_status_t,
123    >,
124    pub unbind_irq: ::core::option::Option<
125        unsafe extern "C" fn(
126            dispatcher: *mut async_dispatcher_t,
127            irq: *mut async_irq_t,
128        ) -> zx_status_t,
129    >,
130    pub create_paged_vmo: ::core::option::Option<
131        unsafe extern "C" fn(
132            dispatcher: *mut async_dispatcher_t,
133            paged_vmo: *mut async_paged_vmo_t,
134            options: u32,
135            pager: zx_handle_t,
136            vmo_size: u64,
137            vmo_out: *mut zx_handle_t,
138        ) -> zx_status_t,
139    >,
140    pub detach_paged_vmo: ::core::option::Option<
141        unsafe extern "C" fn(
142            dispatcher: *mut async_dispatcher_t,
143            paged_vmo: *mut async_paged_vmo_t,
144        ) -> zx_status_t,
145    >,
146}
147#[allow(clippy::unnecessary_operation, clippy::identity_op)]
148const _: () = {
149    ["Size of async_ops_v2"][::core::mem::size_of::<async_ops_v2>() - 32usize];
150    ["Alignment of async_ops_v2"][::core::mem::align_of::<async_ops_v2>() - 8usize];
151    ["Offset of field: async_ops_v2::bind_irq"]
152        [::core::mem::offset_of!(async_ops_v2, bind_irq) - 0usize];
153    ["Offset of field: async_ops_v2::unbind_irq"]
154        [::core::mem::offset_of!(async_ops_v2, unbind_irq) - 8usize];
155    ["Offset of field: async_ops_v2::create_paged_vmo"]
156        [::core::mem::offset_of!(async_ops_v2, create_paged_vmo) - 16usize];
157    ["Offset of field: async_ops_v2::detach_paged_vmo"]
158        [::core::mem::offset_of!(async_ops_v2, detach_paged_vmo) - 24usize];
159};
160#[repr(C)]
161#[derive(Debug, Default, Copy, Clone)]
162pub struct async_ops_v3 {
163    pub get_sequence_id: ::core::option::Option<
164        unsafe extern "C" fn(
165            dispatcher: *mut async_dispatcher_t,
166            out_sequence_id: *mut async_sequence_id_t,
167            out_error: *mut *const ::core::ffi::c_char,
168        ) -> zx_status_t,
169    >,
170    pub check_sequence_id: ::core::option::Option<
171        unsafe extern "C" fn(
172            dispatcher: *mut async_dispatcher_t,
173            sequence_id: async_sequence_id_t,
174            out_error: *mut *const ::core::ffi::c_char,
175        ) -> zx_status_t,
176    >,
177}
178#[allow(clippy::unnecessary_operation, clippy::identity_op)]
179const _: () = {
180    ["Size of async_ops_v3"][::core::mem::size_of::<async_ops_v3>() - 16usize];
181    ["Alignment of async_ops_v3"][::core::mem::align_of::<async_ops_v3>() - 8usize];
182    ["Offset of field: async_ops_v3::get_sequence_id"]
183        [::core::mem::offset_of!(async_ops_v3, get_sequence_id) - 0usize];
184    ["Offset of field: async_ops_v3::check_sequence_id"]
185        [::core::mem::offset_of!(async_ops_v3, check_sequence_id) - 8usize];
186};
187#[allow(clippy::unnecessary_operation, clippy::identity_op)]
188const _: () = {
189    ["Size of async_ops"][::core::mem::size_of::<async_ops>() - 112usize];
190    ["Alignment of async_ops"][::core::mem::align_of::<async_ops>() - 8usize];
191    ["Offset of field: async_ops::version"][::core::mem::offset_of!(async_ops, version) - 0usize];
192    ["Offset of field: async_ops::reserved"][::core::mem::offset_of!(async_ops, reserved) - 4usize];
193    ["Offset of field: async_ops::v1"][::core::mem::offset_of!(async_ops, v1) - 8usize];
194    ["Offset of field: async_ops::v2"][::core::mem::offset_of!(async_ops, v2) - 64usize];
195    ["Offset of field: async_ops::v3"][::core::mem::offset_of!(async_ops, v3) - 96usize];
196};
197pub type async_ops_t = async_ops;
198#[repr(C)]
199#[derive(Debug, Copy, Clone)]
200pub struct async_dispatcher {
201    pub ops: *const async_ops_t,
202}
203#[allow(clippy::unnecessary_operation, clippy::identity_op)]
204const _: () = {
205    ["Size of async_dispatcher"][::core::mem::size_of::<async_dispatcher>() - 8usize];
206    ["Alignment of async_dispatcher"][::core::mem::align_of::<async_dispatcher>() - 8usize];
207    ["Offset of field: async_dispatcher::ops"]
208        [::core::mem::offset_of!(async_dispatcher, ops) - 0usize];
209};
210impl Default for async_dispatcher {
211    fn default() -> Self {
212        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
213        unsafe {
214            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
215            s.assume_init()
216        }
217    }
218}
219pub type async_paged_vmo_handler_t = ::core::option::Option<
220    unsafe extern "C" fn(
221        dispatcher: *mut async_dispatcher_t,
222        paged_vmo: *mut async_paged_vmo_t,
223        status: zx_status_t,
224        request: *const zx_packet_page_request_t,
225    ),
226>;
227#[repr(C)]
228pub struct async_paged_vmo {
229    pub state: async_state_t,
230    pub handler: async_paged_vmo_handler_t,
231    pub pager: zx_handle_t,
232    pub vmo: zx_handle_t,
233}
234#[allow(clippy::unnecessary_operation, clippy::identity_op)]
235const _: () = {
236    ["Size of async_paged_vmo"][::core::mem::size_of::<async_paged_vmo>() - 32usize];
237    ["Alignment of async_paged_vmo"][::core::mem::align_of::<async_paged_vmo>() - 8usize];
238    ["Offset of field: async_paged_vmo::state"]
239        [::core::mem::offset_of!(async_paged_vmo, state) - 0usize];
240    ["Offset of field: async_paged_vmo::handler"]
241        [::core::mem::offset_of!(async_paged_vmo, handler) - 16usize];
242    ["Offset of field: async_paged_vmo::pager"]
243        [::core::mem::offset_of!(async_paged_vmo, pager) - 24usize];
244    ["Offset of field: async_paged_vmo::vmo"]
245        [::core::mem::offset_of!(async_paged_vmo, vmo) - 28usize];
246};
247impl Default for async_paged_vmo {
248    fn default() -> Self {
249        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
250        unsafe {
251            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
252            s.assume_init()
253        }
254    }
255}
256impl ::core::fmt::Debug for async_paged_vmo {
257    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
258        write!(f, "async_paged_vmo {{ state: {:?}, handler: {:?} }}", self.state, self.handler)
259    }
260}
261unsafe extern "C" {
262    pub fn async_create_paged_vmo(
263        dispatcher: *mut async_dispatcher_t,
264        paged_vmo: *mut async_paged_vmo_t,
265        options: u32,
266        pager: zx_handle_t,
267        vmo_size: u64,
268        vmo_out: *mut zx_handle_t,
269    ) -> zx_status_t;
270}
271unsafe extern "C" {
272    pub fn async_detach_paged_vmo(
273        dispatcher: *mut async_dispatcher_t,
274        paged_vmo: *mut async_paged_vmo_t,
275    ) -> zx_status_t;
276}
277pub type async_receiver_handler_t = ::core::option::Option<
278    unsafe extern "C" fn(
279        dispatcher: *mut async_dispatcher_t,
280        receiver: *mut async_receiver_t,
281        status: zx_status_t,
282        data: *const zx_packet_user_t,
283    ),
284>;
285#[repr(C)]
286#[derive(Debug, Default, Copy, Clone)]
287pub struct async_receiver {
288    pub state: async_state_t,
289    pub handler: async_receiver_handler_t,
290}
291#[allow(clippy::unnecessary_operation, clippy::identity_op)]
292const _: () = {
293    ["Size of async_receiver"][::core::mem::size_of::<async_receiver>() - 24usize];
294    ["Alignment of async_receiver"][::core::mem::align_of::<async_receiver>() - 8usize];
295    ["Offset of field: async_receiver::state"]
296        [::core::mem::offset_of!(async_receiver, state) - 0usize];
297    ["Offset of field: async_receiver::handler"]
298        [::core::mem::offset_of!(async_receiver, handler) - 16usize];
299};
300unsafe extern "C" {
301    pub fn async_queue_packet(
302        dispatcher: *mut async_dispatcher_t,
303        receiver: *mut async_receiver_t,
304        data: *const zx_packet_user_t,
305    ) -> zx_status_t;
306}
307#[repr(C)]
308#[derive(Debug, Default, Copy, Clone)]
309pub struct async_sequence_id {
310    pub value: u64,
311}
312#[allow(clippy::unnecessary_operation, clippy::identity_op)]
313const _: () = {
314    ["Size of async_sequence_id"][::core::mem::size_of::<async_sequence_id>() - 8usize];
315    ["Alignment of async_sequence_id"][::core::mem::align_of::<async_sequence_id>() - 8usize];
316    ["Offset of field: async_sequence_id::value"]
317        [::core::mem::offset_of!(async_sequence_id, value) - 0usize];
318};
319unsafe extern "C" {
320    pub fn async_get_sequence_id(
321        dispatcher: *mut async_dispatcher_t,
322        out_sequence_id: *mut async_sequence_id_t,
323        out_error: *mut *const ::core::ffi::c_char,
324    ) -> zx_status_t;
325}
326unsafe extern "C" {
327    pub fn async_check_sequence_id(
328        dispatcher: *mut async_dispatcher_t,
329        sequence_id: async_sequence_id_t,
330        out_error: *mut *const ::core::ffi::c_char,
331    ) -> zx_status_t;
332}
333pub type async_task_handler_t = ::core::option::Option<
334    unsafe extern "C" fn(
335        dispatcher: *mut async_dispatcher_t,
336        task: *mut async_task_t,
337        status: zx_status_t,
338    ),
339>;
340#[repr(C)]
341pub struct async_task {
342    pub state: async_state_t,
343    pub handler: async_task_handler_t,
344    pub deadline: zx_time_t,
345}
346#[allow(clippy::unnecessary_operation, clippy::identity_op)]
347const _: () = {
348    ["Size of async_task"][::core::mem::size_of::<async_task>() - 32usize];
349    ["Alignment of async_task"][::core::mem::align_of::<async_task>() - 8usize];
350    ["Offset of field: async_task::state"][::core::mem::offset_of!(async_task, state) - 0usize];
351    ["Offset of field: async_task::handler"]
352        [::core::mem::offset_of!(async_task, handler) - 16usize];
353    ["Offset of field: async_task::deadline"]
354        [::core::mem::offset_of!(async_task, deadline) - 24usize];
355};
356impl Default for async_task {
357    fn default() -> Self {
358        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
359        unsafe {
360            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
361            s.assume_init()
362        }
363    }
364}
365impl ::core::fmt::Debug for async_task {
366    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
367        write!(f, "async_task {{ state: {:?}, handler: {:?} }}", self.state, self.handler)
368    }
369}
370unsafe extern "C" {
371    pub fn async_post_task(
372        dispatcher: *mut async_dispatcher_t,
373        task: *mut async_task_t,
374    ) -> zx_status_t;
375}
376unsafe extern "C" {
377    pub fn async_cancel_task(
378        dispatcher: *mut async_dispatcher_t,
379        task: *mut async_task_t,
380    ) -> zx_status_t;
381}
382unsafe extern "C" {
383    pub fn async_now(dispatcher: *mut async_dispatcher_t) -> zx_time_t;
384}
385pub type async_guest_bell_trap_handler_t = ::core::option::Option<
386    unsafe extern "C" fn(
387        dispatcher: *mut async_dispatcher_t,
388        trap: *mut async_guest_bell_trap_t,
389        status: zx_status_t,
390        bell: *const zx_packet_guest_bell_t,
391    ),
392>;
393#[repr(C)]
394#[derive(Debug, Default, Copy, Clone)]
395pub struct async_guest_bell_trap {
396    pub state: async_state_t,
397    pub handler: async_guest_bell_trap_handler_t,
398}
399#[allow(clippy::unnecessary_operation, clippy::identity_op)]
400const _: () = {
401    ["Size of async_guest_bell_trap"][::core::mem::size_of::<async_guest_bell_trap>() - 24usize];
402    ["Alignment of async_guest_bell_trap"]
403        [::core::mem::align_of::<async_guest_bell_trap>() - 8usize];
404    ["Offset of field: async_guest_bell_trap::state"]
405        [::core::mem::offset_of!(async_guest_bell_trap, state) - 0usize];
406    ["Offset of field: async_guest_bell_trap::handler"]
407        [::core::mem::offset_of!(async_guest_bell_trap, handler) - 16usize];
408};
409unsafe extern "C" {
410    pub fn async_set_guest_bell_trap(
411        dispatcher: *mut async_dispatcher_t,
412        trap: *mut async_guest_bell_trap_t,
413        guest: zx_handle_t,
414        addr: zx_vaddr_t,
415        length: usize,
416    ) -> zx_status_t;
417}
418pub type async_wait_handler_t = ::core::option::Option<
419    unsafe extern "C" fn(
420        dispatcher: *mut async_dispatcher_t,
421        wait: *mut async_wait_t,
422        status: zx_status_t,
423        signal: *const zx_packet_signal_t,
424    ),
425>;
426#[repr(C)]
427pub struct async_wait {
428    pub state: async_state_t,
429    pub handler: async_wait_handler_t,
430    pub object: zx_handle_t,
431    pub trigger: zx_signals_t,
432    pub options: u32,
433}
434#[allow(clippy::unnecessary_operation, clippy::identity_op)]
435const _: () = {
436    ["Size of async_wait"][::core::mem::size_of::<async_wait>() - 40usize];
437    ["Alignment of async_wait"][::core::mem::align_of::<async_wait>() - 8usize];
438    ["Offset of field: async_wait::state"][::core::mem::offset_of!(async_wait, state) - 0usize];
439    ["Offset of field: async_wait::handler"]
440        [::core::mem::offset_of!(async_wait, handler) - 16usize];
441    ["Offset of field: async_wait::object"][::core::mem::offset_of!(async_wait, object) - 24usize];
442    ["Offset of field: async_wait::trigger"]
443        [::core::mem::offset_of!(async_wait, trigger) - 28usize];
444    ["Offset of field: async_wait::options"]
445        [::core::mem::offset_of!(async_wait, options) - 32usize];
446};
447impl Default for async_wait {
448    fn default() -> Self {
449        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
450        unsafe {
451            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
452            s.assume_init()
453        }
454    }
455}
456impl ::core::fmt::Debug for async_wait {
457    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
458        write!(f, "async_wait {{ state: {:?}, handler: {:?} }}", self.state, self.handler)
459    }
460}
461unsafe extern "C" {
462    pub fn async_begin_wait(
463        dispatcher: *mut async_dispatcher_t,
464        wait: *mut async_wait_t,
465    ) -> zx_status_t;
466}
467unsafe extern "C" {
468    pub fn async_cancel_wait(
469        dispatcher: *mut async_dispatcher_t,
470        wait: *mut async_wait_t,
471    ) -> zx_status_t;
472}
473pub type fdf_handle_t = zx_handle_t;
474pub type fdf_txid_t = zx_txid_t;
475#[repr(C)]
476#[derive(Debug, Copy, Clone)]
477pub struct fdf_arena {
478    _unused: [u8; 0],
479}
480#[repr(C)]
481#[derive(Debug, Copy, Clone)]
482pub struct fdf_channel_call_args {
483    pub wr_arena: *mut fdf_arena,
484    pub wr_data: *mut ::core::ffi::c_void,
485    pub wr_num_bytes: u32,
486    pub wr_handles: *mut zx_handle_t,
487    pub wr_num_handles: u32,
488    pub rd_arena: *mut *mut fdf_arena,
489    pub rd_data: *mut *mut ::core::ffi::c_void,
490    pub rd_num_bytes: *mut u32,
491    pub rd_handles: *mut *mut zx_handle_t,
492    pub rd_num_handles: *mut u32,
493}
494#[allow(clippy::unnecessary_operation, clippy::identity_op)]
495const _: () = {
496    ["Size of fdf_channel_call_args"][::core::mem::size_of::<fdf_channel_call_args>() - 80usize];
497    ["Alignment of fdf_channel_call_args"]
498        [::core::mem::align_of::<fdf_channel_call_args>() - 8usize];
499    ["Offset of field: fdf_channel_call_args::wr_arena"]
500        [::core::mem::offset_of!(fdf_channel_call_args, wr_arena) - 0usize];
501    ["Offset of field: fdf_channel_call_args::wr_data"]
502        [::core::mem::offset_of!(fdf_channel_call_args, wr_data) - 8usize];
503    ["Offset of field: fdf_channel_call_args::wr_num_bytes"]
504        [::core::mem::offset_of!(fdf_channel_call_args, wr_num_bytes) - 16usize];
505    ["Offset of field: fdf_channel_call_args::wr_handles"]
506        [::core::mem::offset_of!(fdf_channel_call_args, wr_handles) - 24usize];
507    ["Offset of field: fdf_channel_call_args::wr_num_handles"]
508        [::core::mem::offset_of!(fdf_channel_call_args, wr_num_handles) - 32usize];
509    ["Offset of field: fdf_channel_call_args::rd_arena"]
510        [::core::mem::offset_of!(fdf_channel_call_args, rd_arena) - 40usize];
511    ["Offset of field: fdf_channel_call_args::rd_data"]
512        [::core::mem::offset_of!(fdf_channel_call_args, rd_data) - 48usize];
513    ["Offset of field: fdf_channel_call_args::rd_num_bytes"]
514        [::core::mem::offset_of!(fdf_channel_call_args, rd_num_bytes) - 56usize];
515    ["Offset of field: fdf_channel_call_args::rd_handles"]
516        [::core::mem::offset_of!(fdf_channel_call_args, rd_handles) - 64usize];
517    ["Offset of field: fdf_channel_call_args::rd_num_handles"]
518        [::core::mem::offset_of!(fdf_channel_call_args, rd_num_handles) - 72usize];
519};
520impl Default for fdf_channel_call_args {
521    fn default() -> Self {
522        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
523        unsafe {
524            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
525            s.assume_init()
526        }
527    }
528}
529pub type fdf_channel_call_args_t = fdf_channel_call_args;
530pub const FDF_DISPATCHER_OPTION_SYNCHRONIZED: u32 = 0;
531pub const FDF_DISPATCHER_OPTION_UNSYNCHRONIZED: u32 = 1;
532pub const FDF_DISPATCHER_OPTION_ALLOW_SYNC_CALLS: u32 = 2;
533pub const FDF_DISPATCHER_OPTION_SYNCHRONIZATION_MASK: u32 = 1;
534pub const FDF_CHANNEL_WAIT_OPTION_FORCE_ASYNC_CANCEL: u32 = 1;
535pub type fdf_arena_t = fdf_arena;
536pub type fdf_arena_tag_t = u32;
537unsafe extern "C" {
538    pub fn fdf_arena_create(
539        options: u32,
540        tag: fdf_arena_tag_t,
541        out_arena: *mut *mut fdf_arena_t,
542    ) -> zx_status_t;
543}
544unsafe extern "C" {
545    pub fn fdf_arena_allocate(arena: *mut fdf_arena_t, bytes: usize) -> *mut ::core::ffi::c_void;
546}
547unsafe extern "C" {
548    pub fn fdf_arena_free(arena: *mut fdf_arena_t, ptr: *mut ::core::ffi::c_void);
549}
550unsafe extern "C" {
551    pub fn fdf_arena_contains(
552        arena: *mut fdf_arena_t,
553        ptr: *const ::core::ffi::c_void,
554        num_bytes: usize,
555    ) -> bool;
556}
557unsafe extern "C" {
558    pub fn fdf_arena_add_ref(arena: *mut fdf_arena_t);
559}
560unsafe extern "C" {
561    pub fn fdf_arena_drop_ref(arena: *mut fdf_arena_t);
562}
563#[repr(C)]
564#[derive(Debug, Copy, Clone)]
565pub struct fdf_dispatcher {
566    _unused: [u8; 0],
567}
568pub type fdf_dispatcher_t = fdf_dispatcher;
569pub type fdf_dispatcher_shutdown_observer_t = fdf_dispatcher_shutdown_observer;
570pub type fdf_dispatcher_shutdown_handler_t = ::core::option::Option<
571    unsafe extern "C" fn(
572        dispatcher: *mut fdf_dispatcher_t,
573        observer: *mut fdf_dispatcher_shutdown_observer_t,
574    ),
575>;
576#[repr(C)]
577#[derive(Debug, Default, Copy, Clone)]
578pub struct fdf_dispatcher_shutdown_observer {
579    pub handler: fdf_dispatcher_shutdown_handler_t,
580}
581#[allow(clippy::unnecessary_operation, clippy::identity_op)]
582const _: () = {
583    ["Size of fdf_dispatcher_shutdown_observer"]
584        [::core::mem::size_of::<fdf_dispatcher_shutdown_observer>() - 8usize];
585    ["Alignment of fdf_dispatcher_shutdown_observer"]
586        [::core::mem::align_of::<fdf_dispatcher_shutdown_observer>() - 8usize];
587    ["Offset of field: fdf_dispatcher_shutdown_observer::handler"]
588        [::core::mem::offset_of!(fdf_dispatcher_shutdown_observer, handler) - 0usize];
589};
590unsafe extern "C" {
591    pub fn fdf_dispatcher_create(
592        options: u32,
593        name: *const ::core::ffi::c_char,
594        name_len: usize,
595        scheduler_role: *const ::core::ffi::c_char,
596        scheduler_role_len: usize,
597        observer: *mut fdf_dispatcher_shutdown_observer_t,
598        out_dispatcher: *mut *mut fdf_dispatcher_t,
599    ) -> zx_status_t;
600}
601unsafe extern "C" {
602    pub fn fdf_dispatcher_get_async_dispatcher(
603        dispatcher: *mut fdf_dispatcher_t,
604    ) -> *mut async_dispatcher_t;
605}
606unsafe extern "C" {
607    pub fn fdf_dispatcher_downcast_async_dispatcher(
608        async_dispatcher: *mut async_dispatcher_t,
609    ) -> *mut fdf_dispatcher_t;
610}
611unsafe extern "C" {
612    pub fn fdf_dispatcher_get_current_dispatcher() -> *mut fdf_dispatcher_t;
613}
614unsafe extern "C" {
615    pub fn fdf_dispatcher_get_options(dispatcher: *const fdf_dispatcher_t) -> u32;
616}
617unsafe extern "C" {
618    pub fn fdf_dispatcher_shutdown_async(dispatcher: *mut fdf_dispatcher_t);
619}
620unsafe extern "C" {
621    pub fn fdf_dispatcher_destroy(dispatcher: *mut fdf_dispatcher_t);
622}
623unsafe extern "C" {
624    pub fn fdf_dispatcher_seal(dispatcher: *mut fdf_dispatcher_t, option: u32) -> zx_status_t;
625}
626unsafe extern "C" {
627    pub fn fdf_handle_close(handle: fdf_handle_t);
628}
629unsafe extern "C" {
630    pub fn fdf_channel_create(
631        options: u32,
632        out0: *mut fdf_handle_t,
633        out1: *mut fdf_handle_t,
634    ) -> zx_status_t;
635}
636unsafe extern "C" {
637    pub fn fdf_channel_write(
638        channel: fdf_handle_t,
639        options: u32,
640        arena: *mut fdf_arena_t,
641        data: *mut ::core::ffi::c_void,
642        num_bytes: u32,
643        handles: *mut zx_handle_t,
644        num_handles: u32,
645    ) -> zx_status_t;
646}
647unsafe extern "C" {
648    pub fn fdf_channel_read(
649        channel: fdf_handle_t,
650        options: u32,
651        out_arena: *mut *mut fdf_arena_t,
652        out_data: *mut *mut ::core::ffi::c_void,
653        out_num_bytes: *mut u32,
654        out_handles: *mut *mut zx_handle_t,
655        out_num_handles: *mut u32,
656    ) -> zx_status_t;
657}
658unsafe extern "C" {
659    pub fn fdf_channel_wait_async(
660        dispatcher: *mut fdf_dispatcher,
661        channel_read: *mut fdf_channel_read,
662        options: u32,
663    ) -> zx_status_t;
664}
665unsafe extern "C" {
666    pub fn fdf_channel_cancel_wait(handle: fdf_handle_t) -> zx_status_t;
667}
668unsafe extern "C" {
669    pub fn fdf_channel_call(
670        handle: fdf_handle_t,
671        options: u32,
672        deadline: zx_time_t,
673        args: *const fdf_channel_call_args_t,
674    ) -> zx_status_t;
675}
676pub type fdf_channel_read_t = fdf_channel_read;
677pub type fdf_channel_read_handler_t = ::core::option::Option<
678    unsafe extern "C" fn(
679        dispatcher: *mut fdf_dispatcher_t,
680        read: *mut fdf_channel_read_t,
681        status: zx_status_t,
682    ),
683>;
684#[repr(C)]
685pub struct fdf_channel_read {
686    pub state: async_state_t,
687    pub handler: fdf_channel_read_handler_t,
688    pub channel: fdf_handle_t,
689    pub options: u32,
690}
691#[allow(clippy::unnecessary_operation, clippy::identity_op)]
692const _: () = {
693    ["Size of fdf_channel_read"][::core::mem::size_of::<fdf_channel_read>() - 32usize];
694    ["Alignment of fdf_channel_read"][::core::mem::align_of::<fdf_channel_read>() - 8usize];
695    ["Offset of field: fdf_channel_read::state"]
696        [::core::mem::offset_of!(fdf_channel_read, state) - 0usize];
697    ["Offset of field: fdf_channel_read::handler"]
698        [::core::mem::offset_of!(fdf_channel_read, handler) - 16usize];
699    ["Offset of field: fdf_channel_read::channel"]
700        [::core::mem::offset_of!(fdf_channel_read, channel) - 24usize];
701    ["Offset of field: fdf_channel_read::options"]
702        [::core::mem::offset_of!(fdf_channel_read, options) - 28usize];
703};
704impl Default for fdf_channel_read {
705    fn default() -> Self {
706        let mut s = ::core::mem::MaybeUninit::<Self>::uninit();
707        unsafe {
708            ::core::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
709            s.assume_init()
710        }
711    }
712}
713impl ::core::fmt::Debug for fdf_channel_read {
714    fn fmt(&self, f: &mut ::core::fmt::Formatter<'_>) -> ::core::fmt::Result {
715        write!(f, "fdf_channel_read {{ state: {:?}, handler: {:?} }}", self.state, self.handler)
716    }
717}
718pub type fdf_env_driver_shutdown_observer_t = fdf_env_driver_shutdown_observer;
719pub type fdf_env_driver_shutdown_handler_t = ::core::option::Option<
720    unsafe extern "C" fn(
721        driver: *const ::core::ffi::c_void,
722        observer: *mut fdf_env_driver_shutdown_observer_t,
723    ),
724>;
725#[repr(C)]
726#[derive(Debug, Default, Copy, Clone)]
727pub struct fdf_env_driver_shutdown_observer {
728    pub handler: fdf_env_driver_shutdown_handler_t,
729}
730#[allow(clippy::unnecessary_operation, clippy::identity_op)]
731const _: () = {
732    ["Size of fdf_env_driver_shutdown_observer"]
733        [::core::mem::size_of::<fdf_env_driver_shutdown_observer>() - 8usize];
734    ["Alignment of fdf_env_driver_shutdown_observer"]
735        [::core::mem::align_of::<fdf_env_driver_shutdown_observer>() - 8usize];
736    ["Offset of field: fdf_env_driver_shutdown_observer::handler"]
737        [::core::mem::offset_of!(fdf_env_driver_shutdown_observer, handler) - 0usize];
738};
739pub type fdf_env_stall_scanner_t = fdf_env_stall_scanner;
740pub type fdf_env_stall_scan_begin = ::core::option::Option<
741    unsafe extern "C" fn(scanner: *mut fdf_env_stall_scanner_t, duration: zx_duration_mono_t),
742>;
743#[repr(C)]
744#[derive(Debug, Default, Copy, Clone)]
745pub struct fdf_env_stall_scanner {
746    pub handler: fdf_env_stall_scan_begin,
747}
748#[allow(clippy::unnecessary_operation, clippy::identity_op)]
749const _: () = {
750    ["Size of fdf_env_stall_scanner"][::core::mem::size_of::<fdf_env_stall_scanner>() - 8usize];
751    ["Alignment of fdf_env_stall_scanner"]
752        [::core::mem::align_of::<fdf_env_stall_scanner>() - 8usize];
753    ["Offset of field: fdf_env_stall_scanner::handler"]
754        [::core::mem::offset_of!(fdf_env_stall_scanner, handler) - 0usize];
755};
756unsafe extern "C" {
757    pub fn fdf_env_start(options: u32) -> zx_status_t;
758}
759unsafe extern "C" {
760    pub fn fdf_env_reset();
761}
762unsafe extern "C" {
763    pub fn fdf_env_dispatcher_create_with_owner(
764        driver: *const ::core::ffi::c_void,
765        options: u32,
766        name: *const ::core::ffi::c_char,
767        name_len: usize,
768        scheduler_role: *const ::core::ffi::c_char,
769        scheduler_role_len: usize,
770        observer: *mut fdf_dispatcher_shutdown_observer_t,
771        out_dispatcher: *mut *mut fdf_dispatcher_t,
772    ) -> zx_status_t;
773}
774unsafe extern "C" {
775    pub fn fdf_env_dispatcher_dump(dispatcher: *mut fdf_dispatcher_t);
776}
777unsafe extern "C" {
778    pub fn fdf_env_dispatcher_get_dump_deprecated(
779        dispatcher: *mut fdf_dispatcher_t,
780        out_dump: *mut *mut ::core::ffi::c_char,
781    );
782}
783unsafe extern "C" {
784    pub fn fdf_env_shutdown_dispatchers_async(
785        driver: *const ::core::ffi::c_void,
786        observer: *mut fdf_env_driver_shutdown_observer_t,
787    ) -> zx_status_t;
788}
789unsafe extern "C" {
790    pub fn fdf_env_destroy_all_dispatchers();
791}
792unsafe extern "C" {
793    pub fn fdf_env_register_driver_entry(driver: *const ::core::ffi::c_void);
794}
795unsafe extern "C" {
796    pub fn fdf_env_register_driver_exit();
797}
798unsafe extern "C" {
799    pub fn fdf_env_get_current_driver() -> *const ::core::ffi::c_void;
800}
801unsafe extern "C" {
802    pub fn fdf_env_dispatcher_has_queued_tasks(dispatcher: *mut fdf_dispatcher_t) -> bool;
803}
804unsafe extern "C" {
805    pub fn fdf_env_get_thread_limit(
806        scheduler_role: *const ::core::ffi::c_char,
807        scheduler_role_len: usize,
808    ) -> u32;
809}
810unsafe extern "C" {
811    pub fn fdf_env_set_thread_limit(
812        scheduler_role: *const ::core::ffi::c_char,
813        scheduler_role_len: usize,
814        max_threads: u32,
815    ) -> zx_status_t;
816}
817unsafe extern "C" {
818    pub fn fdf_env_add_allowed_scheduler_role_for_driver(
819        driver: *const ::core::ffi::c_void,
820        role: *const ::core::ffi::c_char,
821        role_length: usize,
822    );
823}
824unsafe extern "C" {
825    pub fn fdf_env_get_driver_on_tid(
826        tid: zx_koid_t,
827        out_driver: *mut *const ::core::ffi::c_void,
828    ) -> zx_status_t;
829}
830unsafe extern "C" {
831    pub fn fdf_env_scan_threads_for_stalls();
832}
833unsafe extern "C" {
834    pub fn fdf_env_scan_threads_for_stalls2() -> zx_duration_mono_t;
835}
836unsafe extern "C" {
837    pub fn fdf_env_register_stall_scanner(scanner: *mut fdf_env_stall_scanner_t);
838}
839unsafe extern "C" {
840    pub fn fdf_testing_create_unmanaged_dispatcher(
841        driver: *const ::core::ffi::c_void,
842        options: u32,
843        name: *const ::core::ffi::c_char,
844        name_len: usize,
845        observer: *mut fdf_dispatcher_shutdown_observer_t,
846        out_dispatcher: *mut *mut fdf_dispatcher_t,
847    ) -> zx_status_t;
848}
849unsafe extern "C" {
850    pub fn fdf_testing_set_default_dispatcher(dispatcher: *mut fdf_dispatcher_t) -> zx_status_t;
851}
852unsafe extern "C" {
853    pub fn fdf_testing_run(deadline: zx_time_t, once: bool) -> zx_status_t;
854}
855unsafe extern "C" {
856    pub fn fdf_testing_run_until_idle() -> zx_status_t;
857}
858unsafe extern "C" {
859    pub fn fdf_testing_quit();
860}
861unsafe extern "C" {
862    pub fn fdf_testing_reset_quit() -> zx_status_t;
863}
864pub type fdf_token_t = fdf_token;
865pub type fdf_token_transfer_handler_t = ::core::option::Option<
866    unsafe extern "C" fn(
867        dispatcher: *mut fdf_dispatcher_t,
868        token: *mut fdf_token_t,
869        status: zx_status_t,
870        handle: fdf_handle_t,
871    ),
872>;
873#[repr(C)]
874#[derive(Debug, Default, Copy, Clone)]
875pub struct fdf_token {
876    pub handler: fdf_token_transfer_handler_t,
877}
878#[allow(clippy::unnecessary_operation, clippy::identity_op)]
879const _: () = {
880    ["Size of fdf_token"][::core::mem::size_of::<fdf_token>() - 8usize];
881    ["Alignment of fdf_token"][::core::mem::align_of::<fdf_token>() - 8usize];
882    ["Offset of field: fdf_token::handler"][::core::mem::offset_of!(fdf_token, handler) - 0usize];
883};
884unsafe extern "C" {
885    pub fn fdf_token_register(
886        token: zx_handle_t,
887        dispatcher: *mut fdf_dispatcher_t,
888        handler: *mut fdf_token_t,
889    ) -> zx_status_t;
890}
891unsafe extern "C" {
892    pub fn fdf_token_receive(token: zx_handle_t, handle: *mut fdf_handle_t) -> zx_status_t;
893}
894unsafe extern "C" {
895    pub fn fdf_token_transfer(token: zx_handle_t, handle: fdf_handle_t) -> zx_status_t;
896}
897#[repr(C)]
898#[derive(Debug, Default, Copy, Clone)]
899pub struct DriverRegistration {
900    pub version: u64,
901    pub v1: DriverRegistration_driver_registration_v1,
902}
903#[repr(C)]
904#[derive(Debug, Default, Copy, Clone)]
905pub struct DriverRegistration_driver_registration_v1 {
906    pub initialize: ::core::option::Option<
907        unsafe extern "C" fn(server_handle: fdf_handle_t) -> *mut ::core::ffi::c_void,
908    >,
909    pub destroy: ::core::option::Option<unsafe extern "C" fn(token: *mut ::core::ffi::c_void)>,
910}
911#[allow(clippy::unnecessary_operation, clippy::identity_op)]
912const _: () = {
913    ["Size of DriverRegistration_driver_registration_v1"]
914        [::core::mem::size_of::<DriverRegistration_driver_registration_v1>() - 16usize];
915    ["Alignment of DriverRegistration_driver_registration_v1"]
916        [::core::mem::align_of::<DriverRegistration_driver_registration_v1>() - 8usize];
917    ["Offset of field: DriverRegistration_driver_registration_v1::initialize"]
918        [::core::mem::offset_of!(DriverRegistration_driver_registration_v1, initialize) - 0usize];
919    ["Offset of field: DriverRegistration_driver_registration_v1::destroy"]
920        [::core::mem::offset_of!(DriverRegistration_driver_registration_v1, destroy) - 8usize];
921};
922#[allow(clippy::unnecessary_operation, clippy::identity_op)]
923const _: () = {
924    ["Size of DriverRegistration"][::core::mem::size_of::<DriverRegistration>() - 24usize];
925    ["Alignment of DriverRegistration"][::core::mem::align_of::<DriverRegistration>() - 8usize];
926    ["Offset of field: DriverRegistration::version"]
927        [::core::mem::offset_of!(DriverRegistration, version) - 0usize];
928    ["Offset of field: DriverRegistration::v1"]
929        [::core::mem::offset_of!(DriverRegistration, v1) - 8usize];
930};