-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | HFuse is a binding for the Linux FUSE library. -- -- Bindings for the FUSE library, compatible with OSXFUSE and FreeBSD. @package HFuse @version 0.2.4.2 -- | A binding for the FUSE (Filesystem in USErspace) library -- (http://fuse.sourceforge.net/), which allows filesystems to be -- implemented as userspace processes. -- -- The binding tries to follow as much as possible current Haskell POSIX -- interface in System.Posix.Files and -- System.Posix.Directory. -- -- FUSE uses POSIX threads, so any Haskell application using this library -- must be linked against a threaded runtime system (eg. using the -- threaded GHC option). module System.Fuse -- | This record, given to fuseMain, binds each required file system -- operations. -- -- Each field is named against Posix names. Matching Linux system -- calls are also given as a reference. -- -- fh is the file handle type returned by fuseOpen and -- subsequently passed to all other file operations. data FuseOperations fh FuseOperations :: (FilePath -> IO (Either Errno FileStat)) -> (FilePath -> IO (Either Errno FilePath)) -> (FilePath -> EntryType -> FileMode -> DeviceID -> IO Errno) -> (FilePath -> FileMode -> IO Errno) -> (FilePath -> IO Errno) -> (FilePath -> IO Errno) -> (FilePath -> FilePath -> IO Errno) -> (FilePath -> FilePath -> IO Errno) -> (FilePath -> FilePath -> IO Errno) -> (FilePath -> FileMode -> IO Errno) -> (FilePath -> UserID -> GroupID -> IO Errno) -> (FilePath -> FileOffset -> IO Errno) -> (FilePath -> EpochTime -> EpochTime -> IO Errno) -> (FilePath -> OpenMode -> OpenFileFlags -> IO (Either Errno fh)) -> (FilePath -> fh -> ByteCount -> FileOffset -> IO (Either Errno ByteString)) -> (FilePath -> fh -> ByteString -> FileOffset -> IO (Either Errno ByteCount)) -> (String -> IO (Either Errno FileSystemStats)) -> (FilePath -> fh -> IO Errno) -> (FilePath -> fh -> IO ()) -> (FilePath -> SyncType -> IO Errno) -> (FilePath -> IO Errno) -> (FilePath -> IO (Either Errno [(FilePath, FileStat)])) -> (FilePath -> IO Errno) -> (FilePath -> SyncType -> IO Errno) -> (FilePath -> Int -> IO Errno) -> IO () -> IO () -> FuseOperations fh -- | Implements getSymbolicLinkStatus operation (POSIX -- lstat(2)). fuseGetFileStat :: FuseOperations fh -> FilePath -> IO (Either Errno FileStat) -- | Implements readSymbolicLink operation (POSIX -- readlink(2)). The returned FilePath might be truncated -- depending on caller buffer size. fuseReadSymbolicLink :: FuseOperations fh -> FilePath -> IO (Either Errno FilePath) -- | Implements createDevice (POSIX mknod(2)). This -- function will also be called for regular file creation. fuseCreateDevice :: FuseOperations fh -> FilePath -> EntryType -> FileMode -> DeviceID -> IO Errno -- | Implements createDirectory (POSIX mkdir(2)). fuseCreateDirectory :: FuseOperations fh -> FilePath -> FileMode -> IO Errno -- | Implements removeLink (POSIX unlink(2)). fuseRemoveLink :: FuseOperations fh -> FilePath -> IO Errno -- | Implements removeDirectory (POSIX rmdir(2)). fuseRemoveDirectory :: FuseOperations fh -> FilePath -> IO Errno -- | Implements createSymbolicLink (POSIX symlink(2)). fuseCreateSymbolicLink :: FuseOperations fh -> FilePath -> FilePath -> IO Errno -- | Implements rename (POSIX rename(2)). fuseRename :: FuseOperations fh -> FilePath -> FilePath -> IO Errno -- | Implements createLink (POSIX link(2)). fuseCreateLink :: FuseOperations fh -> FilePath -> FilePath -> IO Errno -- | Implements setFileMode (POSIX chmod(2)). fuseSetFileMode :: FuseOperations fh -> FilePath -> FileMode -> IO Errno -- | Implements setOwnerAndGroup (POSIX chown(2)). fuseSetOwnerAndGroup :: FuseOperations fh -> FilePath -> UserID -> GroupID -> IO Errno -- | Implements setFileSize (POSIX truncate(2)). fuseSetFileSize :: FuseOperations fh -> FilePath -> FileOffset -> IO Errno -- | Implements setFileTimes (POSIX utime(2)). fuseSetFileTimes :: FuseOperations fh -> FilePath -> EpochTime -> EpochTime -> IO Errno -- | Implements openFd (POSIX open(2)). On success, returns -- Right of a filehandle-like value that will be passed to future -- file operations; on failure, returns Left of the appropriate -- Errno. -- -- No creation, exclusive access or truncating flags will be passed. This -- should check that the operation is permitted for the given flags. fuseOpen :: FuseOperations fh -> FilePath -> OpenMode -> OpenFileFlags -> IO (Either Errno fh) -- | Implements Unix98 pread(2). It differs from fdRead by -- the explicit FileOffset argument. The fuse.h -- documentation stipulates that this "should return exactly the number -- of bytes requested except on EOF or error, otherwise the rest of the -- data will be substituted with zeroes." fuseRead :: FuseOperations fh -> FilePath -> fh -> ByteCount -> FileOffset -> IO (Either Errno ByteString) -- | Implements Unix98 pwrite(2). It differs from fdWrite -- by the explicit FileOffset argument. fuseWrite :: FuseOperations fh -> FilePath -> fh -> ByteString -> FileOffset -> IO (Either Errno ByteCount) -- | Implements statfs(2). fuseGetFileSystemStats :: FuseOperations fh -> String -> IO (Either Errno FileSystemStats) -- | Called when close(2) has been called on an open file. Note: -- this does not mean that the file is released. This function may be -- called more than once for each open(2). The return value is -- passed on to the close(2) system call. fuseFlush :: FuseOperations fh -> FilePath -> fh -> IO Errno -- | Called when an open file has all file descriptors closed and all -- memory mappings unmapped. For every open call there will be -- exactly one release call with the same flags. It is possible -- to have a file opened more than once, in which case only the last -- release will mean that no more reads or writes will happen on the -- file. fuseRelease :: FuseOperations fh -> FilePath -> fh -> IO () -- | Implements fsync(2). fuseSynchronizeFile :: FuseOperations fh -> FilePath -> SyncType -> IO Errno -- | Implements opendir(3). This method should check if the open -- operation is permitted for this directory. fuseOpenDirectory :: FuseOperations fh -> FilePath -> IO Errno -- | Implements readdir(3). The entire contents of the directory -- should be returned as a list of tuples (corresponding to the first -- mode of operation documented in fuse.h). fuseReadDirectory :: FuseOperations fh -> FilePath -> IO (Either Errno [(FilePath, FileStat)]) -- | Implements closedir(3). fuseReleaseDirectory :: FuseOperations fh -> FilePath -> IO Errno -- | Synchronize the directory's contents; analogous to -- fuseSynchronizeFile. fuseSynchronizeDirectory :: FuseOperations fh -> FilePath -> SyncType -> IO Errno -- | Check file access permissions; this will be called for the access() -- system call. If the default_permissions mount option is -- given, this method is not called. This method is also not called under -- Linux kernel versions 2.4.x fuseAccess :: FuseOperations fh -> FilePath -> Int -> IO Errno -- | Initializes the filesystem. This is called before all other -- operations. fuseInit :: FuseOperations fh -> IO () -- | Called on filesystem exit to allow cleanup. fuseDestroy :: FuseOperations fh -> IO () -- | Empty / default versions of the FUSE operations. defaultFuseOps :: FuseOperations fh -- | Main function of FUSE. This is all that has to be called from the -- main function. On top of the FuseOperations record -- with filesystem implementation, you must give an exception handler -- converting Haskell exceptions to Errno. -- -- This function does the following: -- --