| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
use core_foundation::{ |
| 9 |
base::{CFAllocatorRef, mach_port_t}, |
| 10 |
dictionary::CFMutableDictionaryRef, |
| 11 |
}; |
| 12 |
use libc::c_char; |
| 13 |
use mach2::{kern_return::kern_return_t, port::MACH_PORT_NULL}; |
| 14 |
|
| 15 |
#[expect(non_camel_case_types)] |
| 16 |
pub type io_object_t = mach_port_t; |
| 17 |
|
| 18 |
#[expect(non_camel_case_types)] |
| 19 |
pub type io_iterator_t = io_object_t; |
| 20 |
#[expect(non_camel_case_types)] |
| 21 |
pub type io_registry_entry_t = io_object_t; |
| 22 |
|
| 23 |
pub type IOOptionBits = u32; |
| 24 |
|
| 25 |
|
| 26 |
#[expect(non_upper_case_globals)] |
| 27 |
pub const kIOMasterPortDefault: mach_port_t = MACH_PORT_NULL; |
| 28 |
|
| 29 |
#[expect(non_upper_case_globals)] |
| 30 |
pub const kIOServicePlane: &str = "IOService\0"; |
| 31 |
|
| 32 |
#[expect(non_upper_case_globals)] |
| 33 |
pub const kIOMediaClass: &str = "IOMedia\0"; |
| 34 |
|
| 35 |
|
| 36 |
|
| 37 |
unsafe extern "C" { |
| 38 |
|
| 39 |
pub fn IOServiceGetMatchingServices( |
| 40 |
mainPort: mach_port_t, matching: CFMutableDictionaryRef, existing: *mut io_iterator_t, |
| 41 |
) -> kern_return_t; |
| 42 |
|
| 43 |
pub fn IOServiceMatching(name: *const c_char) -> CFMutableDictionaryRef; |
| 44 |
|
| 45 |
pub fn IOIteratorNext(iterator: io_iterator_t) -> io_object_t; |
| 46 |
|
| 47 |
pub fn IOObjectRelease(obj: io_object_t) -> kern_return_t; |
| 48 |
|
| 49 |
pub fn IORegistryEntryGetParentEntry( |
| 50 |
entry: io_registry_entry_t, plane: *const libc::c_char, parent: *mut io_registry_entry_t, |
| 51 |
) -> kern_return_t; |
| 52 |
|
| 53 |
|
| 54 |
|
| 55 |
|
| 56 |
pub fn IORegistryEntryCreateCFProperties( |
| 57 |
entry: io_registry_entry_t, properties: *mut CFMutableDictionaryRef, |
| 58 |
allocator: CFAllocatorRef, options: IOOptionBits, |
| 59 |
) -> kern_return_t; |
| 60 |
|
| 61 |
} |