use core::cell::UnsafeCell;
use core::ffi::*;
use core::marker::{PhantomData, PhantomPinned};
use core::ptr::NonNull;
#[cfg(feature = "objc2")]
use objc2::__framework_prelude::*;
use objc2_core_foundation::*;
use crate::*;
extern "C" {
pub static kDADiskDescriptionVolumeKindKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionVolumeMountableKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionVolumeNameKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionVolumeNetworkKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionVolumePathKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionVolumeTypeKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionVolumeUUIDKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaBlockSizeKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaBSDMajorKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaBSDMinorKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaBSDNameKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaBSDUnitKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaContentKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaEjectableKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaIconKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaKindKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaLeafKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaNameKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaPathKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaRemovableKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaSizeKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaTypeKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaUUIDKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaWholeKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaWritableKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaEncryptedKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionMediaEncryptionDetailKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceGUIDKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceInternalKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceModelKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDevicePathKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceProtocolKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceRevisionKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceUnitKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceVendorKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionDeviceTDMLockedKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionBusNameKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionBusPathKey: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionFSKitPrefix: &'static CFString;
}
extern "C" {
pub static kDADiskDescriptionRepairRunningKey: &'static CFString;
}
#[doc(alias = "DADiskRef")]
#[repr(C)]
pub struct DADisk {
inner: [u8; 0],
_p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
}
cf_type!(
unsafe impl DADisk {}
);
#[cfg(feature = "objc2")]
cf_objc2_type!(
unsafe impl RefEncode<"__DADisk"> for DADisk {}
);
unsafe impl ConcreteType for DADisk {
#[doc(alias = "DADiskGetTypeID")]
#[inline]
fn type_id() -> CFTypeID {
extern "C-unwind" {
fn DADiskGetTypeID() -> CFTypeID;
}
unsafe { DADiskGetTypeID() }
}
}
impl DADisk {
#[doc(alias = "DADiskCreateFromBSDName")]
#[cfg(feature = "DASession")]
#[inline]
pub unsafe fn from_bsd_name(
allocator: Option<&CFAllocator>,
session: &DASession,
name: NonNull<c_char>,
) -> Option<CFRetained<DADisk>> {
extern "C-unwind" {
fn DADiskCreateFromBSDName(
allocator: Option<&CFAllocator>,
session: &DASession,
name: NonNull<c_char>,
) -> Option<NonNull<DADisk>>;
}
let ret = unsafe { DADiskCreateFromBSDName(allocator, session, name) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "DADiskCreateFromVolumePath")]
#[cfg(feature = "DASession")]
#[inline]
pub unsafe fn from_volume_path(
allocator: Option<&CFAllocator>,
session: &DASession,
path: &CFURL,
) -> Option<CFRetained<DADisk>> {
extern "C-unwind" {
fn DADiskCreateFromVolumePath(
allocator: Option<&CFAllocator>,
session: &DASession,
path: &CFURL,
) -> Option<NonNull<DADisk>>;
}
let ret = unsafe { DADiskCreateFromVolumePath(allocator, session, path) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "DADiskGetBSDName")]
#[inline]
pub unsafe fn bsd_name(&self) -> *const c_char {
extern "C-unwind" {
fn DADiskGetBSDName(disk: &DADisk) -> *const c_char;
}
unsafe { DADiskGetBSDName(self) }
}
#[doc(alias = "DADiskCopyDescription")]
#[inline]
pub unsafe fn description(&self) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn DADiskCopyDescription(disk: &DADisk) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { DADiskCopyDescription(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[doc(alias = "DADiskCopyWholeDisk")]
#[inline]
pub unsafe fn whole_disk(&self) -> Option<CFRetained<DADisk>> {
extern "C-unwind" {
fn DADiskCopyWholeDisk(disk: &DADisk) -> Option<NonNull<DADisk>>;
}
let ret = unsafe { DADiskCopyWholeDisk(self) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
}
#[cfg(feature = "DASession")]
#[deprecated = "renamed to `DADisk::from_bsd_name`"]
#[inline]
pub unsafe extern "C-unwind" fn DADiskCreateFromBSDName(
allocator: Option<&CFAllocator>,
session: &DASession,
name: NonNull<c_char>,
) -> Option<CFRetained<DADisk>> {
extern "C-unwind" {
fn DADiskCreateFromBSDName(
allocator: Option<&CFAllocator>,
session: &DASession,
name: NonNull<c_char>,
) -> Option<NonNull<DADisk>>;
}
let ret = unsafe { DADiskCreateFromBSDName(allocator, session, name) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[cfg(feature = "DASession")]
#[deprecated = "renamed to `DADisk::from_volume_path`"]
#[inline]
pub unsafe extern "C-unwind" fn DADiskCreateFromVolumePath(
allocator: Option<&CFAllocator>,
session: &DASession,
path: &CFURL,
) -> Option<CFRetained<DADisk>> {
extern "C-unwind" {
fn DADiskCreateFromVolumePath(
allocator: Option<&CFAllocator>,
session: &DASession,
path: &CFURL,
) -> Option<NonNull<DADisk>>;
}
let ret = unsafe { DADiskCreateFromVolumePath(allocator, session, path) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
extern "C-unwind" {
#[deprecated = "renamed to `DADisk::bsd_name`"]
pub fn DADiskGetBSDName(disk: &DADisk) -> *const c_char;
}
#[deprecated = "renamed to `DADisk::description`"]
#[inline]
pub unsafe extern "C-unwind" fn DADiskCopyDescription(
disk: &DADisk,
) -> Option<CFRetained<CFDictionary>> {
extern "C-unwind" {
fn DADiskCopyDescription(disk: &DADisk) -> Option<NonNull<CFDictionary>>;
}
let ret = unsafe { DADiskCopyDescription(disk) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}
#[deprecated = "renamed to `DADisk::whole_disk`"]
#[inline]
pub unsafe extern "C-unwind" fn DADiskCopyWholeDisk(disk: &DADisk) -> Option<CFRetained<DADisk>> {
extern "C-unwind" {
fn DADiskCopyWholeDisk(disk: &DADisk) -> Option<NonNull<DADisk>>;
}
let ret = unsafe { DADiskCopyWholeDisk(disk) };
ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
}