vfio_sys/
plat.rs

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)]
12pub struct __IncompleteArrayField<T>(::std::marker::PhantomData<T>, [T; 0]);
13impl<T> __IncompleteArrayField<T> {
14    #[inline]
15    pub const fn new() -> Self {
16        __IncompleteArrayField(::std::marker::PhantomData, [])
17    }
18    #[inline]
19    pub fn as_ptr(&self) -> *const T {
20        self as *const _ as *const T
21    }
22    #[inline]
23    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]
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]
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}
43impl<T> ::std::fmt::Debug for __IncompleteArrayField<T> {
44    fn fmt(&self, fmt: &mut ::std::fmt::Formatter<'_>) -> ::std::fmt::Result {
45        fmt.write_str("__IncompleteArrayField")
46    }
47}
48pub const _IOC_NRBITS: u32 = 8;
49pub const _IOC_TYPEBITS: u32 = 8;
50pub const _IOC_SIZEBITS: u32 = 14;
51pub const _IOC_DIRBITS: u32 = 2;
52pub const _IOC_NRMASK: u32 = 255;
53pub const _IOC_TYPEMASK: u32 = 255;
54pub const _IOC_SIZEMASK: u32 = 16383;
55pub const _IOC_DIRMASK: u32 = 3;
56pub const _IOC_NRSHIFT: u32 = 0;
57pub const _IOC_TYPESHIFT: u32 = 8;
58pub const _IOC_SIZESHIFT: u32 = 16;
59pub const _IOC_DIRSHIFT: u32 = 30;
60pub const _IOC_NONE: u32 = 0;
61pub const _IOC_WRITE: u32 = 1;
62pub const _IOC_READ: u32 = 2;
63pub const IOC_IN: u32 = 1073741824;
64pub const IOC_OUT: u32 = 2147483648;
65pub const IOC_INOUT: u32 = 3221225472;
66pub const IOCSIZE_MASK: u32 = 1073676288;
67pub const IOCSIZE_SHIFT: u32 = 16;
68pub const __BITS_PER_LONG: u32 = 64;
69pub const __FD_SETSIZE: u32 = 1024;
70pub const PLAT_IRQ_FORWARD_API_VERSION: u32 = 0;
71pub const PLAT_IRQ_FORWARD_TYPE: u32 = 59;
72pub const PLAT_IRQ_FORWARD_BASE: u32 = 100;
73pub const ACPI_EVT_FORWARD_BASE: u32 = 130;
74pub const PLAT_IRQ_FORWARD_SET_LEVEL_TRIGGER_EVENTFD: u32 = 1;
75pub const PLAT_IRQ_FORWARD_SET_LEVEL_UNMASK_EVENTFD: u32 = 2;
76pub const PLAT_IRQ_FORWARD_SET_EDGE_TRIGGER: u32 = 4;
77pub const PLAT_IRQ_FORWARD_SET_LEVEL_ACPI_SCI_TRIGGER_EVENTFD: u32 = 8;
78pub const PLAT_IRQ_FORWARD_SET_LEVEL_ACPI_SCI_UNMASK_EVENTFD: u32 = 16;
79pub const ACPI_EVT_FORWARD_SET_GPE_TRIGGER: u32 = 1;
80pub const ACPI_EVT_FORWARD_CLEAR_GPE_TRIGGER: u32 = 2;
81pub const ACPI_EVT_FORWARD_SET_FIXED_EVENT_TRIGGER: u32 = 4;
82pub const ACPI_EVT_FORWARD_CLEAR_FIXED_EVENT_TRIGGER: u32 = 8;
83pub type __s8 = ::std::os::raw::c_schar;
84pub type __u8 = ::std::os::raw::c_uchar;
85pub type __s16 = ::std::os::raw::c_short;
86pub type __u16 = ::std::os::raw::c_ushort;
87pub type __s32 = ::std::os::raw::c_int;
88pub type __u32 = ::std::os::raw::c_uint;
89pub type __s64 = ::std::os::raw::c_longlong;
90pub type __u64 = ::std::os::raw::c_ulonglong;
91#[repr(C)]
92#[derive(Debug, Default, Copy, Clone)]
93pub struct __kernel_fd_set {
94    pub fds_bits: [::std::os::raw::c_ulong; 16usize],
95}
96pub type __kernel_sighandler_t =
97    ::std::option::Option<unsafe extern "C" fn(arg1: ::std::os::raw::c_int)>;
98pub type __kernel_key_t = ::std::os::raw::c_int;
99pub type __kernel_mqd_t = ::std::os::raw::c_int;
100pub type __kernel_old_uid_t = ::std::os::raw::c_ushort;
101pub type __kernel_old_gid_t = ::std::os::raw::c_ushort;
102pub type __kernel_old_dev_t = ::std::os::raw::c_ulong;
103pub type __kernel_long_t = ::std::os::raw::c_long;
104pub type __kernel_ulong_t = ::std::os::raw::c_ulong;
105pub type __kernel_ino_t = __kernel_ulong_t;
106pub type __kernel_mode_t = ::std::os::raw::c_uint;
107pub type __kernel_pid_t = ::std::os::raw::c_int;
108pub type __kernel_ipc_pid_t = ::std::os::raw::c_int;
109pub type __kernel_uid_t = ::std::os::raw::c_uint;
110pub type __kernel_gid_t = ::std::os::raw::c_uint;
111pub type __kernel_suseconds_t = __kernel_long_t;
112pub type __kernel_daddr_t = ::std::os::raw::c_int;
113pub type __kernel_uid32_t = ::std::os::raw::c_uint;
114pub type __kernel_gid32_t = ::std::os::raw::c_uint;
115pub type __kernel_size_t = __kernel_ulong_t;
116pub type __kernel_ssize_t = __kernel_long_t;
117pub type __kernel_ptrdiff_t = __kernel_long_t;
118#[repr(C)]
119#[derive(Debug, Default, Copy, Clone)]
120pub struct __kernel_fsid_t {
121    pub val: [::std::os::raw::c_int; 2usize],
122}
123pub type __kernel_off_t = __kernel_long_t;
124pub type __kernel_loff_t = ::std::os::raw::c_longlong;
125pub type __kernel_time_t = __kernel_long_t;
126pub type __kernel_clock_t = __kernel_long_t;
127pub type __kernel_timer_t = ::std::os::raw::c_int;
128pub type __kernel_clockid_t = ::std::os::raw::c_int;
129pub type __kernel_caddr_t = *mut ::std::os::raw::c_char;
130pub type __kernel_uid16_t = ::std::os::raw::c_ushort;
131pub type __kernel_gid16_t = ::std::os::raw::c_ushort;
132pub type __le16 = __u16;
133pub type __be16 = __u16;
134pub type __le32 = __u32;
135pub type __be32 = __u32;
136pub type __le64 = __u64;
137pub type __be64 = __u64;
138pub type __sum16 = __u16;
139pub type __wsum = __u32;
140#[repr(C)]
141#[derive(Debug, Default)]
142pub 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)]
151pub 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)]
158pub union acpi_evt_forward_set__bindgen_ty_1 {
159    pub gpe_host_nr: __u32,
160    pub fixed_evt_nr: __u32,
161}
162impl Default for acpi_evt_forward_set__bindgen_ty_1 {
163    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}