Updating an FSKit module to use the new Handler protocols

I have a file system extension that currently uses the various now-deprecated Operations protocols. I have a few questions about moving to the new Handler protocols.


First, my module is going to maintain backwards compatibility with macOS Sequoia for the foreseeable future, but I would also like to be able to take advantage of new FSKit features for users who are on newer OS versions. What approach would you recommend:

  • Having an FSVolume conform to both the various Operations and Handler protocols (e.g. both FSVolumeKernelOffloadedIOOperations and FSVolume.KernelOffloadedIOHandler with the latter tagged with @available)
    • an immediate issue I see trying to do this is I run into the error Method 'activate(options:)' with Objective-C selector 'activateWithOptions:replyHandler:' conflicts with previous declaration with the same Objective-C selector when trying to conform to both FSVolume.Handler and FSVolume.Operations.
  • Having two separate FSVolume implementations, one used for older OS versions with Operations support and one used on newer OS versions with Handler support?
  • Keeping the use of pre-existing Operations protocols while only using the Handlers for newer features (e.g. things like SeekRegionHandler)

Second, I see at https://developer.apple.com/documentation/fskit/fsvolumehandlerresult/requestedattributes that I must populate all requested attributes. Does this value only have a meaning if the initializer for the actual concrete result type has an initializer that takes in a FSItem.Attributes instance, or is there some way I’m supposed to populate those? (As a concrete example, FSCheckAccessResult has init(accessAllowed:) which doesn’t take in any attributes.)

Answered by Frameworks Engineer in 891100022

Regarding your second question, you are correct. FSCheckAccessResult.requestedAttributes can be ignored. (The same applies for all concrete result objects where the initializer doesn't take an instance of FSItem.Attributes).

an immediate issue I see trying to do this is I run into the error Method 'activate(options:)' with Objective-C selector 'activateWithOptions:replyHandler:' conflicts with previous declaration with the same Objective-C selector when trying to conform to both FSVolume.Handler and FSVolume.Operations.

Please file a FeedBack regarding this issue and post its number here.

Our expectation had been to have a volume conform to both.

Regarding your second question, you are correct. FSCheckAccessResult.requestedAttributes can be ignored. (The same applies for all concrete result objects where the initializer doesn't take an instance of FSItem.Attributes).

@Systems Engineer looks like Feedback Assistant is back up, so I made FB23036931 regarding this

Thanks to both of you for the answers!

Updating an FSKit module to use the new Handler protocols
 
 
Q