- Notifications
You must be signed in to change notification settings - Fork548
FSKit macOS xcode16.3 b1
Rolf Bjarne Kvinge edited this pageFeb 24, 2025 ·1 revision
#FSKit.framework
diff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSClient.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSClient.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSClient.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSClient.h2025-02-11 06:12:25@@ -0,0 +1,37 @@+//+// Copyright (c) 2022 Apple Inc. All rights reserved.+//+// FSClient.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSModuleIdentity.h>++NS_ASSUME_NONNULL_BEGIN++/// An interface for apps and daemons to interact with FSKit.+///+/// FSClient is the primary management interface for FSKit.+/// Use this class to discover FSKit extensions installed on the system, including your own.+///+/// > Important: Don't subclass `FSClient`.+FSKIT_API_AVAILABILITY_V1+@interface FSClient : NSObject++-(instancetype)init NS_UNAVAILABLE;++/// The shared instance of the FSKit client class.+@property (class, readonly) FSClient *sharedInstance NS_SWIFT_NAME(shared);++/// Asynchronously retrieves an list of installed file system modules.+///+/// In Swift, you can either call this method and pass a completion handler closure, or get the value of the `installedExtensions` property with the `async` keyword.+///+/// - Parameter completionHandler: A block or closure that executes when FSKit finishes its fetch process. If the fetch succeeds, the first parameter contains an array of ``FSModuleIdentity`` instances that identify installed modules. If the fetch fails, the second parameter contains an error detailing the failure.+-(void)fetchInstalledExtensionsWithCompletionHandler:(void(^)(NSArray<FSModuleIdentity *> *_Nullable,+ NSError *_Nullable))completionHandler FSKIT_API_AVAILABILITY_V1 NS_SWIFT_ASYNC_NAME(getter:installedExtensions());++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSContainer.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSContainer.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSContainer.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSContainer.h2025-02-11 06:12:25@@ -0,0 +1,115 @@+//+// Copyright (c) 2022-2023 Apple Inc. All rights reserved.+//+// FSContainer.h+// FSKit+//++//+// Common container-level protocols used by all modules. The+// container-level operations needed to ADD support for any+// given resource type is common for all module types.+// Those operations are defined here.+//++#import <Foundation/Foundation.h>++#import <FSKit/FSKitDefines.h>+#import <FSKit/FSEntityIdentifier.h>++NS_ASSUME_NONNULL_BEGIN++/// An enumeration of container state values.+///+/// This enumeration represents values for a container's state engine.+/// Containers start in the ``notReady`` state.+FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(NSInteger, FSContainerState) {+ /// The container isn't ready.+ FSContainerStateNotReady = 0,+ /// The container is blocked from transitioning from the not-ready state to the ready state by a potentially-recoverable error.+ ///+ /// This state implies that the error has a resolution that would allow the container to become ready, such as correcting an incorrect password.+ FSContainerStateBlocked,+ /// The container is ready, but inactive.+ FSContainerStateReady,+ /// The container is active, and one or more volumes are active.+ FSContainerStateActive+};++/// A type that represents a container's status.+///+/// This type contains two properties:+///+/// * The ``state`` value that indicates the state of the container, such as ``FSContainerState/ready`` or ``FSContainerState/blocked``.+/// * The ``status`` is an error (optional in Swift, nullable in Objective-C) that provides further information about the state, such as why the container is blocked.+///+/// Examples of statuses that require intervention include errors that indicate the container isn't ready (POSIX `EAGAIN` or `ENOTCONN`), the container needs authentication (`ENEEDAUTH`), or that authentication failed (`EAUTH`).+/// The status can also be an informative error, such as the FSKit error ``FSErrorStatusOperationInProgress``, possibly with the variant information of ``FSKitErrorVariantCheckStatus`` or ``FSKitErrorVariantFormatStatus``.+///+@interface FSContainerStatus : NSObject <NSCopying>++/// A value that represents the container state, such as ready, active, or blocked.+@property (readonly) FSContainerState state;+/// An optional error that provides further information about the state.+@property (readonly,copy,nullable) NSError * status;++- (instancetype)init NS_UNAVAILABLE;++/// A status that represents an active container with no error.+///+/// This value is a ``FSContainerStatus`` with a ``state`` that is ``active``, and has a ``status`` that is `nil`.+@property (class,readonly) FSContainerStatus *active; // Container is active, status is nil++/// Returns a active container status instance with the provided error status.+///+/// - Parameter errorStatus: The error status, if any, for the new instance.++ (instancetype)activeWithStatus:(NSError *)errorStatus NS_SWIFT_NAME(active(status:));++/// Returns a blocked container status instance with the provided error status.+///+/// - Parameter errorStatus: The error status, if any, for the new instance.++ (instancetype)blockedWithStatus:(NSError *)errorStatus NS_SWIFT_NAME(blocked(status:));++/// Returns a not-ready container status instance with the provided error status.+///+/// - Parameter errorStatus: The error status, if any, for the new instance.++ (instancetype)notReadyWithStatus:(NSError *)errorStatus NS_SWIFT_NAME(notReady(status:));++/// A status that represents a ready container with no error.+///+/// This value is a ``FSContainerStatus`` with a ``state`` that is ``ready``, and a ``status`` that is `nil`.+@property (class,readonly) FSContainerStatus *ready; // Container is ready, status is nil++/// Returns a ready container status instance with the provided error status.+///+/// - Parameter errorStatus: The error status, if any, for the new instance.++ (instancetype)readyWithStatus:(NSError *)errorStatus NS_SWIFT_NAME(ready(status:));++@end++@class FSVolumeIdentifier;++/// A type that identifies a container.+///+/// The identifier is either a UUID or a UUID with additional differentiating bytes.+/// Some network protocols evaluate access based on a user ID when connecting.+/// In this situation, when a file server receives multiple client connections with different user IDs, the server provides different file hierarchies to each.+/// For such systems, represent the container identifier as the UUID associated with the server, followed by four or eight bytes to differentiate connections.+///+/// > Important: Don't subclass this class.+FSKIT_API_AVAILABILITY_V1+@interface FSContainerIdentifier : FSEntityIdentifier++/*+ * For Unary file systems, the container identifier is the same+ * as the volume identifier.+ */+/// The volume identifier associated with the container.+///+/// For unary file systems, the volume identifier is the same as the container identifier.+@property (readonly,copy) FSVolumeIdentifier *volumeIdentifier;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSEntityIdentifier.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSEntityIdentifier.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSEntityIdentifier.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSEntityIdentifier.h2025-02-11 06:12:26@@ -0,0 +1,38 @@+//+// Copyright (c) 2024 Apple Inc. All rights reserved.+//+// FSEntityIdentifier.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSKitDefines.h>++NS_ASSUME_NONNULL_BEGIN++/// A base type that identifies containers and volumes.+///+/// An ``FSEntityIdentifier`` is a UUID to identify a container or volume, optionally containing a four- or eight-byte qualifier.+/// You use the qualifiers in cases in which a file server can receive multiple connections from the same client, which differ by user credentials.+/// In this case, the identifier for each client is the server's base UUID, and a unique qualifier that differs by client.+///+/// > Important: Don't subclass this class.+FSKIT_API_AVAILABILITY_V1+@interface FSEntityIdentifier : NSObject <NSCopying, NSSecureCoding>++- (instancetype)init; // Generates a random UUID as the identifier++- (instancetype)initWithUUID:(NSUUID *)uuid;+- (instancetype)initWithUUID:(NSUUID *)uuid+ data:(NSData *)qualifier;+- (instancetype)initWithUUID:(NSUUID *)uuid+ byteQualifier:(const char * _Nonnull)bytes;+- (instancetype)initWithUUID:(NSUUID *)uuid+ longByteQualifier:(const char * _Nonnull)bytes;++@property (copy) NSUUID *uuid;+@property (copy, nullable) NSData *qualifier;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileName.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileName.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileName.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileName.h2025-02-11 06:12:25@@ -0,0 +1,110 @@+//+// FSFileName.h+// FSKit+//+//++#import <FSKit/FSKitDefines.h>++NS_ASSUME_NONNULL_BEGIN++/// The name of a file, expressed as a data buffer.+///+/// `FSFileName` is the class that carries filenames from the kernel to `FSModule` instances, and carries names back to the kernel as part of directory enumeration.+///+/// A filename is usually a valid UTF-8 sequence, but can be an arbitrary byte sequence that doesn't conform to that format.+/// As a result, the ``data`` property always contains a value, but the ``string`` property may be empty.+/// An `FSModule` can receive an `FSFileName` that isn't valid UTF-8 in two cases:+/// 1. A program passes erroneous data to a system call. The `FSModule` treats this situation as an error.+/// 2. An `FSModule` lacks the character encoding used for a file name.+/// This situation occurs because some file system formats consider a filename to be an arbitrary "bag of bytes," and leave character encoding up to the operating system.+/// Without encoding information, the `FSModule` can only pass back the names it finds on disk.+/// In this case, the behavior of upper layers such as <doc://com.apple.documentation/documentation/Foundation/NSFileManager> is unspecified.+/// However, the `FSModule` must support looking up such names and using them as the source name of rename operations.+/// The `FSModule` must also be able to support filenames that are derivatives of filenames returned from directory enumeration.+/// Derivative filenames include Apple Double filenames (`"._Name"`), and editor backup filenames.+///+/// > Important: Don't subclass this class.+FSKIT_API_AVAILABILITY_V1+@interface FSFileName : NSObject <NSSecureCoding, NSCopying>++/// The byte sequence of the filename, as a data object.+///+/// This property always provides a value.+@property (readonly) NSData *data FSKIT_API_AVAILABILITY_V1;++/// The filename, represented as a Unicode string.+///+/// If the value of the filename's ``FSFileName/data`` is not a valid UTF-8 byte sequence, this property is empty.+@property (readonly, nullable) NSString *string FSKIT_API_AVAILABILITY_V1;++/// The filename, represented as a potentially lossy conversion to a string.+///+/// The exact details of the string conversion may change in the future.+@property (readonly, copy) NSString *debugDescription FSKIT_API_AVAILABILITY_V1;++- (instancetype)init NS_UNAVAILABLE;++/// Initializes a filename from a null-terminated character sequence.+///+/// > Note: This initializer is unavailable in Swift. Use ``initWithData:`` or ``initWithString:`` instead.+///+/// - Parameter name: A pointer to a C string.+- (instancetype)initWithCString:(const char *)name FSKIT_API_AVAILABILITY_V1 NS_DESIGNATED_INITIALIZER NS_SWIFT_UNAVAILABLE("Use a data or string instead."); // NUL-terminated character sequence++/// Initializes a file name by copying a character sequence from a byte array.+///+/// > Note: This initializer is unavailable in Swift. Use ``initWithData:`` or ``initWithString:`` instead.+///+/// - Parameters:+/// - bytes: A pointer to the character data to copy, up to a maximum of `length`. The sequence terminates if a `NUL` character exists prior to `length`.+/// - length: The size of the `bytes` array.+- (instancetype)initWithBytes:(const char *)bytes+ length:(NSUInteger)length FSKIT_API_AVAILABILITY_V1 NS_DESIGNATED_INITIALIZER NS_SWIFT_UNAVAILABLE("Use a data or string instead.");++/// Creates a filename by copying a character sequence data object.+///+/// This initializer copies up to `name.length` characters of the sequence pointed to by `bytes`.+///+/// - Parameter name: The data object containing the character sequence to use for the filename. The sequence terminates if a `NUL` character exists prior to `name.length`.+- (instancetype)initWithData:(NSData *)name FSKIT_API_AVAILABILITY_V1;++/// Creates a filename by copying a character sequence from a string instance.+///+/// This initializer copies the UTF-8 representation of the characters in `string`.+/// If `string` contains a `NUL` character, the sequence terminates.+///+/// - Parameter name: The string containing the character sequence to use for the filename.+- (instancetype)initWithString:(NSString *)name FSKIT_API_AVAILABILITY_V1;++/// Creates a filename from a null-terminated character sequence.+///+/// - Parameter name: A pointer to a C string.++ (instancetype)nameWithCString:(const char *)name FSKIT_API_AVAILABILITY_V1 NS_SWIFT_UNAVAILABLE("Use a data or string instead."); // NUL-terminated character sequence++/// Creates a filename by copying a character sequence from a byte array.+///+/// - Parameters:+/// - bytes: A pointer to the character data to copy, up to a maximum of `length`. The sequence terminates if a `NUL` character exists prior to `length`.+/// - length: The size of the `bytes` array.++ (instancetype)nameWithBytes:(const char *)bytes+ length:(NSUInteger)length FSKIT_API_AVAILABILITY_V1 NS_SWIFT_UNAVAILABLE("Use a data or string instead.");++/// Creates a filename by copying a character sequence data object.+///+/// This initializer copies up to `name.length` characters of the sequence pointed to by `bytes`.+///+/// - Parameter name: The data object containing the character sequence to use for the filename. The sequence terminates if a `NUL` character exists prior to `name.length`.++ (instancetype)nameWithData:(NSData *)name FSKIT_API_AVAILABILITY_V1;++/// Creates a filename by copying a character sequence from a string instance.+///+/// This initializer copies the UTF-8 representation of the characters in `string`.+/// If `string` contains a `NUL` character, the sequence terminates.+///+/// - Parameter name: The string containing the character sequence to use for the filename.++ (instancetype)nameWithString:(NSString *)name FSKIT_API_AVAILABILITY_V1 ;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystem.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystem.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystem.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystem.h2025-02-11 06:12:25@@ -0,0 +1,26 @@+//+// Copyright (c) 2022-2023 Apple Inc. All rights reserved.+//+// FSFileSystem.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSFileSystemBase.h>++NS_ASSUME_NONNULL_BEGIN++/// An abstract base class for implementing a full-featured file system.+///+/// `FSFileSystem` is a full-featured file system, which works with one or more ``FSResource`` instances and presents one or more ``FSVolume`` references to callers.+///+/// Implement your app extension by providing a subclass of `FSFileSystem` as a delegate object.+/// Your delegate also needs to implement the `FSFileSystemOperations` protocol so that it can probe, load, and unload resources.+///+/// > Note: The current version of FSKit supports only ``FSUnaryFileSystem``, not `FSFileSystem`.+FSKIT_API_UNAVAILABLE_V1+@interface FSFileSystem : NSObject <FSFileSystemBase>++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystemBase.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystemBase.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystemBase.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSFileSystemBase.h2025-02-11 06:12:26@@ -0,0 +1,75 @@+//+// Copyright (c) 2023 Apple Inc. All rights reserved.+//+// FSFileSystemBase.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSKitDefines.h>+#import <FSKit/FSContainer.h>+#import <FSKit/FSVolume.h>++@class FSBlockDeviceResource;++NS_ASSUME_NONNULL_BEGIN++/// A protocol containing functionality supplied by FSKit to file system implementations.+///+/// Both ``FSFileSystem`` and ``FSUnaryFileSystem`` conform to this protocol.+FSKIT_API_AVAILABILITY_V1+@protocol FSFileSystemBase <NSObject>++/* Container state diagram for containerStatus:++ ┌────────────────────────────┐+ ┌─▶│ FSContainerStateNotReady │◀──────────────────────┐+ │ └────────────────────────────┘ ▼+ │ ▲ ┌────────────────────────────┐+ │ │ │ FSContainerStateBlocked │+ │ ▼ └────────────────────────────┘+ │ ┌────────────────────────────┐ ▲+ │ │ FSContainerStateReady │◀──────────────────────┘+ │ └────────────────────────────┘+ │ ▲+ │ │+ │ ▼+ │ ┌────────────────────────────┐+ └──│ FSContainerStateActive │+ └────────────────────────────┘+ */++/// The status of the file system container, indicating its readiness and activity.+///+/// A file system container starts in the ``FSContainerState/notReady`` state, and then transitions to the other values of the ``FSContainerState`` enumeration.+/// The following diagram illustrates the possible state transitions.+///+/// +///+/// Your file system implementation updates this property as it changes state.+/// Many events and operations may trigger a state transition, and some transitions depend on a specific file system's design.+///+/// When using ``FSBlockDeviceResource``, implement the following common state transitions:+///+/// * 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``.+/// * Calling `unloadResource` transitions to the ``FSContainerState/notReady`` state, as does device termination.+/// * Transitioning from ``FSContainerState/blocked`` to ``FSContainerState/ready`` occurs as a result of resolving the underlying block favorably.+/// * Transitioning from ``FSContainerState/ready`` to ``FSContainerState/blocked`` is unusal, but valid.+/// * 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.+///+@property (copy) FSContainerStatus *containerStatus FSKIT_API_AVAILABILITY_V1;++/// Wipes existing file systems on the specified resource.+///+/// This method wraps the `wipefs` functionality from `libutil`.+/// For more information, see the `man` page for `wipefs`.+///+/// - Parameters:+/// - resource: The ``FSBlockDeviceResource`` to wipe.+/// - 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.+-(void)wipeResource:(FSBlockDeviceResource * )resource+ completionHandler:(void(^)(NSError * _Nullable error))completion FSKIT_API_AVAILABILITY_V1;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSItem.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSItem.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSItem.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSItem.h2025-02-11 06:12:26@@ -0,0 +1,137 @@+//+// Copyright (c) 2022 Apple Inc. All rights reserved.+//+// FSItem.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSKitDefines.h>++NS_ASSUME_NONNULL_BEGIN++FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSInteger, FSItemAttribute) {+ FSItemAttributeType = 1UL << 0,+ FSItemAttributeMode = 1UL << 1,+ FSItemAttributeLinkCount = 1UL << 2,+ FSItemAttributeUID NS_SWIFT_NAME(uid) = 1UL << 3,+ FSItemAttributeGID NS_SWIFT_NAME(gid) = 1UL << 4,+ FSItemAttributeFlags = 1UL << 5,+ FSItemAttributeSize = 1UL << 6,+ FSItemAttributeAllocSize = 1UL << 7,+ FSItemAttributeFileID = 1UL << 8,+ FSItemAttributeParentID = 1UL << 9,+ FSItemAttributeAccessTime = 1UL << 10,+ FSItemAttributeModifyTime = 1UL << 11,+ FSItemAttributeChangeTime = 1UL << 12,+ FSItemAttributeBirthTime = 1UL << 13,+ FSItemAttributeBackupTime = 1UL << 14,+ FSItemAttributeAddedTime = 1UL << 15,+ FSItemAttributeSupportsLimitedXAttrs = 1UL << 16,+ FSItemAttributeInhibitKernelOffloadedIO = 1UL << 17,+} NS_SWIFT_NAME(FSItem.Attribute);++FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(NSInteger, FSItemType) {+ FSItemTypeUnknown = 0,+ FSItemTypeFile,+ FSItemTypeDirectory,+ FSItemTypeSymlink,+ FSItemTypeFIFO NS_SWIFT_NAME(fifo),+ FSItemTypeCharDevice,+ FSItemTypeBlockDevice,+ FSItemTypeSocket+}NS_SWIFT_NAME(FSItem.ItemType);++FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(UInt64, FSItemID) {+ FSItemIDInvalid = 0,+ FSItemIDParentOfRoot = 1,+ FSItemIDRootDirectory = 2,+} NS_SWIFT_NAME(FSItem.Identifier);++/// A distinct object in a file hierarchy, such as a file, directory, symlink, socket, and more.+///+/// An `FSItem` is a mostly opaque object, which your file system implementation defines as needed.+///+/// The ``FSItemAttributes`` class defines nonatomic properties to support `FSItem` instances.+/// An ``FSItemAttributes`` instance contains a snapshot of the attributes of an `FSItem` at one point in time.+/// The ``FSItemAttributes`` properties have no explicit thread safety provisions, since the operations that either get or set these properties enforce thread safety.+///+/// You test an attribute's validity with the the method ``FSItem/Attributes/isValid(_:)``.+/// If the value is `true` (Swift) or `YES` (Objective-C), it's safe to use the attribute.+///+/// To request attributes from the module, the ``FSItem/GetAttributesRequest`` provides the ``FSItem/GetAttributesRequest/isAttributeWanted(_:)`` method as a way to check whether the module should retrieve an atribute's value.+/// This class also provides a ``FSItem/GetAttributesRequest/wantedAttributes`` property to allow a calling app to set all wanted attributes in a single command.+///+/// When setting attributes, ``FSItem/SetAttributesRequest`` provides the ``FSItem/SetAttributesRequest/wasAttributeConsumed(_:)`` method to verify whether the module successfully used an attribute.+/// To work with several attributes at once, use the ``FSItem/SetAttributesRequest/consumedAttributes`` property.+///+/// `FSItem` is the FSKit equivelant of a vnode in the kernel.+/// For every FSKit vnode in the kernel, the `FSModule` hosting the volume has an instantiated `FSItem`.+FSKIT_API_AVAILABILITY_V1+@interface FSItem : NSObject++@end++FSKIT_API_AVAILABILITY_V1 NS_SWIFT_NAME(FSItem.Attributes)+@interface FSItemAttributes : NSObject <NSSecureCoding>++-(void)invalidateAllProperties; // mark all attributes inactive++@property (nonatomic) uint32_t uid;+@property (nonatomic) uint32_t gid;+@property (nonatomic) uint32_t mode;+@property (nonatomic) FSItemType type;+@property (nonatomic) uint32_t linkCount;+/** Flags are reported to applications as `stat.st_flags` and use the definitions there-of */+@property (nonatomic) uint32_t flags;+@property (nonatomic) uint64_t size;+@property (nonatomic) uint64_t allocSize;+@property (nonatomic) FSItemID fileID;+@property (nonatomic) FSItemID parentID;+/**+ * supportsLimitedXAttrs - the item natively supports a limited set of xattrs+ *+ * Some file systems only support a limited set of xatts, for example msdosfs,+ * where only the root item supports a single xattr.+ */+@property (nonatomic) BOOL supportsLimitedXAttrs;+/**+ * inhibitKernelOffloadedIO+ * Allows the file system to override the per file system Kernel Offloaded IO+ * settings for a specific file.+ */+@property (nonatomic) BOOL inhibitKernelOffloadedIO;++@property (nonatomic) struct timespec modifyTime;+@property (nonatomic) struct timespec addedTime;+@property (nonatomic) struct timespec changeTime;+@property (nonatomic) struct timespec accessTime;+@property (nonatomic) struct timespec birthTime;+@property (nonatomic) struct timespec backupTime;++-(BOOL)isValid:(FSItemAttribute)attribute;++@end++FSKIT_API_AVAILABILITY_V1 NS_SWIFT_NAME(FSItem.SetAttributesRequest)+@interface FSItemSetAttributesRequest : FSItemAttributes++@property (nonatomic) FSItemAttribute consumedAttributes;++-(BOOL)wasAttributeConsumed:(FSItemAttribute)attribute;++@end++FSKIT_API_AVAILABILITY_V1 NS_SWIFT_NAME(FSItem.GetAttributesRequest)+@interface FSItemGetAttributesRequest : NSObject <NSSecureCoding>++@property (nonatomic) FSItemAttribute wantedAttributes;++-(BOOL)isAttributeWanted:(FSItemAttribute)attribute;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKit.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKit.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKit.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKit.h2025-02-11 06:12:25@@ -0,0 +1,45 @@+//+// Copyright (c) 2022-2023 Apple Inc. All rights reserved.+//+// FSKit.h+// FSKit+//++#ifndef FSKit_h+#define FSKit_h++#import <Foundation/Foundation.h>+#import <os/log.h>++#import <FSKit/FSKitDefines.h>+#import <FSKit/FSKitFunctions.h>+#import <FSKit/FSKitTypes.h>++//! Project version number for FSKit.+FOUNDATION_EXPORT double FSKitVersionNumber;++//! Project version string for FSKit.+FOUNDATION_EXPORT const unsigned char FSKitVersionString[];+++// In this header, we import all the FSKit public headers+#import <FSKit/FSClient.h>+#import <FSKit/FSContainer.h>+#import <FSKit/FSEntityIdentifier.h>+#import <FSKit/FSMutableFileDataBuffer.h>+#import <FSKit/FSFileName.h>+#import <FSKit/FSItem.h>+#import <FSKit/FSKitError.h>+#import <FSKit/FSModuleIdentity.h>+#import <FSKit/FSResource.h>+#import <FSKit/FSTask.h>+#import <FSKit/FSTaskOptions.h>+#import <FSKit/FSVolume.h>+#import <FSKit/FSVolumeExtent.h>++// These are last as they depend on classes included above+#import <FSKit/FSFileSystemBase.h>+#import <FSKit/FSFileSystem.h>+#import <FSKit/FSUnaryFileSystem.h>++#endif /* FSKit_h */diff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitDefines.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitDefines.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitDefines.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitDefines.h2025-02-11 06:12:26@@ -0,0 +1,42 @@+//+// Copyright (c) 2023 Apple Inc. All rights reserved.+//+// Header.h+// FSKit+//++#ifndef FSKitDefines_h+#define FSKitDefines_h++#ifdef __cplusplus+# define FS_EXTERN extern "C"+#else+# define FS_EXTERN extern+#endif++#ifndef FS_EXPORT+# ifndef FS_SUPPORTED_VISIBILITY+# if FS_UNSUPPORTED_PLATFORM+# define FS_SUPPORTED_VISIBILITY+# else+# define FS_SUPPORTED_VISIBILITY __attribute__((visibility("default")))+# endif+# endif+#define FS_EXPORT FS_EXTERN FS_SUPPORTED_VISIBILITY+#endif++#ifndef FS_EXPORT_INTERNAL+#define FS_EXPORT_INTERNAL FS_EXTERN __attribute__((visibility("internal")))+#endif++#ifndef FS_ALWAYS_EXPORT+#define FS_ALWAYS_EXPORT FS_EXTERN __attribute__((visibility("default")))+#endif++// original API+#define FSKIT_API_AVAILABILITY_V1 API_AVAILABLE(macos(15.4)) \+ API_UNAVAILABLE(ios, visionos) API_UNAVAILABLE(watchos, tvos)+// Unavailable in original API+#define FSKIT_API_UNAVAILABLE_V1 API_UNAVAILABLE(macos, ios, visionos) API_UNAVAILABLE(watchos, tvos)++#endif /* FSKitDefines_h */diff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitError.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitError.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitError.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitError.h2025-02-11 06:12:25@@ -0,0 +1,50 @@+//+// Copyright (c) 2024 Apple Inc. All rights reserved.+//+// FSKitError.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSKitDefines.h>++NS_ASSUME_NONNULL_BEGIN++/// An error domain for FSKit errors.+///+/// See <doc://com.apple.documentation/documentation/Foundation/NSError> for more information on error domains.+FSKIT_API_AVAILABILITY_V1+FOUNDATION_EXPORT NSErrorDomain const FSKitErrorDomain;++/// A code that indicates a specific FSKit error.+typedef NS_ERROR_ENUM(FSKitErrorDomain, FSErrorCode) {+ /// The module failed to load.+ FSErrorModuleLoadFailed = 4500,++ /// FSKit didn't recognize the resource, and probing failed to find a match.+ FSErrorResourceUnrecognized = 4501,++ /// The resource is damaged.+ ///+ /// This error indicates the resource needs a repair operation, or that a repair operation failed.+ /// > Note: The status in this error applies to the resource. A failing repair operation reports a more specific error status.+ FSErrorResourceDamaged = 4502,++ /// FSKit recognizes the resource, but the resource isn't usable.+ ///+ /// For example, this error occurs when a resource uses a file system's internal feature flags.+ /// If the only modules that support the file system don't support those feature flags, this code indicates an unusable resource.+ /// The error tells the person using the module why the resource isn't usable.+ FSErrorResourceUnusable = 4503,++ /// An operation is in progress.+ FSErrorStatusOperationInProgress = 4504,++ /// An operation is paused.+ FSErrorStatusOperationPaused = 4505,++ /// While enumerating a directory, the given cookie didn't resolve to a valid directory entry.+ FSErrorInvalidDirectoryCookie = 4506,+};++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitFunctions.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitFunctions.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitFunctions.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitFunctions.h2025-02-11 06:12:25@@ -0,0 +1,24 @@+//+// Copyright (c) 2023 Apple Inc. All rights reserved.+//+// FSKitFunctions.h+// FSKit+//++#ifndef FSKitFunctions_h+#define FSKitFunctions_h++// C code in this header is meant to be bridged to our Swift module+#import <Foundation/Foundation.h>+#import <os/log.h>++#import <FSKit/FSKitDefines.h>++/// Creates an error object for the given POSIX error code.+FOUNDATION_EXPORT NSError * _Nonnull fs_errorForPOSIXError(int) FSKIT_API_AVAILABILITY_V1;+/// Creates an error object for the given Mach error code.+FOUNDATION_EXPORT NSError * _Nonnull fs_errorForMachError(int errorCode) FSKIT_API_AVAILABILITY_V1;+/// Creates an error object for the given Cocoa error code.+FOUNDATION_EXPORT NSError * _Nonnull fs_errorForCocoaError(int errorCode) FSKIT_API_AVAILABILITY_V1;++#endif /* FSKitFunctions_h */diff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitTypes.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitTypes.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitTypes.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSKitTypes.h2025-02-11 06:12:25@@ -0,0 +1,24 @@+//+// Copyright (c) 2023 Apple Inc. All rights reserved.+//+// FSKitTypes.h+// FSKit+//++#ifndef FSKitTypes_h+#define FSKitTypes_h+++/*+ * FSTaskParameters - argument array of parameters for an operation+ *+ * Directly maps to `argc`/`argv` passed to a command line tool. Consists+ * of a sequence of strings formatted as per CLI arguments. Exact squence+ * and syntax is left to the receiver, but two examples are:+ *+ * "force" => @[ @"--force" ]+ * "read only" => @[ @"-o", "rdonly" ]+ */+typedef NSArray <NSString *> FSTaskParameters;++#endif /* FSKitTypes_h */diff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSModuleIdentity.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSModuleIdentity.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSModuleIdentity.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSModuleIdentity.h2025-02-11 06:12:26@@ -0,0 +1,29 @@+//+// Copyright (c) 2023 Apple Inc. All rights reserved.+//+// FSModuleIdentity.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSKitDefines.h>++NS_ASSUME_NONNULL_BEGIN++/// An installed file system module.+FSKIT_API_AVAILABILITY_V1+@interface FSModuleIdentity : NSObject++/// The module's bundle identifier.+@property (readonly) NSString *bundleIdentifier FSKIT_API_AVAILABILITY_V1;++/// The module's URL.+@property (readonly) NSURL *url FSKIT_API_AVAILABILITY_V1;++/// A Boolean value that indicates if the module is enabled.+@property (nonatomic, getter=isEnabled, readonly)+ BOOL enabled FSKIT_API_AVAILABILITY_V1;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSMutableFileDataBuffer.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSMutableFileDataBuffer.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSMutableFileDataBuffer.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSMutableFileDataBuffer.h2025-02-11 06:12:25@@ -0,0 +1,31 @@+//+// Copyright (c) 2024 Apple Inc. All rights reserved.+//+// FSFileDataBuffer.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSKitDefines.h>++NS_ASSUME_NONNULL_BEGIN++/*+ * FSMutableFileDataBuffer - wrapper object for a data buffer+ *+ * This object class wraps data buffers, and behaves+ * in a way similar to a uio in the kernel.+ */++FSKIT_API_AVAILABILITY_V1+@interface FSMutableFileDataBuffer : NSObject++@property (readonly) NSUInteger length FSKIT_API_AVAILABILITY_V1;++- (instancetype)init NS_UNAVAILABLE;++-(void *)mutableBytes FSKIT_API_AVAILABILITY_V1 NS_SWIFT_UNAVAILABLE("Use withMutableBytes instead.");++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSResource.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSResource.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSResource.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSResource.h2025-02-11 06:12:26@@ -0,0 +1,435 @@+//+// Copyright (c) 2022-2023 Apple Inc. All rights reserved.+//+// FSResource.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSContainer.h>+#import <FSKit/FSKitDefines.h>+#import <FSKit/FSKitTypes.h>+#import <FSKit/FSTask.h>+#import <FSKit/FSTaskOptions.h>++NS_ASSUME_NONNULL_BEGIN++FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(NSInteger, FSMatchResult) {+ // No match+ FSMatchResultNotRecognized = 0,+ // Probe recognizes this resource but is unable to use+ FSMatchResultRecognized,+ // Probe recognizes this resource and is ready to use, but in a limited capacity+ FSMatchResultUsableButLimited,+ // Probe recognizes this resource and is ready to use+ FSMatchResultUsable,+};++/// An abstract resource a file system uses to provide data for a volume.+///+/// `FSResource` is a base class to represent the various possible sources of data for a file system.+/// These range from dedicated storage devices like hard drives and flash storage to network connections, and beyond.+/// Subclasses define behavior specific to a given kind of resource, such as ``FSBlockDeviceResource-c.class`` for disk partition (IOMedia) file systems.+/// These file systems are typical disk file systems such as HFS, APFS, ExFAT, ext2fs, or NTFS.+///+/// A resource's type also determines its life cycle.+/// Resources based on block storage devices come into being when the system probes the media underlying the volumes and container.+/// Other kinds of resources, like those based on URLs, might have different life cycles.+/// For example, a resource based on a `file://` URL might iniitalize when a person uses the "Connect to server" command in the macOS Finder.+///+/// ### Proxying resources+///+/// Some resources, like ``FSBlockDeviceResource``, come in proxy and non-proxy variants.+/// This addresses the issue that opening an external device like `/dev/disk2s1` requires an entitlement.+/// Proxy resources allow unentitled clients of FSKit to describe which disk an ``FSBlockDeviceResource`` should represent.+/// This allows, for example, the `mount(8)` tool to mount FSKit file systems on block devices when run as root.+/// The tool uses a proxy when executing a command like `mount -t ffs /dev/disk2s1 /some/path`, which prevents leaking privileged resource access.+FSKIT_API_AVAILABILITY_V1+@interface FSResource : NSObject<NSSecureCoding>++/// A Boolean value that indicates whether the resource is revoked.+///+/// If this is a proxy resource, the value of this property is always `true` (Swift) or `YES` (Objective-C).+@property (nonatomic, readonly, getter=isRevoked) BOOL revoked;++- (instancetype)init NS_UNAVAILABLE;++/// Creates a proxy object of this resource.+///+/// If you create a proxy from a proxy resource, this method returns a copy of the proxy.+- (instancetype)makeProxy;++/// Revokes the resource.+///+/// This method works by stripping away any underlying privileges associated with the resource.+/// This effectively disconnects this object from its underlying resource.+- (void)revoke;++@end++#pragma mark - FSBlockDeviceResource class and helpers++/** FSMetadataRange - A range describing contiguous metadata segments on disk. Consists of a startOffset, segmentLength and segmentCount.+ It represents the following range of bytes in disk: `[startOffset, startOffset + segmentLength * segmentCount)`.+ It is split into segments, as each segment represents a single block in the resource's buffer cache.++ Each metadata segment must represent range which is already present in the resource's buffer cache.+ Each segment's offset and length must match the offset and length of the corresponding block in the buffer cache.++ For example, in the case of startOffset = 0, segmentLength = 512, segmentCount = 8,+ this range represents 8 segments with the following ranges in disk: `[0, 512), [512, 1024), [1024, 1536), ..., [3584, 4096)`.+ */+@interface FSMetadataRange : NSObject++/** Start offset of the range in bytes, must be a multiple of the corresponding resource blockSize */+@property (readonly) off_t startOffset;++/** Segment length in bytes, must be a multiple of the corresponding resource blockSize */+@property (readonly) uint64_t segmentLength;++/** Segment count */+@property (readonly) uint64_t segmentCount;++-(instancetype)initWithOffset:(off_t)startOffset+ segmentLength:(uint64_t)segmentLength+ segmentCount:(uint64_t)segmentCount;+++(instancetype)rangeWithOffset:(off_t)startOffset+ segmentLength:(uint64_t)segmentLength+ segmentCount:(uint64_t)segmentCount;++- (instancetype)init NS_UNAVAILABLE;++@end++/// A resource that represents a block storage disk partition.+///+/// A `FSBlockDeviceResource` can exist in either a proxied or nonproxied version.+/// Only the `fskitd` daemon creates "real" (nonproxied) instances of this class.+/// Client applications and daemons create proxy objects for requests, and `fskitd` opens the underlying device during the processing of the request.+///+/// This class wraps a file descriptor for a disk device or partition.+/// Its fundamental identifier is the BSD disk name (``bsdName``) for the underlying IOMedia object.+/// However, ``FSBlockDeviceResource-c.class`` doesn't expose the underlying file descriptor.+/// Instead, it provides accessor methods that can read from and write to the partition, either directly or using the kernel buffer cache.+///+/// When you use a `FSBlockDeviceResource`, your file system implementation also conforms to a maintenance operation protocol.+/// These protocols add support for checking, repairing, and optionally formatting file systems.+/// The system doesn't mount block device file systems until they pass a file system check.+/// For an ``FSUnaryFileSystem`` that uses `FSBlockDeviceResource`, conform to `FSManageableResourceMaintenanceOperations`.+FSKIT_API_AVAILABILITY_V1+@interface FSBlockDeviceResource : FSResource++/// The device name of the resource.+@property (readonly, copy) NSString *BSDName;++/// A Boolean property that indicates whether the resource can write data to the device.+@property (readonly, getter=isWritable)+ BOOL writable;++/// The logical block size, the size of data blocks used by the file system.+///+/// This is equivalent to the `DKIOCGETBLOCKSIZE` device parameter.+@property (readonly) uint64_t blockSize;++/// The block count on this resource.+@property (readonly) uint64_t blockCount;++/// The sector size of the device.+///+/// This is equivalent to the `DKIOCGETPHYSICALBLOCKSIZE` device parameter.+@property (readonly) uint64_t physicalBlockSize;++- (instancetype)init NS_UNAVAILABLE;+++/// Reads data from the resource into a buffer and executes a block afterwards.+///+/// For the read to succeed, requests must conform to any transfer requirements of the underlying resource.+/// Disk drives typically require sector (`physicalBlockSize`) addressed operations of one or more sector-aligned offsets.+///+/// - Parameters:+/// - buffer: A buffer to receive the data.+/// - offset: The offset into the resource from which to start reading.+/// - length: A maximum number of bytes to read. The completion handler receives a parameter with the actual number of bytes read.+/// - completionHandler: A block that executes after the read operation completes. If successful, the first parameter contains the number of bytes actually read. In the case of an error, the second parameter contains a non-`nil` error. This value is `EFAULT` if `buffer` is `NULL`, or `errno` if reading from the resource failed.+- (void)readInto:(void *)buffer+ startingAt:(off_t)offset+ length:(size_t)length+completionHandler:(void(^)(size_t actuallyRead,+ NSError * _Nullable error))completionHandler FSKIT_API_AVAILABILITY_V1 NS_REFINED_FOR_SWIFT;++/// Synchronously reads data from the resource into a buffer.+///+/// This is a synchronous version of ``readInto:startingAt:length:completionHandler:``.+///+/// > Note: In some cases, this method performs a partial read. In this case, the return value is shorter than the requested length, and the `error` is set to `nil`.+///+/// - Parameters:+/// - buffer: A buffer to receive the data.+/// - offset: The offset into the resource from which to start reading.+/// - length: A maximum number of bytes to read. The method's return value contains the actual number of bytes read.+/// - error: On return, any error encountered while reading data, or `nil` if no error occurred.+///+/// - Returns: The actual number of bytes read.+-(size_t)readInto:(void *)buffer+ startingAt:(off_t)offset+ length:(size_t)length+ error:(NSError **)error FSKIT_API_AVAILABILITY_V1 NS_REFINED_FOR_SWIFT;+++/// Writes data from from a buffer to the resource and executes a block afterwards.+///+/// For the write to succeed, requests must conform to any transfer requirements of the underlying resource.+/// Disk drives typically require sector (`physicalBlockSize`) addressed operations of one or more sector-aligned offsets.+///+/// - Parameters:+/// - buffer: A buffer to provide the data.+/// - offset: The offset into the resource from which to start writing.+/// - length: A maximum number of bytes to write. The completion handler receives a parameter with the actual number of bytes write.+/// - completionHandler: A block that executes after the write operation completes. If successful, the first parameter contains the number of bytes actually written. In the case of an error, the second parameter contains a non-`nil` error. This value is `EFAULT` if `buffer` is `NULL`, or `errno` if writing to the resource failed.+- (void)writeFrom:(void *)buffer+ startingAt:(off_t)offset+ length:(size_t)length+completionHandler:(void(^)(size_t actuallyWritten,+ NSError * _Nullable error))completionHandler FSKIT_API_AVAILABILITY_V1 NS_REFINED_FOR_SWIFT;++/// Synchronously writes data from from a buffer to the resource and executes a block afterwards.+///+/// This is a synchronous version of ``writeFrom:startingAt:length:completionHandler:``.+///+/// > Note: In some cases, this method performs a partial write. In this case, the return value is shorter than the requested length, and the `error` is set to `nil`.+///+/// - Parameters:+/// - buffer: A buffer to provide the data.+/// - offset: The offset into the resource from which to start writing.+/// - length: A maximum number of bytes to write. The completion handler receives a parameter with the actual number of bytes write.+/// - error: On return, any error encountered while writing data, or `nil` if no error occurred.+///+/// - Returns: The actual number of bytes written.+-(size_t)writeFrom:(void *)buffer+ startingAt:(off_t)offset+ length:(size_t)length+ error:(NSError **)error FSKIT_API_AVAILABILITY_V1 NS_REFINED_FOR_SWIFT;++/// Synchronously reads file system metadata from the resource into a buffer.+///+/// This method provides access to the Kernel Buffer Cache, which is the primary system cache for file system metadata.+/// Unlike equivalent kernel APIs, this method doesn't hold any kernel-level claim to the underlying buffers.+///+/// For the read to succeed, requests must conform to any transfer requirements of the underlying resource.+/// Disk drives typically require sector (`physicalBlockSize`) addressed operations of one or more sector-aligned offsets.+///+/// This method doesn't support partial reading of metadata.+///+/// - Parameters:+/// - buffer: A buffer to receive the data.+/// - offset: The offset into the resource from which to start reading.+/// - length: The number of bytes to read.+/// - error: On return, any error encountered while reading data, or `nil` if no error occurred.+///+/// - Returns: A Boolean value indicating whether the metadata read succeeded.+-(BOOL)metadataReadInto:(void *)buffer+ startingAt:(off_t)offset+ length:(size_t)length+ error:(NSError **)error FSKIT_API_AVAILABILITY_V1 NS_REFINED_FOR_SWIFT;++/// Synchronously writes file system metadata from a buffer to the resource.+///+/// This method provides access to the Kernel Buffer Cache, which is the primary system cache for file system metadata.+/// Unlike equivalent kernel APIs, this method doesn't hold any kernel-level claim to the underlying buffers.+///+/// For the write to succeed, requests must conform to any transfer requirements of the underlying resource.+/// Disk drives typically require sector (`physicalBlockSize`) addressed operations of one or more sector-aligned offsets.+///+/// This method doesn't support partial writing of metadata.+///+/// - Parameters:+/// - buffer: A buffer to provide the data.+/// - offset: The offset into the resource from which to start writing.+/// - length: The number of bytes to writing.+/// - error: On return, any error encountered while writing data, or `nil` if no error occurred.+///+/// - Returns: A Boolean value indicating whether the metadata write succeeded.+-(BOOL)metadataWriteFrom:(void *)buffer+ startingAt:(off_t)offset+ length:(size_t)length+ error:(NSError **)error FSKIT_API_AVAILABILITY_V1 NS_REFINED_FOR_SWIFT;++/// Writes file system metadata from a buffer to a cache, prior to flushing it to the resource.+///+/// This method provides access to the Kernel Buffer Cache, which is the primary system cache for file system metadata.+/// Unlike equivalent kernel APIs, this method doesn't hold any kernel-level claim to the underlying buffers.+///+/// This method is equivalent to ``metadataWriteFrom:startingAt:length:error:``, except that it writes data to the resource's buffer cache instead of writing to disk immediately.+/// To ensure writing data to disk, the client must flush the metadata by calling ``metadataFlushWithError:`` or ``asynchronousMetadataFlushWithError:``.+///+/// Delayed writes offer two significant advantages:+/// - Delayed writes are more performant, since the file system can avoid waiting for the actual write, reducing I/O latency.+/// - When writing to a specific range repeatedly, delayed writes allow the file system to flush data to the disk only when necessary. This reduces disk usage by eliminating unnecessary writes.+///+/// For the write to succeed, requests must conform to any transfer requirements of the underlying resource.+/// Disk drives typically require sector (`physicalBlockSize`) addressed operations of one or more sector-aligned offsets.+///+/// This method doesn't support partial writing of metadata.+///+/// - Parameters:+/// - buffer: A buffer to provide the data.+/// - offset: The offset into the resource from which to start writing.+/// - length: The number of bytes to writing.+/// - error: On return, any error encountered while writing data, or `nil` if no error occurred.+///+/// - Returns: A Boolean value indicating whether the metadata write succeeded.+-(BOOL)delayedMetadataWriteFrom:(void *)buffer+ startingAt:(off_t)offset+ length:(size_t)length+ error:(NSError **)error FSKIT_API_AVAILABILITY_V1 NS_REFINED_FOR_SWIFT;++/** metadataFlushWithError: - synchronously flush the resource's buffer cache.+ This method preforms metadata flush to the resource, which means any cached metadata operations are being written to the resource.++ Returns values:+ - YES on success+ - NO with an error code of EIO+ */++/// Synchronously flushes the resource's buffer cache.+///+/// This method flushes data previously written with ``delayedMetadataWriteFrom:startingAt:length:error:`` to the resource.+///+/// - Parameter error: On return, any error encountered while writing data, or `nil` if no error occurred.+///+/// - Returns: A Boolean value indicating whether the metadata flush succeeded.+-(BOOL)metadataFlushWithError:(NSError **)error FSKIT_API_AVAILABILITY_V1;++/// Asynchronously flushes the resource's buffer cache.+///+/// This method schedules a flush of data previously written with ``delayedMetadataWriteFrom:startingAt:length:error:`` to the resource and returns immediately without blocking.+/// This method doesn't wait to check the flush's status.+/// If an error prevents the flush from being scheduled, the error is indicated by the in-out `error` parameter.+///+/// - Parameter error: On return, any error encountered while writing data, or `nil` if no error occurred.+///+/// - Returns: A Boolean value indicating whether scheduling the metadata flush succeeded.+-(BOOL)asynchronousMetadataFlushWithError:(NSError **)error FSKIT_API_AVAILABILITY_V1;++/// Clears the given ranges within the buffer cache.+///+/// This method clears the specified ranges in the resource’s buffer cache by writing zeroes into them.+///+/// - Parameters:+/// - rangesToClear: The metadata ranges to clear.+/// - withDelayedWrites: A Boolean value that determines whether to perform the clear operation with delayed writes. The delay works in the same manner as ``delayedMetadataWriteFrom:startingAt:length:error:``. When using delayed writes, the client can flush the metadata with ``metadataFlushWithError:`` or ``asynchronousMetadataFlushWithError:``. The system also flushes stale data in the buffer cache periodically.+/// - error: On return, any error encountered while writing data, or `nil` if no error occurred. This value is `EINVAL` if `rangesToClear` is invalid.+///+/// - Returns: A Boolean value indicating whether clearing the metadata succeeded.+-(BOOL)metadataClear:(NSArray<FSMetadataRange *> *)rangesToClear+ withDelayedWrites:(BOOL)withDelayedWrites+ error:(NSError **)error FSKIT_API_AVAILABILITY_V1;++/// Synchronously purges the given ranges from the buffer cache.+///+/// This method removes the given ranges from the resource's buffer cache.+/// This process drops any dirty data in the cache, preventing the data from reaching the device.+///+/// - Parameters:+/// - rangesToPurge: The metadata ranges to purge.+/// - error: On return, any error encountered while writing data, or `nil` if no error occurred. This value is `EINVAL` if `rangesToPurge` is invalid.+///+/// - Returns: A Boolean value indicating whether purging the metadata succeeded.+-(BOOL)metadataPurge:(NSArray<FSMetadataRange *> *)rangesToPurge+ error:(NSError **)error FSKIT_API_AVAILABILITY_V1;++@end++/// Maintenance operations for a file system's resources.+///+/// This protocol includes operations to check and format a resource for an ``FSUnaryFileSystem``.+/// Conform to this protocol if you implement a ``FSUnaryFileSystem`` that uses an ``FSBlockDeviceResource-c.class``.+FSKIT_API_AVAILABILITY_V1+@protocol FSManageableResourceMaintenanceOperations <NSObject>++/// Starts checking the file system with the given options.+///+/// - Parameters:+/// - task: A task object you use to communicate back to the client.+/// - options: Options for performing the check.+/// - error: In Objective-C, a pointer to an <doc://com.apple.documentation/documentation/Foundation/NSError>. Populate this with any error that occurs when starting the check. In Swift, throw an <doc://com.apple.documentation/documentation/Swift/Error> instead.+/// - Returns: An <doc://com.apple.documentation/documentation/Foundation/NSProgress> object that you use to update progress as the check operation progresses. Return `nil` if starting the file system check encountered an error.+-(NSProgress * _Nullable)startCheckWithTask:(FSTask *)task+ options:(FSTaskOptions *)options+ error:(NSError**)error FSKIT_API_AVAILABILITY_V1 NS_SWIFT_NAME(startCheck(task:options:));++/// Starts formatting the file system with the given options.+///+/// - Parameters:+/// - task: A task object you use to communicate back to the client.+/// - options: Options for performing the format.+/// - error: In Objective-C, a pointer to an <doc://com.apple.documentation/documentation/Foundation/NSError>. Populate this with any error that occurs when starting the format. In Swift, throw an <doc://com.apple.documentation/documentation/Swift/Error> instead.+/// - Returns: An <doc://com.apple.documentation/documentation/Foundation/NSProgress> object that you use to update progress as the format operation progresses. Return `nil` if starting to format the file system encountered an error.+-(NSProgress * _Nullable)startFormatWithTask:(FSTask *)task+ options:(FSTaskOptions *)options+ error:(NSError**)error FSKIT_API_AVAILABILITY_V1 NS_SWIFT_NAME(startFormat(task:options:));++@end++/** FSProbeResult object holding result of a specific probe++ @discussion Name and containerID must be non-nil for results other than .NotRecognized. Some container or volume formats may+ lack a name. Return an empty string (`@""`). Likewise, if the format supports a name but one is not set. Some container+ or volume formats may lack a durable UUID on which to base a container identifier. Such formats are only valid for Unary+ file systems. In such cases, return a random UUID. In BlockDeviceResource file system cases where the probe operation+ succeeds at determining the probe result but there is an error reading either the name or the UUID, return whatever information+ is available and an empty string/random UUID for the missing information.+ */+FSKIT_API_AVAILABILITY_V1+@interface FSProbeResult : NSObject <NSSecureCoding>++/**+ @property result match result, one of .NotRecognized, .Recognized, .UsableButLimited, or .Usable.+ @property name resource name found during probe. nil if .NotRecognized, non-nil otherwise+ @property containerID container identifier found during probe. nil if .NotRecognized, non-nil otherwise+ @discussion+ name and containerID must be non-nil for results other than .NotRecognized. Some container or volume formats may+ lack a name. Return an empty string (`@""`). Likewise if the format supports a name but one is not set. Some container+ or volume formats may lack a durable UUID on which to base a container identifier. Such formats are only valid for Unary+ file systems. In such cases, return a random UUID. In BlockDeviceResource file system cases where the probe operation+ succeeds at determining the probe result but there is an error reading either the name or the uuid, return whatever information+ is available and an empty string/random UUID for the missing information.+ */+@property (readonly) FSMatchResult result;++/** Resource name found during probe. nil if .NotRecognized, non-nil otherwise */+@property (readonly, copy, nullable) NSString *name;++/** Container identifier found during probe. nil if .NotRecognized, non-nil otherwise */+@property (readonly, nullable) FSContainerIdentifier *containerID;++- (instancetype)init NS_UNAVAILABLE;++/** Probe result of not recognized */+@property (class, readonly) FSProbeResult * notRecognizedProbeResult;++/** This probe result indicates that the file system format is recognized, but not usable. The name and containerID are both included with the result. */++ (instancetype)recognizedProbeResultWithName:(NSString *)name+ containerID:(FSContainerIdentifier *)containerID+ NS_SWIFT_NAME(recognized(name:containerID:));++/** This probe result indicates that the file system format is known and is usable with limited capabilities, however the name and/or containerID were unavailable due to limitations on the probed resource.+ This result must never be returned as the result from probing a reslurce which is not limited. */+@property (class, readonly) FSProbeResult * usableButLimitedProbeResult;++/** This probe result indicates that the file system format is known and is usable with limited capabilities. The name and containerID are both included with the result. */++ (instancetype)usableButLimitedProbeResultWithName:(NSString *)name+ containerID:(FSContainerIdentifier *)containerID+ NS_SWIFT_NAME(usableButLimited(name:containerID:));++/** This probe result indicates that the file system format is known and is usable. The name and containerID are both included with the result. */++ (instancetype)usableProbeResultWithName:(NSString *)name+ containerID:(FSContainerIdentifier *)containerID+ NS_SWIFT_NAME(usable(name:containerID:));++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTask.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTask.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTask.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTask.h2025-02-11 06:12:26@@ -0,0 +1,30 @@+//+// Copyright (c) 2024 Apple Inc. All rights reserved.+//+// FSTask.h+// FSKit+//++#import <FSKit/FSKitDefines.h>++NS_ASSUME_NONNULL_BEGIN++/// A class that enables a file system module to pass log messages and completion notifications to clients.+///+/// FSKit creates an instance of this class for each long-running operations.+FSKIT_API_AVAILABILITY_V1+@interface FSTask : NSObject++/// Logs the given string to the initiating client.+///+/// - Parameter str: The string to log.+- (void)logMessage:(NSString *)str FSKIT_API_AVAILABILITY_V1;++/// Informs the client that the task completed.+///+/// - Parameter error: `nil` if the task completed successfully; otherwise, an error that caused the task to fail.+- (void)didCompleteWithError:(NSError * _Nullable)error FSKIT_API_AVAILABILITY_V1 NS_SWIFT_NAME(didComplete(error:));++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTaskOptions.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTaskOptions.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTaskOptions.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSTaskOptions.h2025-02-11 06:12:26@@ -0,0 +1,37 @@+//+// Copyright (c) 2024 Apple Inc. All rights reserved.+//+// FSKitTaskOptions.h+// FSKit+//++#import <Foundation/Foundation.h>++NS_ASSUME_NONNULL_BEGIN++/// A class that passes command options to a task, optionally providing security-scoped URLs.+FSKIT_API_AVAILABILITY_V1+@interface FSTaskOptions : NSObject++- (instancetype)init NS_UNAVAILABLE;++/// An array of strings that represent command-line options for the task.+///+/// This property is equivalent to the `argv` array of C strings passed to a command-line tool.+@property (readonly, copy) NSArray <NSString *> *taskOptions;++/// Retrieves a URL for a given option.+///+/// Some command-line options refer to paths that indicate a location in which the module needs access to a file outside of its container.+/// FSKit passes these paths as a URL tagged by the option name.+///+/// For example, `"-B" "./someFile"` returns the URL for `./someFile` when passed an option `"B"`.+/// To indicate that your module treats a given option as a path, include it in the `pathOptions` dictionary within a command options dictionary (`FSActivatOptionSyntax`, `FSCheckOptionSyntax`, or `FSFormatOptionSyntax`).+/// This dictionary uses the command option name as a key, and each entry has a value indicating what kind of entry to create.+///+/// - Parameter option: The option for which to retrieve the URL. This value doesn't include leading dashes.+- (NSURL * _Nullable)urlForOption:(NSString *)option;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSUnaryFileSystem.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSUnaryFileSystem.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSUnaryFileSystem.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSUnaryFileSystem.h2025-02-11 06:12:25@@ -0,0 +1,78 @@+//+// Copyright (c) 2022-2023 Apple Inc. All rights reserved.+//+// FSUnaryFileSystem.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSFileSystemBase.h>+#import <FSKit/FSResource.h>++NS_ASSUME_NONNULL_BEGIN++/// An abstract base class for implementing a minimal file system.+///+/// `FSUnaryFileSystem` is a simplified file system, which works with one ``FSResource`` and presents it as one ``FSVolume``.+///+/// The one volume and its container have a shared state and lifetime, a more constrained life cycle than the ``FSFileSystem`` design flow.+///+/// Implement your app extension by providing a subclass of `FSUnaryFileSystem` as a delegate object.+/// Your delegate also needs to implement the ``FSUnaryFileSystemOperations`` protocol so that it can load resources.+FSKIT_API_AVAILABILITY_V1+@interface FSUnaryFileSystem : NSObject <FSFileSystemBase>++@end++/// Operations performed by a unary file system.+///+/// Make sure your subclass of ``FSUnaryFileSystem`` conforms to this protocol.+FSKIT_API_AVAILABILITY_V1+@protocol FSUnaryFileSystemOperations <NSObject>++/// Requests that the file system probe the specified resource.+///+/// Implement this method to indicate whether the resource is recognizable and usable.+/// - Parameters:+/// - resource: The ``FSResource`` to probe.+/// - replyHandler: A block or closure that your implementation invokes when it finishes the probe or encounters an error. Pass an instance of ``FSProbeResult`` with probe results as the first parameter if your probe operation succeeds. If probing fails, pass an error as the second parameter.+-(void)probeResource:(FSResource *)resource+ replyHandler:(void(^)(FSProbeResult * _Nullable result,+ NSError * _Nullable error))replyHandler FSKIT_API_AVAILABILITY_V1 NS_SWIFT_NAME(probeResource(resource:replyHandler:));++/// Requests that the file system load a resource and present it as a volume.+///+/// Implement this method by inspecting the provided resource and verifying it uses a supported format.+/// If the resource does use a supported format, create a subclass of `FSVolume`, clear the container error state, and invoke the `reply` callback, passing your volume as a parameter.+/// If loading can't proceed, invoke `reply` and send an appropriate error as the second parameter.+///+/// - Parameters:+/// - resource: An ``FSResource`` to load.+/// - options: An ``FSTaskOptions`` object specifying options to apply when loading the resource. An ``FSUnaryFileSystem`` supports two options: `-f` for "force" and `--rdonly` for read-only. The file system must remember if the read-only option is present.+/// - replyHandler: A block or closure that your implementation invokes when it finishes setting up or encounters an error. Pass a subclass of `FSVolume` as the first parameter if loading succeeds. If loading fails, pass an error as the second parameter.+-(void)loadResource:(FSResource *)resource+ options:(FSTaskOptions *)options+ replyHandler:(void (^)(FSVolume * _Nullable volume,+ NSError * _Nullable err))replyHandler NS_SWIFT_NAME(loadResource(resource:options:replyHandler:)) FSKIT_API_AVAILABILITY_V1;++/// Requests that the file system unload the specified resource.+///+/// - Parameters:+/// - resource: An ``FSResource`` to unload.+/// - options: An ``FSTaskOptions`` object specifying options to apply when unloading the resource.+/// - reply: A block or closure that your implementation invokes when it finishes unloading or encounters an error. If unloading fails, pass an error as the parameter to describe the problem. Otherwise, pass `nil`.+-(void)unloadResource:(FSResource *)resource+ options:(FSTaskOptions *)options+ replyHandler:(void (^)(NSError * _Nullable err))reply NS_SWIFT_NAME(unloadResource(resource:options:replyHandler:)) FSKIT_API_AVAILABILITY_V1;++@optional+/// Notifies you that the system finished loading your file system extension.+///+/// The system performs this callback after the main run loop starts and before receiving the first message from the FSKit daemon.+///+/// Implement this method if you want to perform any setup prior to receiving FSKit callbacks.+-(void)didFinishLoading FSKIT_API_AVAILABILITY_V1;++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolume.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolume.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolume.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolume.h2025-02-11 06:12:25@@ -0,0 +1,1182 @@+//+// Copyright (c) 2022 Apple Inc. All rights reserved.+//+// FSVolume.h+// FSKit+//++#import <Foundation/Foundation.h>+#import <FSKit/FSKitDefines.h>+#import <FSKit/FSEntityIdentifier.h>+#import <FSKit/FSItem.h>+#import <FSKit/FSContainer.h>+#import <FSKit/FSFileName.h>+#import <FSKit/FSResource.h>+#import <FSKit/FSMutableFileDataBuffer.h>++NS_ASSUME_NONNULL_BEGIN++FSKIT_API_AVAILABILITY_V1+typedef uint64_t FSDirectoryCookie NS_TYPED_EXTENSIBLE_ENUM;++FSKIT_API_AVAILABILITY_V1+FS_EXPORT FSDirectoryCookie const FSDirectoryCookieInitial;++FSKIT_API_AVAILABILITY_V1+typedef uint64_t FSDirectoryVerifier NS_TYPED_EXTENSIBLE_ENUM;++FSKIT_API_AVAILABILITY_V1+FS_EXPORT FSDirectoryVerifier const FSDirectoryVerifierInitial;++FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSInteger, FSDeactivateOptions) {+ FSDeactivateOptionsForce = 1 << 0+};++/**+ * @typedef FSSyncFlags+ * Flags for synchronizeWithFlags based on the flags defined in mount.h+ * More flags which are not a part of this API can be used in the kernel, so+ * the flags are defined as options rather than an enum.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(NSInteger, FSSyncFlags) {+ FSSyncFlagsWait = 1, /* synchronized I/O file integrity completion */+ FSSyncFlagsNoWait = 2, /* start all I/O, but do not wait for it */+ FSSyncFlagsDWait = 4, /* synchronized I/O data integrity completion */+};++/*+ * FSVolumeIdentifier - data identifying a volume+ *+ * For most volumes, these data are the bytes of the UUID+ * identifying the volume. Network file systems may access the same+ * underlying volume using different authentication credentials. As+ * such, volume identifiers for those volumes add qualifying data indicative+ * of the specific container. Developers should not subclass this class.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.Identifier)+@interface FSVolumeIdentifier : FSEntityIdentifier+@end+++/**+ * For each item found during directory enumeration, we always require a few pieces of information (item's+ * name, type, identifier (inode number), enumeration cookie).+ * Some directory enumerations also require other attributes, and those calls will supply an FSItemGetAttributesRequest.+ * These pieces of information are reported to FSKit by the volume implementation making a call to the packer object,+ * passing in the needed information. The cookie is an identifier which an enumerating application can use to+ * resume an enumeration. Specifically, for each enumerated item, the cookie is the value to pass into a future+ * enumeration to resume it with the item NEXT AFTER the current one.+ */+FSKIT_API_AVAILABILITY_V1+@interface FSDirectoryEntryPacker : NSObject++-(instancetype)init NS_UNAVAILABLE;++/**+ * @method packEntryWithName:itemType:itemID:nextCookie:attributes:+ * This method should be called during the enumerateDirectory method, for each directory entry that the file system would like to return.+ * @param name item's name.+ * @param itemType item's type.+ * @param itemID item's ID.+ * @param nextCookie indicates the cookie value appropriate for resuming the enumeration at the next entry+ * @param attributes item's attributes. Should be nil if no attributes were requested.+ * @return YES Continue to the next entry, else NO.+ *+ * Example usage (an example how to pack multiple directory entries in a for loop)+```+ -(void)packDirectoryEntries:(FSDirectoryEntryPacker *)packer+ withEntries:(NSArray <FSFileName *> *)entries+ {+ FSItemAttributes *attrs = [[FSItemAttributes alloc] init];+ for (FSFileName *name in entries) {+ if([packer packEntryWithName:name+ itemType:FSItemTypeFile+ itemID:0+ nextCookie:0+ attributes:attrs] == NO) {+ break;+ }+ }+ }+```+ *+ */+-(BOOL)packEntryWithName:(FSFileName *)name+ itemType:(FSItemType)itemType+ itemID:(FSItemID)itemID+ nextCookie:(FSDirectoryCookie)nextCookie+ attributes:(FSItemAttributes * _Nullable)attributes+NS_SWIFT_NAME(packEntry(name:itemType:itemID:nextCookie:attributes:))+FSKIT_API_AVAILABILITY_V1;++@end++/**+ * @typedef FSVolumeCaseFormat+ * Case-sensitivity status reported as part of FSVolumeSupportedCapabilities.+ * (A case-sensitive volume is a volume which treats upper and lower case characters in file and directory+ * names as different).+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(NSInteger, FSVolumeCaseFormat) {+ /** Volume is case sensitive */+ FSVolumeCaseFormatSensitive = 0,+ /** Volume is NOT case sensitive */+ FSVolumeCaseFormatInsensitive = 1,+ /** Volume is NOT case sensitive, but supports preserving the case of file and directory names. */+ FSVolumeCaseFormatInsensitiveCasePreserving = 2+} NS_SWIFT_NAME(FSVolume.CaseFormat);++/**+ * @interface FSVolumeSupportedCapabilities+ * An object to group all volume capabilities.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.SupportedCapabilities)+@interface FSVolumeSupportedCapabilities : NSObject<NSSecureCoding>++/** Supports persistent object identifiers and can look up file system objects by their IDs. */+@property (nonatomic) BOOL supportsPersistentObjectIDs;++/** Supports symbolic links */+@property (nonatomic) BOOL supportsSymbolicLinks;++/** Supports hard links */+@property (nonatomic) BOOL supportsHardLinks;++/** Supports a journal used to speed recovery in case of unplanned restart (such as a power outage or crash). This does not necessarily mean the volume is actively using a journal. */+@property (nonatomic) BOOL supportsJournal;++/** Supports active journal using a journal for speedy recovery after an unplanned restart. */+@property (nonatomic) BOOL supportsActiveJournal;++/** Does not store reliable times for the root directory */+@property (nonatomic) BOOL doesNotSupportRootTimes;++/** Supports sparse files, that is, files which can have 'holes' that have never been written to, and thus do not consume space on disk. */+@property (nonatomic) BOOL supportsSparseFiles;++/** Supports zero runs, the volume keeps track of allocated but unwritten runs of a file so that it can substitute zeroes without actually writing zeroes to the media. */+@property (nonatomic) BOOL supportsZeroRuns;++/** Supports fast statFS, hints to upper layers to indicate that statfs(2) is fast enough that its results need not be cached by the caller. */+@property (nonatomic) BOOL supportsFastStatFS;++/** Supports file sizes larger than 4GB, and potentially up to 2TB */+@property (nonatomic) BOOL supports2TBFiles;++/** Supports open deny modes (e.g., "open for read write, deny write"). */+@property (nonatomic) BOOL supportsOpenDenyModes;++/** Supports the `UF_HIDDEN` file flag */+@property (nonatomic) BOOL supportsHiddenFiles;++/** Does not support determining values for total data blocks, available blocks, or free blocks, as in f_blocks, f_bavail, and f_bfree in the struct statFS returned by statfs(2). */+@property (nonatomic) BOOL doesNotSupportVolumeSizes;++/** Supports 64-bit object IDs, Uses object IDs that are 64-bit. */+@property (nonatomic) BOOL supports64BitObjectIDs;++/** Supports document IDs (an ID which persists across object ID changes) for document revisions. */+@property (nonatomic) BOOL supportsDocumentID;++/** Does not support setting the UF_IMMUTABLE flag */+@property (nonatomic) BOOL doesNotSupportImmutableFiles;++/** Does not support setting file permissions */+@property (nonatomic) BOOL doesNotSupportSettingFilePermissions;++/** Supports having multiple logical file systems in a single "partition" which share space. */+@property (nonatomic) BOOL supportsSharedSpace;++/** Supports having multiple logical file systems which may be mounted and unmounted together and may present common file system identifier information. */+@property (nonatomic) BOOL supportsVolumeGroups;++/** Whether the volume is case sensitive or not. */+@property (nonatomic) FSVolumeCaseFormat caseFormat;++@end++/// A directory structure for files and folders.+///+/// A file system, depending on its type, provides one or more volumes to clients.+/// The ``FSUnaryFileSystem`` by definition provides only one volume, while an ``FSFileSystem`` supports multiple volumes.+///+/// You implement a volume for your file system type by subclassing this class, and also conforming to the ``FSVolume/Operations`` protocol.+/// This protocol defines the minimum set of operations supported by a volume, such as mounting, activating, creating and removing items, and more.+///+/// Your volume can provide additional functionality by conforming to other volume operations protocols.+/// These protocols add support for operations like open and close, read and write, extended attribute (Xattr) manipulation, and more.+///+FSKIT_API_AVAILABILITY_V1+@interface FSVolume : NSObject++@property (strong, readonly) FSVolumeIdentifier *volumeID;++@property (copy) FSFileName *name;++-(instancetype)init NS_UNAVAILABLE;++-(instancetype)initWithVolumeID:(FSVolumeIdentifier *)volumeID+ volumeName:(FSFileName *)volumeName NS_DESIGNATED_INITIALIZER;++@end++/*+ * FSVolumePathConfOperations+ *+ * This protocol gathers properties related to the pathfonf and fpathconf+ * system calls. They are included in FSVolumeOperations and are gathered here as+ * they behave differently than the operations added in FSVolumeOperations. These+ * properties return the value imposed by the file system for the given property. For+ * files, this value applies to the file. For directories, this value applies to+ * all of the items in the directory.+ *+ * Some values are booleans while other values are numeric. Numeric limits+ * use -1 to represent no limit.+ *+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.PathConfOperations)+@protocol FSVolumePathConfOperations <NSObject>++// The maximum number of hard links to the object.+@property (readonly) NSInteger maximumLinkCount;++// The maximum length of a component of a filename.+@property (readonly) NSInteger maximumNameLength;++// if TRUE, file system will reject chown(2) calls if not superuser.+@property (readonly) BOOL restrictsOwnershipChanges;++// If TRUE, file system will truncate the filename to maximumNameLength if filename is longer than maximumNameLength.+// If FALSE, file system will return ENAMETOOLONG if filename is longer than maximumNameLength.+@property (readonly) BOOL truncatesLongNames;++@optional++/*+ * maximum xattr size properties:+ * One of maximumXattrSize, maximumXattrSizeInBits must be implemented. FSKit+ * will convert from one to another if needed. In case both maximumXattrSize+ * and maximumXattrSizeInBits are implemented, FSKit will only use the+ * maximumXattrSizeInBits implementation.+ */++// The maximum extended attribute size in bytes.+@property (readonly) NSInteger maximumXattrSize;++// The number of bits used to store maximum extended attribute size in bytes.+@property (readonly) NSInteger maximumXattrSizeInBits;++/*+ * maximum file size properties:+ * One of maximumFileSize, maximumFileSizeInBits must be implemented. FSKit+ * will convert from one to another if needed. In case both maximumFileSize+ * and maximumFileSizeInBits are implemented, FSKit will only use the+ * maximumFileSizeInBits implementation.+ */++// The maximum size of a regular file allowed in the volume.+@property (readonly) uint64_t maximumFileSize;++/*+ * The minimum number of bits needed to represent, as a signed integer value,+ * the maximum size of a regular file allowed in the volume.+ * The maximum file size is 2^(maximumFileSizeInBits - 1).+ *+ * Maximum file size (bytes) Maximum (in hex) Unsigned bits Signed bits+ * 65,535 0xFFFF 16 17+ * 2,147,483,647 0x7FFFFFFF 31 32+ * 4,294,967,295 0xFFFFFFFF 32 33+ * 18,446,744,073,709,551,615 0xFFFFFFFFFFFFFFFF 64 65+ */+@property (readonly) NSInteger maximumFileSizeInBits;++@end++/**+ * FSStatFSResult - An interface used to report `volumeStatistics`.+ * Names are taken from `struct statfs` in `statfs(2)`.+ * These values will be reported to `statfs(2)` result.+ * All properties have a default value of 0. The file system should override these values, unless it has no+ * meaningful values to override with.+ * One exception is the fileSystemTypeName, which is readonly, and should be set using the designated initializer.+ */+FSKIT_API_AVAILABILITY_V1+@interface FSStatFSResult : NSObject <NSSecureCoding>++/** Block size, in bytes, of the volume */+@property NSInteger blockSize;+/** Optimal block size to perform I/O with.+ * Should be an even multiple of the block size. */+@property NSInteger ioSize;+/** Total data blocks in volume */+@property uint64_t totalBlocks;+/** Free blocks avail to non-superuser */+@property uint64_t availableBlocks;+/** Free blocks in volume */+@property uint64_t freeBlocks;+/** Used blocks in volume */+@property uint64_t usedBlocks;+/** Total size, in bytes, of the volume */+@property uint64_t totalBytes;+/** The amount of space available to users, in bytes, in the volume */+@property uint64_t availableBytes;+/** The amount of free space, in bytes, in the volume */+@property uint64_t freeBytes;+/** The amount of used space, in bytes, in the volume */+@property uint64_t usedBytes;+/** The total number of file slots in the volume */+@property uint64_t totalFiles;+/** The total number of free file slots in the volume */+@property uint64_t freeFiles;+/** File system sub-type (flavor).+ * Should match the FSPersonalities's FSSubType attribute, if exists (within the EXAppExtensionAttributes+ * dictionary of the module\`s Info.plist). */+@property NSInteger fileSystemSubType;+/** File system type name.+ * Should match the FSShortName attribute within the EXAppExtensionAttributes dictionary of the module\`s+ * Info.plist. Maximal allowed length is `MFSTYPENAMELEN`, including NUL. */+@property (readonly, copy) NSString * fileSystemTypeName;++- (instancetype)initWithFileSystemTypeName:(NSString *)fileSystemTypeName;++- (instancetype)init NS_UNAVAILABLE;++@end++FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.Operations)+@protocol FSVolumeOperations <NSObject, FSVolumePathConfOperations>++/**+ * supportedVolumeCapabilities+ *+ * report FSVolumeSupportedCapabilities data.+ * @return an FSVolumeSupportedCapabilities object, with the volume's supported capabilities.+ */+@property (readonly, nonatomic) FSVolumeSupportedCapabilities *supportedVolumeCapabilities;++/**+ * volumeStatistics+ *+ * report FSKitStatFSResult data.+ * @return an FSKitStatFSResult object, with up-to-date volume statistics.+ */+@property (readonly, nonatomic) FSStatFSResult * volumeStatistics;++/**+ * mountWithOptions:replyHandler:+ *+ * @brief Some process is trying to mount this volume.+ * @param reply In case of success, should be called with the newly created root item and error = nil.+ * Otherwise, should be called with the relevant error. In that case, rootItem is ignored.+ */+@optional+-(void)mountWithOptions:(FSTaskParameters *)options+ replyHandler:(void(^)(FSItem * _Nullable rootItem,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(mount(options:replyHandler:));+-(void)mountWithParameters:(FSTaskParameters *)options+ replyHandler:(void(^)(FSItem * _Nullable rootItem,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(mount(parameters:replyHandler:));++@required+/**+ * unmountWithReplyHandler:+ *+ * @brief file system is being unmounted. All cached state should be cleaned and flushed.+ * @param reply should be called with the relevant error, or nil in case of success.+ */+-(void)unmountWithReplyHandler:(void(^)(void))reply+NS_SWIFT_NAME(unmount(replyHandler:));++/**+ * synchronizeWithFlags:replyHandler:+ *+ * @brief sync the volume.+ * After calling this method, FSKit assumes that the volume+ * has sent all pending IOs or metadata to the underlying resource.+ * @param flags Waitfor flags as defined in mount.h. These flags let the+ * backend know whether to run the operation in a blocking or a+ * non blocking way.+ * @param reply should be called with the relevant error, or nil in case of success.+ */+-(void)synchronizeWithFlags:(FSSyncFlags)flags+ replyHandler:(void(^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(synchronize(flags:replyHandler:));++/**+ * getAttributes:ofItem:replyHandler:+ *+ * @brief Fetch the item attributes for the given FSItem.+ * @param desiredAttributes requested set of attributes to get.+ * A given attribute, ATTR, is requested In case <ATTR>Wanted is set.+ * @param item item to get the attributes for.+ * @param reply In case of success, should be called with the requested attrs and error = nil.+ * Otherwise, should be called with the relevant error. In that case, attributes is ignored.+ * @discussion For file systems that do not support hard links,+ * linkCount should be 1 for regular files and symbolic links.+ * In case the item's bsdFlags contain the UF_COMPRESSED flag,+ * the file system should return the uncompressed size of the file.+ */+-(void)getAttributes:(FSItemGetAttributesRequest *)desiredAttributes+ ofItem:(FSItem *)item+ replyHandler:(void(^)(FSItemAttributes * _Nullable attributes,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(getAttributes(_:of:replyHandler:))+NS_SWIFT_ASYNC_NAME(attributes(_:of:));++/**+ * setAttributes:onItem:replyHandler:+ *+ * @brief Set the given set of item attributes to the given FSItem.+ * @param newAttributes FSItemSetAttributesRequest including the attributes to set+ * @param item item to set the attributes for.+ * @param reply In case of success, should be called with the item's updated attrs+ * (using the same semantics as the getItemAttributes call) and error = nil.+ * Otherwise, should be called with the relevant error. In that case, attributes is ignored.+ * @discussion Note that several attributes are considered to be "read-only",+ * and attempts to set those attributes should result in an error of EINVAL being returned.+ * If "size" is set beyond the end of file and the underlying file system does not support+ * sparse files, space to fulfill the new file size must be allocated and either zero-filled+ * or otherwise configured to read as zeros.+ * If "size" is set below the current end of file, the file shall be truncated and any space+ * no longer required to fulfill the new file size must be returned to the file system as+ * free space. Attempts to set "size" on directories and symbolic links must+ * be ignored (and no error should be returned). If the caller attempts to set+ * an attribute not supported by the on-disk file system format, no error should+ * be returned; instead, that situation will be detected by the upper layers.+ */+-(void)setAttributes:(FSItemSetAttributesRequest *)newAttributes+ onItem:(FSItem *)item+ replyHandler:(void(^)(FSItemAttributes * _Nullable attributes,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(setAttributes(_:on:replyHandler:));++/**+ * lookupItemNamed:inDirectory:replyHandler:+ *+ * @brief Lookup an item within a directory.+ * @param name item name to lookup.+ * @param directory directory to look the item in.+ * @param reply In case of success, should be called with the found item,+ * the item name (as it's saved within the file system), and error = nil.+ * Otherwise, should be called with the relevant error. In that case, theItem and itemName are ignored.+ * If the entry does not exist, complete the request with an error+ * with a domain of NSPOSIXErrorDomain and a code of ENOENT.++ */+-(void)lookupItemNamed:(FSFileName *)name+ inDirectory:(FSItem *)directory+ replyHandler:(void(^)(FSItem * _Nullable theItem,+ FSFileName * _Nullable itemName,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(lookupItem(named:inDirectory:replyHandler:));++/**+ * reclaimItem:replyHandler:+ *+ * @brief Reclaim an item. Releases any resources allocated for the item.+ * @param item item to reclaim.+ * @param reply In case of success, should be called with error = nil.+ * Otherwise, should be called with the relevant error.+ * Anyway, the resources allocated for this item should be released.+ * @discussion FSKit guarantees that for every FSItem returned by the volume,+ * a corresponding reclaim operation will occur once the upper layers no longer+ * reference that item.+ *+ * Note: block device file systems may wish to assess if the underlying resource has been terminated+ * before processing reclaim operations. On Unary file systems, it is especially easy to assess. When such+ * resources are disconnected from the system, the associated volumes are unmounted. Unmount triggers+ * reclaiming of all items, and some implementations have benefited greatly from short-circuiting reclaim+ * in such cases. As the resource has been terminated, all I/O will report an error, and it's easiest to just+ * avoid the work.+ */+-(void)reclaimItem:(FSItem *)item+ replyHandler:(void(^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(reclaimItem(_:replyHandler:));++/**+ * readSymbolicLink:replyHandler:+ *+ * Read a symbolic link.+ *+ * @param item symbolic link item to read from. Guaranteed to be of type FSItemTypeSymlink.+ * @param reply In case of success, should be called with the link's contents+ * and error = nil. Otherwise, should be called with the relevant+ * error. In that case, contents is ignored.+ */+-(void)readSymbolicLink:(FSItem *)item+ replyHandler:(void(^)(FSFileName * _Nullable contents,+ NSError * _Nullable error))reply;++/**+ * createItemNamed:type:inDirectory:attributes:replyHandler:+ *+ * @brief Create a new file or directory item.+ * @param name new item's name.+ * @param type new item's type. Valid options are FSItemTypeFile, FSItemTypeDirectory.+ * @param directory directory to create the item in.+ * @param newAttributes Desired set of attributes for the new item.+ * @param reply In case of success, should be called with the created item, the+ * item name (as it's saved within the file system), and error = nil.+ * Otherwise, should be called with the relevant error. In that+ * case, newItem and newItemName are ignored. In case there's+ * already an item named "name" in the directory, complete the+ * request with an error with a domain of NSPOSIXErrorDomain and a+ * code of EEXIST.+ */+-(void)createItemNamed:(FSFileName *)name+ type:(FSItemType)type+ inDirectory:(FSItem *)directory+ attributes:(FSItemSetAttributesRequest *)newAttributes+ replyHandler:(void(^)(FSItem * _Nullable newItem,+ FSFileName * _Nullable newItemName,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(createItem(named:type:inDirectory:attributes:replyHandler:));++/**+ * createSymbolicLinkNamed:inDirectory:attributes:linkContents:replyHandler:+ *+ * @brief Create a new symbolic link.+ * @param name new item's name.+ * @param directory directory to create the item in.+ * @param newAttributes Desired set of attributes for the new item.+ * @param contents Contents of the new symbolic link.+ * @param reply In case of success, should be called with the created item, the+ * item name (as it's saved within the file system), and error = nil.+ * Otherwise, should be called with the relevant error. In that+ * case, newItem and newItemName are ignored. In case there's+ * already an item named "name" in the directory, complete the+ * request with an error with a domain of NSPOSIXErrorDomain and a+ * code of EEXIST.+ */+-(void)createSymbolicLinkNamed:(FSFileName *)name+ inDirectory:(FSItem *)directory+ attributes:(FSItemSetAttributesRequest *)newAttributes+ linkContents:(FSFileName *)contents+ replyHandler:(void(^)(FSItem * _Nullable newItem,+ FSFileName * _Nullable newItemName,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(createSymbolicLink(named:inDirectory:attributes:linkContents:replyHandler:));++/**+ * createLinkToItem:named:inDirectory:replyHandler:+ *+ * @brief Create a new hard link.+ * @param item existing item to link to.+ * @param name new link name.+ * @param directory directory to create the link in.+ * @param reply In case of success, should be called with the link name (as it's saved within the+ * file system) with error = nil. Otherwise, complete the request with linkName = nil, and an+ * error with a domain of NSPOSIXErrorDomain, and the following error code:+ * EEXIST, in case there's already an item named "name" in the directory.+ * EMLINK, if creating the hard link would result in exceeding the maximum number of hard+ * links supported on item.+ * ENOTSUP, if the file system does not support creating hard links to the type of file system+ * object represented by item.+ */+-(void)createLinkToItem:(FSItem *)item+ named:(FSFileName *)name+ inDirectory:(FSItem *)directory+ replyHandler:(void(^)(FSFileName * _Nullable linkName,+ NSError * _Nullable error))reply;++/**+ * removeItem:named:inDirectory:replyHandler:+ *+ * @brief Remove an existing item.+ * @param item item to remove.+ * @param name item name.+ * @param directory directory to remove the item from.+ * @param reply In case of success, should be called with error = nil.+ * Otherwise, should be called with the relevant error.+ * @discussion This method shouldn't actually remove the item object itself, but+ * only remove the given item name from the given directory.+ * The item object should be removed (=deallocated) on reclaimItem.+ */+-(void)removeItem:(FSItem *)item+ named:(FSFileName *)name+ fromDirectory:(FSItem *)directory+ replyHandler:(void(^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(removeItem(_:named:fromDirectory:replyHandler:));++/**+ * renameItem:inDirectory:named:toNewName:inDirectory:overItem:replyHandler:+ *+ * @brief This method is used to rename a file system object from one path in the file system to another.+ * @param item The actual file system object being renamed.+ * @param sourceDirectory The directory that currently contains the file system object being renamed.+ * @param sourceName The name within sourceDirectory of the file system object being renamed.+ * @param destinationName The new name of the file system object being renamed within destinationDirectory.+ * @param destinationDirectory The directory that will contain the renamed file system object.+ * Note that this *may* be equal to sourceDirectory.+ * @param overItem The file system object if destination exists and has been looked-up before. Could be nil.+ * In case it is non-nil, it should be marked as 'deleted', so we would free its allocated+ * space on the next reclaim. After doing so, the operation must finish without errors.+ * @param reply In case of success, should be called with the item name (as it's saved within the file system), and error = nil.+ * Otherwise, should be called with the relevant error. In that case, newName is ignored.+ * @discussion The basic algorithm is as follows:+ *+ * If a file move:+ * -- If the destination file exists:+ * -- Remove the destination file.+ * -- If source and destination are in the same directory:+ * -- Rewrite name in existing directory entry.+ * else:+ * -- Write new entry in destination directory.+ * -- Clear old directory entry.+ *+ * If a directory move:+ * -- If destination directory exists:+ * -- If destination directory is not empty, fail the operation+ * with an error with a domain of NSPOSIXErrorDomain and a code of ENOTEMPTY.+ * -- Remove the destination directory.+ * -- If source and destination are in the same directory:+ * -- Rewrite name in existing directory entry.+ * else:+ * -- Be sure the destination is not a child of the source.+ * -- Write new entry in destination directory.+ * -- Update "." and ".." in the moved directory.+ * -- Clear old directory entry.+ */+-(void)renameItem:(FSItem *)item+ inDirectory:(FSItem *)sourceDirectory+ named:(FSFileName *)sourceName+ toNewName:(FSFileName *)destinationName+ inDirectory:(FSItem *)destinationDirectory+ overItem:(FSItem * _Nullable)overItem+ replyHandler:(void(^)(FSFileName * _Nullable newName,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(renameItem(_:inDirectory:named:to:inDirectory:overItem:replyHandler:));++/**+ * enumerateDirectory:startingAtCookie:verifier:providingAttributes:usingPacker:replyHandler:+ *+ * @brief Enumerate the given directory. Called on readdir(3) and getattrlistbulk(2).+ * Directory entries are returned using the packer's packEntryWithName method.+ * Look at FSDirectoryEntryPacker's definition for further explanation.+ * @param directory directory to enumerate. Guaranteed to be of type FSItemTypeDirectory.+ * @param cookie used to indicate the location within the directory to enumerate from. The cookie values+ * are chosen by the developer; they're opaque to FSKit. The first enumerateDirectory+ * call will have cookie = FSDirectoryCookieInitial. The following calls will have+ * cookie = the "nextCookie" of the last directory entry packed in the previous call.+ * @param verifier a tool with which the developer can use to detect if the directory has been changed+ * since the previous call to enumerateDirectory. The verifier values are chosen by the+ * developer; they're opaque to FSKit. The first enumerateDirectory call will have+ * verifier = FSDirectoryVerifierInitial. The following calls will have verifier = the+ * "currentVerifier" returned from the previous call.+ * @param attributes desired set of attributes to provide. Nil in case no attributes are required.+ * @param packer packer object to pack the directory entries with.+ * @param reply In case of success, should be called with the current verifier and error = nil.+ * Otherwise, should be called with the relevant error. In that case, currentVerifier is ignored.+ * @discussion The general flow of a enumerateDirectory is as follows:+ * When an enumeration is started, enumerateDirectory will be called with initial cookie and+ * verifier values. After packing the initial set of directory entries, enumerateDirectory replies+ * with the new verifier, a non-zero value that reflects the directory's current version.+ * When next called, the next set of directory entries should be packed, starting with the entry+ * associated with cookie. If cookie does not resolve to a valid directory entry, complete the+ * request with an error with a domain of FSKitErrorDomain and a code of+ * FSErrorInvalidDirectoryCookie.+ *+ * The volume implementation must ensure that the directory entries' names packed+ * are acceptable and unambiguous input to all file operations that take names+ * (like lookupName) without additional normalization.+ *+ * Note: In case providingAttributes is nil, there should always be at least two+ * entries in a directory: "." (an entry representing the current directory)+ * and ".." (an entry representing the parent directory).+ * These entries' type is FSItemTypeDirectory. In the case of the root directory+ * of the file system, the returned "." and ".." should have identical contents.+ * In case providingAttributes is not nil, "." and ".." should not be returned.+ */+-(void)enumerateDirectory:(FSItem *)directory+ startingAtCookie:(FSDirectoryCookie)cookie+ verifier:(FSDirectoryVerifier)verifier+ providingAttributes:(FSItemGetAttributesRequest * _Nullable)attributes+ usingPacker:(FSDirectoryEntryPacker *)packer+ replyHandler:(void(^)(FSDirectoryVerifier currentVerifier,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(enumerateDirectory(_:startingAt:verifier:attributes:packer:replyHandler:));++/**+ * activateWithOptions:replyHandler:+ *+ * @brief This method is used to activate this volume instance.+ * @param options activation options. None are currently defined.+ * @param reply In case of success, should be called with the root FSItem, and error = nil.+ * Otherwise, should be called with the relevant error. In that case, rootItem is ignored.+ * @discussion The volume should allocate any in-memory state required to represent the file system.+ * The volume should allocate an item for the root directory of the file system, and pass it to+ * the reply block. FSKit will cache the root item for the lifetime of the volume instance and+ * use it as the jumping off point for all file lookups.+ */+@optional+-(void)activateWithOptions:(FSTaskParameters *)options+ replyHandler:(void (^)(FSItem * _Nullable rootItem,+ NSError * _Nullable err))reply+NS_SWIFT_NAME(activate(options:replyHandler:));+-(void)activateWithParameters:(FSTaskParameters *)parameters+ replyHandler:(void (^)(FSItem * _Nullable rootItem,+ NSError * _Nullable err))reply+NS_SWIFT_NAME(activate(parameters:replyHandler:));++@required+/**+ * deactivateWithOptions:replyHandler:+ *+ * @brief This method is used to tear down a previously-initialized volume instance.+ * @param options de-activation options. None are currently defined.+ * @param reply In case of success, should be called with error = nil.+ * Otherwise, should be called with the relevant error.+ * @discussion The volume should release any resources allocated for the volume instance.+ * FSKit will guarantee that all other file nodes associated with this file system+ * instance will have been released by a reclaim call. This method should not+ * need to perform any I/O; in cases where that is desired, FSKit will have+ * already issued a sync call to perform cleanup-related I/O.+ */+-(void)deactivateWithOptions:(FSDeactivateOptions)options+ replyHandler:(void (^)(NSError * _Nullable err))reply+NS_SWIFT_NAME(deactivate(options:replyHandler:));++@end++/**+ * @typedef FSSetXattrPolicy+ * Different flags to dictate the setxattr policy.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(NSUInteger, FSSetXattrPolicy) {+ FSSetXattrPolicyAlwaysSet = 0, /* set the value regardless of previous state */+ FSSetXattrPolicyMustCreate = 1, /* set the value, fail if xattr already exists */+ FSSetXattrPolicyMustReplace = 2, /* set the value, fail if xattr does not exist */+ FSSetXattrPolicyDelete = 3 /* delete the value, fail if xattr does not exist */+} NS_SWIFT_NAME(FSVolume.SetXattrPolicy);++/**+ * @protocol FSVolumeXattrOperations+ * A protocol for volumes which natively (or partially) support extended attributes.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.XattrOperations)+@protocol FSVolumeXattrOperations <NSObject>++/**+ * @property xattrOperationsInhibited+ * Should be set to 'true' to prevent FSKit from calling this protocol's+ * methods, even though the volume conforms to it.+ * FSKit reads this value (if implemented) after the file system module replies to `loadResource:`.+ * Changing it during the runtime of the volume won't have an effect.+ */+@optional+@property BOOL xattrOperationsInhibited;++/**+ * supportedXattrNamesForItem:+ * @brief Returns an array that specifies the Xattr names supported by the given item.+ * If the given item does not support any Xattrs, nil should be returned.+ * @param item item to get the info for.+ * @discussion Should only be implemented by volumes which want to have "limited" extended attributes+ * support (volumes which fundamentally do not support extended attributes, but use+ * the extended attribute APIs to expose specific file system data).+ * Note: If implemented, FSKit would assume that there's a partial xattr support, and would+ * only call this protocol's methods for xattr names returned by this method (for each item).+ */+-(NSArray<FSFileName *> *)supportedXattrNamesForItem:(FSItem *)item;++@required++/**+ * getXattrNamed:ofItem:replyHandler:+ *+ * @brief Get the specified extended attribute of the given item.+ * @param name extended attribute name.+ * @param item item to get the extended attribute of.+ * @param reply In case of success, should be called with the xattr value, and error = nil.+ * Otherwise, should be called with the relevant error. In that case, value is ignored.+ * In case the given attribute does not exist, complete the request with an error with+ * a domain of NSPOSIXErrorDomain and a code of ENOATTR.+ * @discussion Will only be called for extended attributes supported by the given item.+ */+-(void)getXattrNamed:(FSFileName *)name+ ofItem:(FSItem *)item+ replyHandler:(void (^)(NSData * _Nullable value,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(getXattr(named:of:replyHandler:))+NS_SWIFT_ASYNC_NAME(xattr(named:of:));++/**+ * setXattrNamed:toData:onItem:policy:replyHandler:+ *+ * @brief Set the specified extended attribute to item.+ * @param name extended attribute name.+ * @param value extended attribute value. It can only be nil in case policy = FSSetXattrPolicyDeleteXattr.+ * @param item item to set the extended attribute to.+ * @param policy creation policy. See FSSetXattrPolicy for further documentation.+ * @param reply In case of success, should be called with error = nil.+ * Otherwise, should be called with the relevant error.+ */+-(void)setXattrNamed:(FSFileName *)name+ toData:(NSData * _Nullable)value+ onItem:(FSItem *)item+ policy:(FSSetXattrPolicy)policy+ replyHandler:(void (^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(setXattr(named:to:on:policy:replyHandler:));++/**+ * listXattrsOfItem:replyHandler:+ *+ * @brief Get the list of extended attributes currently set on the given item.+ * @param item item to get the xattr list for.+ * @param reply In case of success, should be called with the xattr list, and error = nil.+ * Otherwise, should be called with the relevant error. In that case, value is ignored.+ * In case the item doesn't have any extended attributes, reply should be called with an+ * empty array, and error = nil.+ */+-(void)listXattrsOfItem:(FSItem *)item+ replyHandler:(void (^)(NSArray <FSFileName *> * _Nullable value,+ NSError * _Nullable error))reply+NS_SWIFT_ASYNC_NAME(xattrs(of:));++@end++FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSUInteger, FSVolumeOpenModes) {+ FSVolumeOpenModesRead = FREAD,+ FSVolumeOpenModesWrite = FWRITE+} NS_SWIFT_NAME(FSVolume.OpenModes);++/**+ * @protocol FSVolumeOpenCloseOperations+ * A protocol for open/close. File systems which want to receive open and+ * close calls for each item should conform to this protocol. If this protocol is not+ * implemented, the kernel layer is free to skip making such calls to the volume.+ * When this protocol is implemented, the kernel layer issues an open call to+ * indicate the desired access and a close call to indicate what access to+ * retain. A file is fully closed when the kernel layer issues a close call+ * with no retained open modes. Upon receipt of this close, the file system+ * should remove all accesses to the item. When all memory mappings to the item+ * are released, a final close will be issued by the kernel layer.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.OpenCloseOperations)+@protocol FSVolumeOpenCloseOperations <NSObject>++/**+ * @property openCloseInhibited+ * Should be set to 'true' to prevent FSKit from calling this protocol's+ * methods, even though the volume conforms to it.+ * FSKit reads this value (if implemented) after the file system module replies to `loadResource:`.+ * Changing it during the runtime of the volume won't have an effect.+ */+@optional+@property (getter = isOpenCloseInhibited) BOOL openCloseInhibited;++@required+/**+ * openItem:withMode:replyHandler:+ *+ * @brief open a file for access.+ * @param modes The set of mode flags to open the item with.+ * @param reply In case of success, should be called with error = nil.+ * Otherwise, should be called with the relevant error.+ */+-(void)openItem:(FSItem *)item+ withModes:(FSVolumeOpenModes)modes+ replyHandler:(void (^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(openItem(_:modes:replyHandler:));++/**+ * closeItem:keepingMode:replyHandler:+ *+ * @brief close a file access+ * @param modes The set of mode flags to keep after this close.+ * @param reply In case of success, should be called with error = nil.+ * Otherwise, should be called with the relevant error.+ */+-(void)closeItem:(FSItem *)item+ keepingModes:(FSVolumeOpenModes)modes+ replyHandler:(void (^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(closeItem(_:modes:replyHandler:));++@end++/**+ * @protocol FSVolumeReadWriteOperations+ * A protocol for read and write operations where we deliver data to/from the extension.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.ReadWriteOperations)+@protocol FSVolumeReadWriteOperations <NSObject>++/**+ * readFromFile:offset:length:intoBuffer:replyHandler:+ *+ * @brief Read the contents of the given file item.+ * @param item item to read the contents of. Guaranteed to be of type FSItemTypeFile.+ * @param offset offset in file to start reading from.+ * @param length amount of bytes to read.+ * @param buffer buffer to store the result in.+ * @param reply In case of success, should be called with the amount of bytes read, and error = nil.+ * Otherwise, should be called with the relevant error. In that case, actuallyRead should+ * still contain the amount of bytes read before the error.+ * @discussion If the number of bytes requested exceeds the number of bytes available+ * before the end of the file, then only those bytes are returned. If offset points+ * beyond the last valid byte of the file, the method exit with error = nil and+ * actuallyRead = 0.+ */+-(void)readFromFile:(FSItem *)item+ offset:(off_t)offset+ length:(size_t)length+ intoBuffer:(FSMutableFileDataBuffer *)buffer+ replyHandler:(void(^)(size_t actuallyRead,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(read(from:at:length:into:replyHandler:));++/**+ * writeContents:toFile:atOffset:replyHandler:+ *+ * @brief Write contents to the given file item.+ * @param item item to write contents to. Guaranteed to be of type FSItemTypeFile.+ * @param offset offset in file to start writing from.+ * @param contents buffer containing the contents.+ * @param reply In case of success, should be called with the amount of bytes+ * written, and error = nil. Otherwise, should be called with the+ * relevant error. In that case, actuallyWritten should still+ * contain the amount of bytes written before the error. In case+ * no part of the range was successfully written in an out-of-space+ * condition, complete the request with an error with a domain of+ * NSPOSIXErrorDomain and an error code of ENOSPC.+ * @discussion This routine is expected to allocate space in the file system to extend the file as necessary.+ * If the file system runs out of space, but succeeds in writing any part of the requested range,+ * the method should succeed and actuallyWritten should reflect the number of bytes successfully+ * written before space was exhausted.+ */+- (void)writeContents:(NSData *)contents+ toFile:(FSItem *)item+ atOffset:(off_t)offset+ replyHandler:(void(^)(size_t actuallyWritten,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(write(contents:to:at:replyHandler:));++@end++/**+ * @typedef FSAccessMask+ * A bitmask of access rights.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSUInteger, FSAccessMask) {+ FSAccessReadData = (1<<1),+ FSAccessListDirectory = FSAccessReadData,+ FSAccessWriteData = (1<<2),+ FSAccessAddFile = FSAccessWriteData,+ FSAccessExecute = (1<<3),+ FSAccessSearch = FSAccessExecute,+ FSAccessDelete = (1<<4),+ FSAccessAppendData = (1<<5),+ FSAccessAddSubdirectory = FSAccessAppendData,+ FSAccessDeleteChild = (1<<6),+ FSAccessReadAttributes = (1<<7),+ FSAccessWriteAttributes = (1<<8),+ FSAccessReadXattr = (1<<9),+ FSAccessWriteXattr = (1<<10),+ FSAccessReadSecurity = (1<<11),+ FSAccessWriteSecurity = (1<<12),+ FSAccessTakeOwnership = (1<<13),+} NS_SWIFT_NAME(FSVolume.AccessMask);++/**+ * @protocol FSVolumeAccessCheckOperations+ * A protocol for access check operations.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.AccessCheckOperations)+@protocol FSVolumeAccessCheckOperations <NSObject>++/**+ * @property accessCheckInhibited+ * Should be set to 'true' to prevent FSKit from calling this protocol's+ * methods, even though the volume conforms to it.+ * FSKit reads this value (if implemented) after the file system module replies to `loadResource:`.+ * Changing it during the runtime of the volume won't have an effect.+ */+@optional+@property (getter = isAccessCheckInhibited) BOOL accessCheckInhibited;++@required+/**+ * checkAccessToItem:requestedAccess:replyHandler:+ *+ * @brief Check if the requested access for the given item is allowed.+ * @param theItem item to check access for.+ * @param access requested set of access types to check.+ * @param reply In case of success, should be called with the result, and error = nil.+ * result = 0: access is allowed+ * result = EACCES: access is denied.+ * Otherwise, should be called with the relevant error. In that case, result is ignored.+ */+-(void)checkAccessToItem:(FSItem *)theItem+ requestedAccess:(FSAccessMask)access+ replyHandler:(void(^)(BOOL shouldAllowAccess,+ NSError * _Nullable error))reply;++@end++/**+ * @protocol FSVolumeRenameOperations+ * A protocol for volume rename operations.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.RenameOperations)+@protocol FSVolumeRenameOperations <NSObject>++/**+ * @property volumeRenameInhibited+ * Should be set to 'true' to prevent FSKit from calling this protocol's+ * methods, even though the volume conforms to it.+ * FSKit reads this value (if implemented) after the file system module replies to `loadResource:`.+ * Changing it during the runtime of the volume won't have an effect.+ */+@optional+@property (getter = isVolumeRenameInhibited) BOOL volumeRenameInhibited;++@required+/**+ * setVolumeName:replyHandler:+ *+ * @brief Set a new name for the volume.+ * @param name New volume name.+ * @param reply In case of success, should be called with the new name, and error = nil.+ * Otherwise, should be called with the relevant error. In that case, newName is ignored.+ */+-(void)setVolumeName:(FSFileName *)name+ replyHandler:(void(^)(FSFileName *newName,+ NSError * _Nullable error))reply;++@end++/**+ * @typedef FSPreallocateFlags+ * Different flags for the preallocate operations.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSUInteger, FSPreallocateFlags) {+ /** Allocate contiguous space */+ FSPreallocateFlagsContiguous = 0x00000002,+ /** Allocate all requested space or no space at all */+ FSPreallocateFlagsAll = 0x00000004,+ /** Allocate space that is not freed when close(2) is called. */+ FSPreallocateFlagsPersist = 0x00000008,+ /** Allocate from the physical end of file. Offset should be ignored in this case.+ Currently set for all `preallocateSpaceForItem` calls. */+ FSPreallocateFlagsFromEOF = 0x00000010,+} NS_SWIFT_NAME(FSVolume.PreallocateFlags);++/**+ * @protocol FSVolumePreallocateOperations+ * A protocol for preallocate operations.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.PreallocateOperations)+@protocol FSVolumePreallocateOperations <NSObject>++/**+ * @property preallocateInhibited+ * Should be set to 'true' to prevent FSKit from calling this protocol's+ * methods, even though the volume conforms to it.+ * FSKit reads this value (if implemented) after the filesystem module replies to `loadResource:`.+ * Changing it during the runtime of the volume won't have an effect.+ */+@optional+@property (getter = isPreallocateInhibited) BOOL preallocateInhibited;++/**+ * preallocateSpaceForItem:atOffset:length:flags:replyHandler:+ *+ * @brief Preallocate disk space for an item.+ * @param item The item for which to preallocate space+ * @param offset The offset from which to allocate+ * @param length The length of the space in bytes+ * @param flags Preallocate flags+ * @param reply In case of success, should be called with the amount of bytes allocated, and error = nil.+ * Otherwise, should be called with the relevant error. In that case, bytesAllocated is ignored.+ */+@required+-(void)preallocateSpaceForItem:(FSItem *)item+ atOffset:(off_t)offset+ length:(size_t)length+ flags:(FSPreallocateFlags)flags+ replyHandler:(void(^)(size_t bytesAllocated,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(preallocateSpace(for:at:length:flags:replyHandler:));++@end++/**+ * @typedef FSItemDeactivationOptions+ * Options to communicate the FSVolumeItemDeactivation policy. `deactivateItem:` processing blocks+ * the kernel, to enable the file system to take action at a definitive point in the item's life cycle.+ * FSItemDeactivationOptions allows the file system to instruct the FSKit kernel which circumstances require+ * the expense of a round trip call to the module.+ * - `FSItemDeactivationNever` causes FSKit to not issue `deactivateItem:` calls at all, even+ * though the volume conforms to `FSVolumeItemDeactivation`.+ * - `FSItemDeactivationAlways` supports cases when the file system needs `deactivateItem:`+ * calls in circumstances other than the above. If `FSItemDeactivationAlways` is set, all other option+ * bits are ignored; `deactivateItem:` calls are always issued, regardless of the other bits.+ * - `FSItemDeactivationForRemovedItems` supports processing for open-unlinked items at the+ * moment of last close.+ * - `FSItemDeactivationForPreallocatedItems` supports processing for files with preallocated+ * space, facilitating a form of trim-on-close. Only has a meaning for volumes which conform to+ * `FSVolumePreallocateOperations`.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSUInteger, FSItemDeactivationOptions) {+ FSItemDeactivationNever = 0,+ FSItemDeactivationAlways = (1 << 0),+ FSItemDeactivationForRemovedItems = (1 << 1),+ FSItemDeactivationForPreallocatedItems = (1 << 2),+} NS_SWIFT_NAME(FSVolume.ItemDeactivationOptions);++/**+ * @protocol FSVolumeItemDeactivation+ * A protocol for the item deactivation operation.+ */+FSKIT_API_AVAILABILITY_V1+NS_SWIFT_NAME(FSVolume.ItemDeactivation)+@protocol FSVolumeItemDeactivation <NSObject>++/**+ * @property itemDeactivationPolicy+ * Tell FSKit for which type of items (if at all) `deactivateItem:` should be called.+ * FSKit reads this value after the file system module replies to `loadResource:`. Changing it during the+ * runtime of the volume won't have an effect.+ */+@property (readonly) FSItemDeactivationOptions itemDeactivationPolicy;++/**+ * deactivateItem:replyHandler:+ *+ * @brief Notify the file system that the given item is no longer in immediate use by the kernel.+ * @param item item to deactivate.+ * @param reply In case of success, should be called with error = nil.+ * Otherwise, should be called with the relevant error. The error+ * will be logged and ignored.+ * @discussion This method gives a file system a chance to release resources associated with an item, but+ * no action is prescribed; it is acceptable to defer all reclamation until reclaimItem. This call is the FSKit's+ * equivalent of VFS's `VNOP_INACTIVE`. Will be called according to the chosen+ * FSVolumeDeactivationOptions policy.+ */+-(void)deactivateItem:(FSItem *)item+ replyHandler:(void(^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(deactivateItem(_:replyHandler:));++@end++NS_ASSUME_NONNULL_ENDdiff -ruN /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolumeExtent.h /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolumeExtent.h--- /Applications/Xcode_16.2.0.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolumeExtent.h1970-01-01 01:00:00+++ /Applications/Xcode_16.3.0-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/System/Library/Frameworks/FSKit.framework/Headers/FSVolumeExtent.h2025-02-11 06:12:26@@ -0,0 +1,280 @@+//+// Copyright (c) 2024 Apple Inc. All rights reserved.+//+// FSVolumeExtent.h+// FSKit+//++/*+ * For block device resource file systems, FSKit offers a facility called+ * Kernel-Offloaded I/O (KOIO) allowing higher file transfer performance.+ * Rather than transfer file data between the module and the kernel, the module+ * supplies file extent mappings to the kernel and the kernel then performs data+ * transfers directly, using the same infrastructure as KEXT file systems.+ *+ * This file contains definitions related to the Kernel-Offloaded I/O mechanism.+ */++#import <Foundation/Foundation.h>+#import <FSKit/FSResource.h>+#import <FSKit/FSVolume.h>++NS_ASSUME_NONNULL_BEGIN++/// A unique identifier for an operation.+FSKIT_API_AVAILABILITY_V1+typedef NSUInteger FSOperationID NS_TYPED_EXTENSIBLE_ENUM;++FSKIT_API_AVAILABILITY_V1+FS_EXPORT FSOperationID const FSOperationIDUnspecified;++/**+ * @typedef FSBlockmapFlags+ * Different flags for the blockmap operation.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSUInteger, FSBlockmapFlags) {+ FSBlockmapFlagsRead = 0x000100,+ FSBlockmapFlagsWrite = 0x000200,+};++/**+ * @typedef FSCompleteIOFlags+ * Different flags for the completeIO operation.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_OPTIONS(NSUInteger, FSCompleteIOFlags) {+ FSCompleteIOFlagsRead = FSBlockmapFlagsRead,+ FSCompleteIOFlagsWrite = FSBlockmapFlagsWrite,+ /* Requests the file system module to flush the metadata IO asynchronously */+ FSCompleteIOFlagsAsync = 0x000400,+};++/**+ * @typedef FSExtentType+ * Possible extent types.+ */+FSKIT_API_AVAILABILITY_V1+typedef NS_ENUM(NSInteger, FSExtentType) {+ /**+ * The extent contains valid data.+ * For file systems which do not support sparse files, all extents should be of type FSExtentTypeData.+ * The kernel keeps track of EOF, so it knows that the range of [EOF, allocated space] is uninitialized.+ * So it is valid to pass an extent type of FSExtentTypeData for this range.+ */+ FSExtentTypeData = 0,+ /**+ * The extent contains uninitialized data.+ * Should be in use only for file systems which support sparse files, for ranges in the file were not+ * allocated yet.+ */+ FSExtentTypeZeroFill = 1,+};++/**+ * @interface FSExtentPacker+ * Extents are used to describe to the kernel parts of the space on disk assigned to a specific file.+ * That space is described by a physical offset on disk, a length and a logical offset within the file.+ * The extent packer takes this information and packs the extent so FSKit can pass it to the kernel.+ */+FSKIT_API_AVAILABILITY_V1+@interface FSExtentPacker : NSObject++- (instancetype)init NS_UNAVAILABLE;++/**+ * @method packExtentWithResource:type:logicalOffset:physicalOffset:length:+ *+ * @brief Pack a single extent to be sent to the kernel.+ * @param resource volume's resource to perform the IO from/to+ * @param type extent type+ * @param logicalOffset extent offset, in bytes, within the file+ * @param physicalOffset extent offset, in bytes, on disk+ * @param length extent length in bytes+ * @return YES if more extents can be packed, else NO.+ *+ * Example usage (an example how to pack multiple extents in a for loop)+ ```+ - (void)packExtentsExample:(FSExtentPacker *)packer+ resource:(FSBlockDeviceResource *)resource+ {+ size_t length = 0;+ off_t logOffset = 0;+ off_t phyOffset = 1000;+ for (int i = 0; i < 10; i++) {+ length = (i+1)*100;+ if([packer packExtentWithResource:resource+ type:FSExtentTypeData+ logicalOffset:logOffset+ physicalOffset:phyOffset+ length:length] == NO) {+ break;+ }+ logOffset += length;+ phyOffset += length;+ }+ }+ ```+ *+ */+- (BOOL)packExtentWithResource:(FSBlockDeviceResource *)resource+ type:(FSExtentType)type+ logicalOffset:(off_t)logicalOffset+ physicalOffset:(off_t)physicalOffset+ length:(size_t)length+NS_SWIFT_NAME(packExtent(resource:type:logicalOffset:physicalOffset:length:));++@end++/**+ * @protocol FSVolumeKernelOffloadedIOOperations+ * A protocol of Kernel Offloaded IO operations.+ */+FSKIT_API_AVAILABILITY_V1+@protocol FSVolumeKernelOffloadedIOOperations <NSObject>++#pragma mark - Kernel Offloaded IO operations++/**+ * @method blockmapFile:range:flags:operationID:packer:replyHandler:+ *+ * @brief Map a file's disk space into extents for the kernel to perform I/O on.+ * @param file The file whose disk space will be mapped.+ * @param offset Starting logical offset of the range to be mapped (in bytes).+ * @param length Length of the range to be mapped (in bytes).+ * @param flags Different flags for the blockmap operation.+ * @param operationID A unique identifier of the blockmap call.+ * operationID != FSOperationIDUnspecified means an I/O operation is beginning,+ * for which we need to map the file. completeIO will be issued with the same ID+ * supplied in the operationID parameter.+ * operationID == FSOperationIDUnspecified means that the kernel maps the file+ * without issuing an I/O. There will not be a corresponding completeIO call in this+ * case, as no I/O is done. In both cases the mapping will be retained in the kernel.+ * In the case where satisfying a block map request requires more extents than can+ * be packed, subsequent request(s) will be issued with the same operation ID for+ * the remainder.+ * @param packer An extent packer to pack the requested range of the file's allocated disk space.+ * FSKit will send all of the packed extents to the kernel when reply is called.+ * @param reply In case of success, should be called with error = nil. Otherwise, should be called+ * with the relevant error.+ */+- (void)blockmapFile:(FSItem *)file+ offset:(off_t)offset+ length:(size_t)length+ flags:(FSBlockmapFlags)flags+ operationID:(FSOperationID)operationID+ packer:(FSExtentPacker *)packer+ replyHandler:(void (^)(NSError * _Nullable error))reply;++/**+ * @method completeIOForFile:range:status:flags:operationID:replyHandler:+ *+ * @brief Complete the I/O operation.+ * Called to update the file's metadata, such as its size and modification time, once the I/O operation is done.+ * @param file The file for which I/O was done+ * @param offset logical byte offset at which I/O started+ * @param length length of I/O range in bytes+ * @param status If nil, I/O was successful. Else, it indicates the error+ * @param flags Different flags for the completeIO operation.+ * @param operationID A unique identifier of the specific I/O operation+ * @param reply In case of success, should be called with error = nil. Otherwise, should be called+ * with the relevant error.+ * @discussion Note that completeIO is not necessarily coupled with a blockmap operation. completeIO+ * can be called for I/O completion on a range previously supplied to the kernel. In that case, operationID+ * will be FSOperationIDUnspecified. A different operationID means that an I/O operation begun via+ * blockmapFile with the same operationID has been completed.+ */+- (void)completeIOForFile:(FSItem *)file+ offset:(off_t)offset+ length:(size_t)length+ status:(NSError *)status+ flags:(FSCompleteIOFlags)flags+ operationID:(FSOperationID)operationID+ replyHandler:(void (^)(NSError * _Nullable error))reply+NS_SWIFT_NAME(completeIO(for:offset:length:status:flags:operationID:replyHandler:));++#pragma mark - extent-supplying versions of create and lookup+/*+ * These methods allow the module to opportunistically supply extents in order+ * to save future 'blockmapFile' calls. An implementation not supplying the+ * extents can ignore the packer, and call the corresponding FSVolumeOperation's+ * method.+ */++/**+ * @method createFileNamed:inDirectory:attributes:packer:replyHandler:+ *+ * @brief Create a new file item, and map its disk-space+ * @param name new file's name+ * @param directory directory to create the file in+ * @param attributes Desired set of attributes for the new file+ * @param packer An extent packer to pack the file's allocated disk space+ * @param reply In case of success, should be called with the created file, the file's name (as it's saved+ * within the file system), and error = nil. Otherwise, should be called with the relevant error.+ * In that case, newFile and newFileName are ignored. In case there's already an item+ * named "name" in the directory, complete the request with an error with a domain of+ * NSPOSIXErrorDomain and a code of EEXIST.+ * @discussion Packing extents in this method is only possible if `attributes` define a size > 0.+ * It should be done opportunistically; Do not perform additional IO to fetch extent data.+ */+- (void)createFileNamed:(FSFileName *)name+ inDirectory:(FSItem *)directory+ attributes:(FSItemSetAttributesRequest *)attributes+ packer:(FSExtentPacker *)packer+ replyHandler:(void(^)(FSItem * _Nullable newFile,+ FSFileName * _Nullable newFileName,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(createFile(name:in:attributes:packer:replyHandler:));++/**+ * @method lookupItemNamed:inDirectory:packer:replyHandler:+ *+ * @brief Lookup an item within a directory, and map its disk-space+ * @param name item name to lookup+ * @param directory directory to look the item in+ * @param packer An extent packer to pack the item's allocated disk space+ * @param reply In case of success, should be called with the found item,+ * the item name (as it's saved within the file system), and error = nil.+ * Otherwise, should be called with the relevant error. In that case, theItem and itemName are ignored.+ * If the entry does not exist, complete the request with an error+ * with a domain of NSPOSIXErrorDomain and a code of ENOENT.+ * @discussion Packing extents in this method should be done opportunistically; Do not perform additional+ * IO to fetch extent data.+ */+- (void)lookupItemNamed:(FSFileName *)name+ inDirectory:(FSItem *)directory+ packer:(FSExtentPacker *)packer+ replyHandler:(void(^)(FSItem * _Nullable theItem,+ FSFileName * _Nullable itemName,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(lookupItem(name:in:packer:replyHandler:));++#pragma mark - extent-supplying version of preallocate++/* Should only be implemented for volumes which conform to FSVolumePreallocateOperations. */+@optional+/**+ * @method preallocateSpaceForFile:atOffset:length:flags:packer:replyHandler:+ *+ * @brief Preallocate disk space for a file.+ * @param file The file for which to preallocate space+ * @param offset The offset from which to allocate+ * @param length The length of the space in bytes+ * @param flags Preallocate flags+ * @param packer An extent packer to pack the preallocated space+ * @param reply In case of success, should be called with the amount of bytes allocated, and error = nil.+ * Otherwise, should be called with the relevant error. In that case, bytesAllocated is ignored.+ * @discussion This method should only be implemented for volumes which conform to FSVolumePreallocateOperations.+ */+- (void)preallocateSpaceForFile:(FSItem *)file+ atOffset:(off_t)offset+ length:(size_t)length+ flags:(FSPreallocateFlags)flags+ packer:(FSExtentPacker *)packer+ replyHandler:(void(^)(size_t bytesAllocated,+ NSError * _Nullable error))reply+NS_SWIFT_NAME(preallocateSpace(for:at:length:flags:packer:replyHandler:));++@end++NS_ASSUME_NONNULL_END