1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
use std::os::raw::{c_char, c_int, c_uint, c_ulonglong};
use mach::port::mach_port_t;
use mach::vm_types::mach_vm_address_t;
pub type IOOptionBits = c_uint;
pub type IOFixed = c_int;
pub type IOVersion = c_uint;
pub type IOItemCount = c_uint;
pub type IOCacheMode = c_uint;
pub type IOByteCount32 = c_uint;
pub type IOByteCount64 = c_ulonglong;
pub type IOPhysicalAddress32 = c_uint;
pub type IOPhysicalAddress64 = c_ulonglong;
pub type IOPhysicalLength32 = c_uint;
pub type IOPhysicalLength64 = c_ulonglong;
#[cfg(all(not(target_arch = "arm"), not(target_arch = "x86")))]
pub type IOVirtualAddress = mach_vm_address_t;
#[cfg(any(target_arch = "arm", target_arch = "x86"))]
pub type IOVirtualAddress = vm_address_t;
#[cfg(all(
not(target_arch = "arm"),
not(target_arch = "x86"),
not(target_arch = "x86_64")
))]
pub type IOByteCount = IOByteCount64;
#[cfg(any(
target_arch = "arm",
target_arch = "x86",
target_arch = "x86_64"
))]
pub type IOByteCount = IOByteCount32;
pub type IOLogicalAddress = IOVirtualAddress;
#[cfg(all(
not(target_arch = "arm"),
not(target_arch = "x86"),
not(target_arch = "x86_64")
))]
pub type IOPhysicalAddress = IOPhysicalAddress64;
#[cfg(all(
not(target_arch = "arm"),
not(target_arch = "x86"),
not(target_arch = "x86_64")
))]
pub type IOPhysicalLength = IOPhysicalLength64;
#[cfg(all(
not(target_arch = "arm"),
not(target_arch = "x86"),
not(target_arch = "x86_64")
))]
pub const IOPhysSize: c_int = 64;
#[cfg(any(
target_arch = "arm",
target_arch = "x86",
target_arch = "x86_64"
))]
pub type IOPhysicalAddress = IOPhysicalAddress32;
#[cfg(any(
target_arch = "arm",
target_arch = "x86",
target_arch = "x86_64"
))]
pub type IOPhysicalLength = IOPhysicalAddress32;
#[cfg(any(
target_arch = "arm",
target_arch = "x86",
target_arch = "x86_64"
))]
pub const IOPhysSize: c_int = 32;
#[repr(C)]
#[derive(Debug, Copy)]
pub struct IOPhysicalRange {
address: IOPhysicalAddress,
length: IOByteCount,
}
impl Clone for IOPhysicalRange {
fn clone(&self) -> Self {
*self
}
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct IOVirtualRange {
address: IOVirtualAddress,
length: IOByteCount,
}
impl Clone for IOVirtualRange {
fn clone(&self) -> Self {
*self
}
}
#[cfg(all(not(target_arch = "arm"), not(target_arch = "x86")))]
pub type IOAddressRange = IOVirtualRange;
#[cfg(any(target_arch = "arm", target_arch = "x86"))]
#[repr(C)]
#[derive(Debug, Copy)]
pub struct IOAddressRange {
address: mach_vm_address_t,
length: mach_vm_size_t,
}
#[cfg(any(target_arch = "arm", target_arch = "x86"))]
impl Clone for IOAddressRange {
fn clone(&self) -> Self {
*self
}
}
#[repr(C)]
#[derive(Debug, Copy)]
pub struct IONamedValue {
value: c_int,
name: *const c_char,
}
impl Clone for IONamedValue {
fn clone(&self) -> Self {
*self
}
}
pub type IOAlignment = c_uint;
pub type io_object_t = mach_port_t;
pub type io_connect_t = io_object_t;
pub type io_enumerator_t = io_object_t;
pub type io_iterator_t = io_object_t;
pub type io_registry_entry_t = io_object_t;
pub type io_service_t = io_object_t;
pub const IO_OBJECT_NULL: io_object_t = 0;
pub const kIODefaultMemoryType: c_int = 0;
pub const kIODefaultCache: c_int = 0;
pub const kIOInhibitCache: c_int = 1;
pub const kIOWriteThruCache: c_int = 2;
pub const kIOCopybackCache: c_int = 3;
pub const kIOWriteCombineCache: c_int = 4;
pub const kIOCopybackInnerCache: c_int = 5;
pub const kIOMapAnywhere: c_int = 0x00000001;
pub const kIOMapCacheMask: c_int = 0x00000700;
pub const kIOMapCacheShift: c_int = 8;
pub const kIOMapDefaultCache: c_int = kIODefaultCache << kIOMapCacheShift;
pub const kIOMapInhibitCache: c_int = kIOInhibitCache << kIOMapCacheShift;
pub const kIOMapWriteThruCache: c_int = kIOWriteThruCache << kIOMapCacheShift;
pub const kIOMapCopybackCache: c_int = kIOCopybackCache << kIOMapCacheShift;
pub const kIOMapWriteCombineCache: c_int = kIOWriteCombineCache << kIOMapCacheShift;
pub const kIOMapCopybackInnerCache: c_int = kIOCopybackInnerCache << kIOMapCacheShift;
pub const kIOMapUserOptionsMask: c_int = 0x00000fff;
pub const kIOMapReadOnly: c_int = 0x00001000;
pub const kIOMapStatic: c_int = 0x01000000;
pub const kIOMapReference: c_int = 0x02000000;
pub const kIOMapUnique: c_int = 0x04000000;
pub const kIOMapPrefault: c_int = 0x10000000;
pub const kIOMapOverwrite: c_int = 0x20000000;
pub const kNanosecondScale: c_int = 1;
pub const kMicrosecondScale: c_int = 1000;
pub const kMillisecondScale: c_int = 1000 * 1000;
pub const kSecondScale: c_int = 1000 * 1000 * 1000;
pub const kTickScale: c_int = (kSecondScale / 100);
pub const kIOConnectMethodVarOutputSize: c_int = -3;
pub type IODeviceNumber = c_uint;