xref: /aosp_15_r20/external/crosvm/vfio_sys/src/plat.rs (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1 // Copyright 2021 The ChromiumOS Authors
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 /*
6  * automatically generated by rust-bindgen 0.56.0
7  * bindgen --constified-enum '*' --with-derive-default --no-doc-comments --no-layout-tests
8  */
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     /// # Safety
27     ///
28     /// Caller must ensure that Self's size and alignment requirements match
29     /// those of `T`'s.
30     #[inline]
as_slice(&self, len: usize) -> &[T]31     pub unsafe fn as_slice(&self, len: usize) -> &[T] {
32         ::std::slice::from_raw_parts(self.as_ptr(), len)
33     }
34     /// # Safety
35     ///
36     /// Caller must ensure that Self's size and alignment requirements match
37     /// those of `T`'s.
38     #[inline]
as_mut_slice(&mut self, len: usize) -> &mut [T]39     pub unsafe fn as_mut_slice(&mut self, len: usize) -> &mut [T] {
40         ::std::slice::from_raw_parts_mut(self.as_mut_ptr(), len)
41     }
42 }
43 impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result44     fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
45         fmt.write_str("__IncompleteArrayField")
46     }
47 }
48 pub const _IOC_NRBITS: u32 = 8;
49 pub const _IOC_TYPEBITS: u32 = 8;
50 pub const _IOC_SIZEBITS: u32 = 14;
51 pub const _IOC_DIRBITS: u32 = 2;
52 pub const _IOC_NRMASK: u32 = 255;
53 pub const _IOC_TYPEMASK: u32 = 255;
54 pub const _IOC_SIZEMASK: u32 = 16383;
55 pub const _IOC_DIRMASK: u32 = 3;
56 pub const _IOC_NRSHIFT: u32 = 0;
57 pub const _IOC_TYPESHIFT: u32 = 8;
58 pub const _IOC_SIZESHIFT: u32 = 16;
59 pub const _IOC_DIRSHIFT: u32 = 30;
60 pub const _IOC_NONE: u32 = 0;
61 pub const _IOC_WRITE: u32 = 1;
62 pub const _IOC_READ: u32 = 2;
63 pub const IOC_IN: u32 = 1073741824;
64 pub const IOC_OUT: u32 = 2147483648;
65 pub const IOC_INOUT: u32 = 3221225472;
66 pub const IOCSIZE_MASK: u32 = 1073676288;
67 pub const IOCSIZE_SHIFT: u32 = 16;
68 pub const __BITS_PER_LONG: u32 = 64;
69 pub const __FD_SETSIZE: u32 = 1024;
70 pub const PLAT_IRQ_FORWARD_API_VERSION: u32 = 0;
71 pub const PLAT_IRQ_FORWARD_TYPE: u32 = 59;
72 pub const PLAT_IRQ_FORWARD_BASE: u32 = 100;
73 pub const ACPI_EVT_FORWARD_BASE: u32 = 130;
74 pub const PLAT_IRQ_FORWARD_SET_LEVEL_TRIGGER_EVENTFD: u32 = 1;
75 pub const PLAT_IRQ_FORWARD_SET_LEVEL_UNMASK_EVENTFD: u32 = 2;
76 pub const PLAT_IRQ_FORWARD_SET_EDGE_TRIGGER: u32 = 4;
77 pub const PLAT_IRQ_FORWARD_SET_LEVEL_ACPI_SCI_TRIGGER_EVENTFD: u32 = 8;
78 pub const PLAT_IRQ_FORWARD_SET_LEVEL_ACPI_SCI_UNMASK_EVENTFD: u32 = 16;
79 pub const ACPI_EVT_FORWARD_SET_GPE_TRIGGER: u32 = 1;
80 pub const ACPI_EVT_FORWARD_CLEAR_GPE_TRIGGER: u32 = 2;
81 pub const ACPI_EVT_FORWARD_SET_FIXED_EVENT_TRIGGER: u32 = 4;
82 pub const ACPI_EVT_FORWARD_CLEAR_FIXED_EVENT_TRIGGER: u32 = 8;
83 pub type __s8 = ::std::os::raw::c_schar;
84 pub type __u8 = ::std::os::raw::c_uchar;
85 pub type __s16 = ::std::os::raw::c_short;
86 pub type __u16 = ::std::os::raw::c_ushort;
87 pub type __s32 = ::std::os::raw::c_int;
88 pub type __u32 = ::std::os::raw::c_uint;
89 pub type __s64 = ::std::os::raw::c_longlong;
90 pub type __u64 = ::std::os::raw::c_ulonglong;
91 #[repr(C)]
92 #[derive(Debug, Default, Copy, Clone)]
93 pub struct __kernel_fd_set {
94     pub fds_bits: [::std::os::raw::c_ulong; 16usize],
95 }
96 pub type __kernel_sighandler_t =
97     ::std::option::Option<unsafe extern "C" fn(arg1: ::std::os::raw::c_int)>;
98 pub type __kernel_key_t = ::std::os::raw::c_int;
99 pub type __kernel_mqd_t = ::std::os::raw::c_int;
100 pub type __kernel_old_uid_t = ::std::os::raw::c_ushort;
101 pub type __kernel_old_gid_t = ::std::os::raw::c_ushort;
102 pub type __kernel_old_dev_t = ::std::os::raw::c_ulong;
103 pub type __kernel_long_t = ::std::os::raw::c_long;
104 pub type __kernel_ulong_t = ::std::os::raw::c_ulong;
105 pub type __kernel_ino_t = __kernel_ulong_t;
106 pub type __kernel_mode_t = ::std::os::raw::c_uint;
107 pub type __kernel_pid_t = ::std::os::raw::c_int;
108 pub type __kernel_ipc_pid_t = ::std::os::raw::c_int;
109 pub type __kernel_uid_t = ::std::os::raw::c_uint;
110 pub type __kernel_gid_t = ::std::os::raw::c_uint;
111 pub type __kernel_suseconds_t = __kernel_long_t;
112 pub type __kernel_daddr_t = ::std::os::raw::c_int;
113 pub type __kernel_uid32_t = ::std::os::raw::c_uint;
114 pub type __kernel_gid32_t = ::std::os::raw::c_uint;
115 pub type __kernel_size_t = __kernel_ulong_t;
116 pub type __kernel_ssize_t = __kernel_long_t;
117 pub type __kernel_ptrdiff_t = __kernel_long_t;
118 #[repr(C)]
119 #[derive(Debug, Default, Copy, Clone)]
120 pub struct __kernel_fsid_t {
121     pub val: [::std::os::raw::c_int; 2usize],
122 }
123 pub type __kernel_off_t = __kernel_long_t;
124 pub type __kernel_loff_t = ::std::os::raw::c_longlong;
125 pub type __kernel_time_t = __kernel_long_t;
126 pub type __kernel_clock_t = __kernel_long_t;
127 pub type __kernel_timer_t = ::std::os::raw::c_int;
128 pub type __kernel_clockid_t = ::std::os::raw::c_int;
129 pub type __kernel_caddr_t = *mut ::std::os::raw::c_char;
130 pub type __kernel_uid16_t = ::std::os::raw::c_ushort;
131 pub type __kernel_gid16_t = ::std::os::raw::c_ushort;
132 pub type __le16 = __u16;
133 pub type __be16 = __u16;
134 pub type __le32 = __u32;
135 pub type __be32 = __u32;
136 pub type __le64 = __u64;
137 pub type __be64 = __u64;
138 pub type __sum16 = __u16;
139 pub type __wsum = __u32;
140 #[repr(C)]
141 #[derive(Debug, Default)]
142 pub struct plat_irq_forward_set {
143     pub argsz: __u32,
144     pub action_flags: __u32,
145     pub irq_number_host: __u32,
146     pub count: __u32,
147     pub eventfd: __IncompleteArrayField<__u8>,
148 }
149 #[repr(C)]
150 #[derive(Default, Copy, Clone)]
151 pub struct acpi_evt_forward_set {
152     pub argsz: __u32,
153     pub action_flags: __u32,
154     pub __bindgen_anon_1: acpi_evt_forward_set__bindgen_ty_1,
155 }
156 #[repr(C)]
157 #[derive(Copy, Clone)]
158 pub union acpi_evt_forward_set__bindgen_ty_1 {
159     pub gpe_host_nr: __u32,
160     pub fixed_evt_nr: __u32,
161 }
162 impl Default for acpi_evt_forward_set__bindgen_ty_1 {
default() -> Self163     fn default() -> Self {
164         let mut s = ::std::mem::MaybeUninit::<Self>::uninit();
165         // SAFETY: Safe because s is aligned and is initialized in the block.
166         unsafe {
167             ::std::ptr::write_bytes(s.as_mut_ptr(), 0, 1);
168             s.assume_init()
169         }
170     }
171 }
172