objc2_fs_kit/generated/
FSFileSystemBase.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10extern_protocol!(
11    /// A protocol containing functionality supplied by FSKit to file system implementations.
12    ///
13    /// Both ``FSFileSystem`` and ``FSUnaryFileSystem`` conform to this protocol.
14    ///
15    /// See also [Apple's documentation](https://developer.apple.com/documentation/fskit/fsfilesystembase?language=objc)
16    pub unsafe trait FSFileSystemBase: NSObjectProtocol {
17        #[cfg(feature = "FSContainer")]
18        /// The status of the file system container, indicating its readiness and activity.
19        ///
20        /// A file system container starts in the ``FSContainerState/notReady`` state, and then transitions to the other values of the ``FSContainerState`` enumeration.
21        /// The following diagram illustrates the possible state transitions.
22        ///
23        /// ![A flow diagram of four possible container states. The initial state, notReady, can transition to ready or blocked. The ready state can transition back to not ready, or to blocked or active. The blocked state can transition to ready or not ready. The active state can transition back to ready or to not ready.](fs-file-system-base)
24        ///
25        /// Your file system implementation updates this property as it changes state.
26        /// Many events and operations may trigger a state transition, and some transitions depend on a specific file system's design.
27        ///
28        /// When using ``FSBlockDeviceResource``, implement the following common state transitions:
29        ///
30        /// * Calling `loadResource` transitions the state out of ``FSContainerState/notReady``. For all block device file systems, this operation changes the state to either ``FSContainerState/ready`` or ``FSContainerState/blocked``.
31        /// * Calling `unloadResource` transitions to the ``FSContainerState/notReady`` state, as does device termination.
32        /// * Transitioning from ``FSContainerState/blocked`` to ``FSContainerState/ready`` occurs as a result of resolving the underlying block favorably.
33        /// * Transitioning from ``FSContainerState/ready`` to ``FSContainerState/blocked`` is unusal, but valid.
34        /// * Transitioning between ``FSContainerState/ready`` and ``FSContainerState/active`` can result from maintenance operations such as ``FSManageableResourceMaintenanceOperations/startCheckWithTask:options:error:``. For a ``FSUnaryFileSystem``, this transition can also occur when activating or deactivating the container's single volume.
35        #[unsafe(method(containerStatus))]
36        #[unsafe(method_family = none)]
37        unsafe fn containerStatus(&self) -> Retained<FSContainerStatus>;
38
39        #[cfg(feature = "FSContainer")]
40        /// Setter for [`containerStatus`][Self::containerStatus].
41        #[unsafe(method(setContainerStatus:))]
42        #[unsafe(method_family = none)]
43        unsafe fn setContainerStatus(&self, container_status: &FSContainerStatus);
44
45        #[cfg(all(feature = "FSResource", feature = "block2"))]
46        /// Wipes existing file systems on the specified resource.
47        ///
48        /// This method wraps the `wipefs` functionality from `libutil`.
49        /// For more information, see the `man` page for `wipefs`.
50        ///
51        /// - Parameters:
52        /// - resource: The ``FSBlockDeviceResource`` to wipe.
53        /// - completion: A block or closure that executes after the wipe operation completes. The completion handler receives a single parameter indicating any error that occurs during the operation. If the value is `nil`, the wipe operation succeeded.
54        #[unsafe(method(wipeResource:completionHandler:))]
55        #[unsafe(method_family = none)]
56        unsafe fn wipeResource_completionHandler(
57            &self,
58            resource: &FSBlockDeviceResource,
59            completion: &block2::DynBlock<dyn Fn(*mut NSError)>,
60        );
61    }
62);