objc2_disk_arbitration/generated/
DADisk.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::cell::UnsafeCell;
4use core::ffi::*;
5use core::marker::{PhantomData, PhantomPinned};
6use core::ptr::NonNull;
7use objc2_core_foundation::*;
8
9use crate::*;
10
11extern "C" {
12    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionvolumekindkey?language=objc)
13    pub static kDADiskDescriptionVolumeKindKey: &'static CFString;
14}
15
16extern "C" {
17    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionvolumemountablekey?language=objc)
18    pub static kDADiskDescriptionVolumeMountableKey: &'static CFString;
19}
20
21extern "C" {
22    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionvolumenamekey?language=objc)
23    pub static kDADiskDescriptionVolumeNameKey: &'static CFString;
24}
25
26extern "C" {
27    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionvolumenetworkkey?language=objc)
28    pub static kDADiskDescriptionVolumeNetworkKey: &'static CFString;
29}
30
31extern "C" {
32    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionvolumepathkey?language=objc)
33    pub static kDADiskDescriptionVolumePathKey: &'static CFString;
34}
35
36extern "C" {
37    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionvolumetypekey?language=objc)
38    pub static kDADiskDescriptionVolumeTypeKey: &'static CFString;
39}
40
41extern "C" {
42    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionvolumeuuidkey?language=objc)
43    pub static kDADiskDescriptionVolumeUUIDKey: &'static CFString;
44}
45
46extern "C" {
47    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediablocksizekey?language=objc)
48    pub static kDADiskDescriptionMediaBlockSizeKey: &'static CFString;
49}
50
51extern "C" {
52    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediabsdmajorkey?language=objc)
53    pub static kDADiskDescriptionMediaBSDMajorKey: &'static CFString;
54}
55
56extern "C" {
57    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediabsdminorkey?language=objc)
58    pub static kDADiskDescriptionMediaBSDMinorKey: &'static CFString;
59}
60
61extern "C" {
62    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediabsdnamekey?language=objc)
63    pub static kDADiskDescriptionMediaBSDNameKey: &'static CFString;
64}
65
66extern "C" {
67    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediabsdunitkey?language=objc)
68    pub static kDADiskDescriptionMediaBSDUnitKey: &'static CFString;
69}
70
71extern "C" {
72    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediacontentkey?language=objc)
73    pub static kDADiskDescriptionMediaContentKey: &'static CFString;
74}
75
76extern "C" {
77    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediaejectablekey?language=objc)
78    pub static kDADiskDescriptionMediaEjectableKey: &'static CFString;
79}
80
81extern "C" {
82    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediaiconkey?language=objc)
83    pub static kDADiskDescriptionMediaIconKey: &'static CFString;
84}
85
86extern "C" {
87    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediakindkey?language=objc)
88    pub static kDADiskDescriptionMediaKindKey: &'static CFString;
89}
90
91extern "C" {
92    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmedialeafkey?language=objc)
93    pub static kDADiskDescriptionMediaLeafKey: &'static CFString;
94}
95
96extern "C" {
97    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmedianamekey?language=objc)
98    pub static kDADiskDescriptionMediaNameKey: &'static CFString;
99}
100
101extern "C" {
102    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediapathkey?language=objc)
103    pub static kDADiskDescriptionMediaPathKey: &'static CFString;
104}
105
106extern "C" {
107    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediaremovablekey?language=objc)
108    pub static kDADiskDescriptionMediaRemovableKey: &'static CFString;
109}
110
111extern "C" {
112    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediasizekey?language=objc)
113    pub static kDADiskDescriptionMediaSizeKey: &'static CFString;
114}
115
116extern "C" {
117    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediatypekey?language=objc)
118    pub static kDADiskDescriptionMediaTypeKey: &'static CFString;
119}
120
121extern "C" {
122    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediauuidkey?language=objc)
123    pub static kDADiskDescriptionMediaUUIDKey: &'static CFString;
124}
125
126extern "C" {
127    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediawholekey?language=objc)
128    pub static kDADiskDescriptionMediaWholeKey: &'static CFString;
129}
130
131extern "C" {
132    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediawritablekey?language=objc)
133    pub static kDADiskDescriptionMediaWritableKey: &'static CFString;
134}
135
136extern "C" {
137    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediaencryptedkey?language=objc)
138    pub static kDADiskDescriptionMediaEncryptedKey: &'static CFString;
139}
140
141extern "C" {
142    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionmediaencryptiondetailkey?language=objc)
143    pub static kDADiskDescriptionMediaEncryptionDetailKey: &'static CFString;
144}
145
146extern "C" {
147    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondeviceguidkey?language=objc)
148    pub static kDADiskDescriptionDeviceGUIDKey: &'static CFString;
149}
150
151extern "C" {
152    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondeviceinternalkey?language=objc)
153    pub static kDADiskDescriptionDeviceInternalKey: &'static CFString;
154}
155
156extern "C" {
157    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondevicemodelkey?language=objc)
158    pub static kDADiskDescriptionDeviceModelKey: &'static CFString;
159}
160
161extern "C" {
162    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondevicepathkey?language=objc)
163    pub static kDADiskDescriptionDevicePathKey: &'static CFString;
164}
165
166extern "C" {
167    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondeviceprotocolkey?language=objc)
168    pub static kDADiskDescriptionDeviceProtocolKey: &'static CFString;
169}
170
171extern "C" {
172    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondevicerevisionkey?language=objc)
173    pub static kDADiskDescriptionDeviceRevisionKey: &'static CFString;
174}
175
176extern "C" {
177    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondeviceunitkey?language=objc)
178    pub static kDADiskDescriptionDeviceUnitKey: &'static CFString;
179}
180
181extern "C" {
182    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondevicevendorkey?language=objc)
183    pub static kDADiskDescriptionDeviceVendorKey: &'static CFString;
184}
185
186extern "C" {
187    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptiondevicetdmlockedkey?language=objc)
188    pub static kDADiskDescriptionDeviceTDMLockedKey: &'static CFString;
189}
190
191extern "C" {
192    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionbusnamekey?language=objc)
193    pub static kDADiskDescriptionBusNameKey: &'static CFString;
194}
195
196extern "C" {
197    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionbuspathkey?language=objc)
198    pub static kDADiskDescriptionBusPathKey: &'static CFString;
199}
200
201extern "C" {
202    /// [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/kdadiskdescriptionfskitprefix?language=objc)
203    pub static kDADiskDescriptionFSKitPrefix: &'static CFString;
204}
205
206/// Type of a reference to DADisk instances.
207///
208/// See also [Apple's documentation](https://developer.apple.com/documentation/diskarbitration/dadisk?language=objc)
209#[repr(C)]
210pub struct DADisk {
211    inner: [u8; 0],
212    _p: UnsafeCell<PhantomData<(*const UnsafeCell<()>, PhantomPinned)>>,
213}
214
215cf_type!(
216    #[encoding_name = "__DADisk"]
217    unsafe impl DADisk {}
218);
219
220unsafe impl ConcreteType for DADisk {
221    /// Returns the type identifier of all DADisk instances.
222    #[doc(alias = "DADiskGetTypeID")]
223    #[inline]
224    fn type_id() -> CFTypeID {
225        extern "C-unwind" {
226            fn DADiskGetTypeID() -> CFTypeID;
227        }
228        unsafe { DADiskGetTypeID() }
229    }
230}
231
232/// Creates a new disk object.
233///
234/// Parameter `allocator`: The allocator object to be used to allocate memory.
235///
236/// Parameter `session`: The DASession in which to contact Disk Arbitration.
237///
238/// Parameter `name`: The BSD device name.
239///
240/// Returns: A reference to a new DADisk.
241///
242/// The caller of this function receives a reference to the returned object.  The
243/// caller also implicitly retains the object and is responsible for releasing it
244/// with CFRelease().
245#[cfg(feature = "DASession")]
246#[inline]
247pub unsafe extern "C-unwind" fn DADiskCreateFromBSDName(
248    allocator: Option<&CFAllocator>,
249    session: &DASession,
250    name: NonNull<c_char>,
251) -> Option<CFRetained<DADisk>> {
252    extern "C-unwind" {
253        fn DADiskCreateFromBSDName(
254            allocator: Option<&CFAllocator>,
255            session: &DASession,
256            name: NonNull<c_char>,
257        ) -> Option<NonNull<DADisk>>;
258    }
259    let ret = unsafe { DADiskCreateFromBSDName(allocator, session, name) };
260    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
261}
262
263/// Creates a new disk object.
264///
265/// Parameter `allocator`: The allocator object to be used to allocate memory.
266///
267/// Parameter `session`: The DASession in which to contact Disk Arbitration.
268///
269/// Parameter `path`: The BSD mount point.
270///
271/// Returns: A reference to a new DADisk.
272///
273/// The caller of this function receives a reference to the returned object.  The
274/// caller also implicitly retains the object and is responsible for releasing it
275/// with CFRelease().
276#[cfg(feature = "DASession")]
277#[inline]
278pub unsafe extern "C-unwind" fn DADiskCreateFromVolumePath(
279    allocator: Option<&CFAllocator>,
280    session: &DASession,
281    path: &CFURL,
282) -> Option<CFRetained<DADisk>> {
283    extern "C-unwind" {
284        fn DADiskCreateFromVolumePath(
285            allocator: Option<&CFAllocator>,
286            session: &DASession,
287            path: &CFURL,
288        ) -> Option<NonNull<DADisk>>;
289    }
290    let ret = unsafe { DADiskCreateFromVolumePath(allocator, session, path) };
291    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
292}
293
294extern "C-unwind" {
295    /// Obtains the BSD device name for the specified disk.
296    ///
297    /// Parameter `disk`: The DADisk for which to obtain the BSD device name.
298    ///
299    /// Returns: The disk's BSD device name.
300    ///
301    /// The BSD device name can be used with opendev() to open the BSD device.
302    pub fn DADiskGetBSDName(disk: &DADisk) -> *const c_char;
303}
304
305/// Obtains the Disk Arbitration description of the specified disk.
306///
307/// Parameter `disk`: The DADisk for which to obtain the Disk Arbitration description.
308///
309/// Returns: The disk's Disk Arbitration description.
310///
311/// This function will contact Disk Arbitration to acquire the latest description
312/// of the specified disk, unless this function is called on a disk object passed
313/// within the context of a registered callback, in which case the description is
314/// current as of that callback event.
315///
316/// The caller of this function receives a reference to the returned object.  The
317/// caller also implicitly retains the object and is responsible for releasing it
318/// with CFRelease().
319#[inline]
320pub unsafe extern "C-unwind" fn DADiskCopyDescription(
321    disk: &DADisk,
322) -> Option<CFRetained<CFDictionary>> {
323    extern "C-unwind" {
324        fn DADiskCopyDescription(disk: &DADisk) -> Option<NonNull<CFDictionary>>;
325    }
326    let ret = unsafe { DADiskCopyDescription(disk) };
327    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
328}
329
330/// Obtain the associated whole disk object for the specified disk.
331///
332/// Parameter `disk`: The disk object.
333///
334/// Returns: The disk's associated whole disk object.
335///
336/// The caller of this function receives a reference to the returned object.  The
337/// caller also implicitly retains the object and is responsible for releasing it
338/// with CFRelease().
339#[inline]
340pub unsafe extern "C-unwind" fn DADiskCopyWholeDisk(disk: &DADisk) -> Option<CFRetained<DADisk>> {
341    extern "C-unwind" {
342        fn DADiskCopyWholeDisk(disk: &DADisk) -> Option<NonNull<DADisk>>;
343    }
344    let ret = unsafe { DADiskCopyWholeDisk(disk) };
345    ret.map(|ret| unsafe { CFRetained::from_raw(ret) })
346}