GMUserFileSystem


Superclass: NSObject
Declared In: GMUserFileSystem

Discussion

This class controls the life cycle of a user space file system. The GMUserFileSystem is typically instantiated with a delegate that will serve file system operations. The delegate needs to implement some or all of the methods in the GMUserFileSystemOperations informal protocol. It may also implement methods from the GMUserFileSystemLifecycle and GMUserFileSystemResourceForks protocols as necessary.

After instantiating a GMUserFileSystem with an appropriate delegate, call mountAtPath:withOptions: to mount the file system. A call to unmount or an external umount operation will unmount the file system. If the delegate implements methods from the GMUserFileSystemLifecycle informal protocol then these will be called just before mount and unmount. In addition, the GMUserFileSystem class will post mount and unmount notifications to the default notification center. Since the underlying GMUserFileSystem implementation is multi-threaded, you should assume that notifications will not be posted on the main thread. The object will always be the GMUserFileSystem* and the userInfo will always contain at least the kGMUserFileSystemMountPathkey.

The best way to get started with GMUserFileSystem is to look at some example file systems that use MacFUSE.framework. See the example file systems found here.



Methods

-initWithDelegate:isThreadSafe:
Initialize the user space file system.
-setDelegate:
Set the file system delegate.
-delegate
Get the file system delegate.
-mountAtPath:withOptions:
Mount the file system at the given path.
-mountAtPath:withOptions:shouldForeground:detachNewThread:
Mount the file system at the given path with advanced options.
-unmount
Unmount the file system.

initWithDelegate:isThreadSafe:


Initialize the user space file system.

- (id)initWithDelegate:(id)delegate isThreadSafe:(BOOL)isThreadSafe; 
Parameters
delegate
The file system delegate; implements the file system logic.
isThreadSafe
Is the file system delegate thread safe?
Return Value

A GMUserFileSystem instance.

Discussion

The file system delegate should implement some or all of the GMUserFileSystemOperations informal protocol. You should only specify YES for isThreadSafe if your file system delegate is thread safe with respect to file system operations. That implies that it implements proper file system locking so that multiple operations on the same file can be done safely.


setDelegate:


Set the file system delegate.

- (void)setDelegate:(id)delegate; 
Parameters
delegate
The delegate to use from now on for this file system.


delegate


Get the file system delegate.

- (id)delegate; 
Return Value

The file system delegate.


mountAtPath:withOptions:


Mount the file system at the given path.

- (void)mountAtPath:(NSString *)mountPath withOptions:(NSArray *)options; 
Parameters
mountPath
The path to mount on, e.g. /Volumes/MyFileSystem
options
The set of mount time options to use.
Discussion

Mounts the file system at mountPath with the given set of options. The set of available options can be found on the options wiki page. For example, to turn on debug output add @"debug" to the options NSArray. If the mount succeeds, then a kGMUserFileSystemDidMount notification is posted to the default noification center. If the mount fails, then a kGMUserFileSystemMountFailed notification will be posted instead.


mountAtPath:withOptions:shouldForeground:detachNewThread:


Mount the file system at the given path with advanced options.

- (void)mountAtPath:(NSString *)mountPath withOptions:(NSArray *)options shouldForeground:(BOOL)shouldForeground // Recommend: YES detachNewThread:(BOOL)detachNewThread; 
Parameters
mountPath
The path to mount on, e.g. /Volumes/MyFileSystem
options
The set of mount time options to use.
shouldForeground
Should the file system thread remain foreground rather than daemonize? (Recommend: YES)
detachNewThread
Should the file system run in a new thread rather than the current one? (Recommend: YES)
Discussion

Mounts the file system at mountPath with the given set of options. This is an advanced version of mountAtPath:withOptions You can use this to mount from a command-line program as follows:


unmount


Unmount the file system.

- (void)unmount; 
Discussion

Unmounts the file system. The kGMUserFileSystemDidUnmount notification will be posted.

Last Updated: Monday, November 17, 2008