libfuse3-0.2.0.1: A Haskell binding for libfuse-3.x
Safe HaskellSafe-Inferred
LanguageHaskell2010

System.LibFuse3

Description

A Haskell binding to libfuse-3.x.

Synopsis

Documentation

data FuseOperations fh dh Source #

The file system operations.

All operations are optional. Each field is named against struct fuse_operations in fuse.h.

fh is the file handle type returned by fuseOpen, and subsequently passed to all other file operations.

dh is the directory handle type returned by fuseOpendir, and subsequently passed to fuseReaddir and fuseReleasedir.

Constructors

FuseOperations 

Fields

defaultFuseOperations :: FuseOperations fh dh Source #

An empty set of operations whose fields are Nothing.

data FuseConfig Source #

Configures the filesystem. Passed to fuseInit.

See the module System.LibFuse3.FuseConfig for its fields.

Instances

Instances details
Show FuseConfig Source # 
Instance details

Defined in System.LibFuse3.FuseConfig

Eq FuseConfig Source # 
Instance details

Defined in System.LibFuse3.FuseConfig

data AccessMode Source #

The query type of access. Passed to fuseAccess.

Constructors

FileOK

File existence (F_OK)

PermOK Bool Bool Bool

Reading, writing and executing permissions (R_OK, W_OK and X_OK, resp.)

Instances

Instances details
Show AccessMode Source # 
Instance details

Defined in System.LibFuse3.Internal

Eq AccessMode Source # 
Instance details

Defined in System.LibFuse3.Internal

access :: FilePath -> AccessMode -> IO () Source #

Tests if access permissions to the file is granted or the file exists.

Calls access. Compared to fileAccess and fileExist, this function doesn't translate the errno and just returns () to indicate success, or throws an error to indicate failure.

accessErrno :: FilePath -> AccessMode -> IO Errno Source #

Same as access but returns the Errno instead of throwing an exception.

Returns eOK on success.

data EntryType Source #

The Unix type of a node in the filesystem.

Instances

Instances details
Show EntryType Source # 
Instance details

Defined in System.LibFuse3.Internal

Eq EntryType Source # 
Instance details

Defined in System.LibFuse3.Internal

entryTypeToFileMode :: EntryType -> FileMode Source #

Converts an EntryType into the corresponding POSIX FileMode.

data SyncType Source #

Passed to fuseFsync and fuseFsyncdir.

Constructors

FullSync

Synchronize both file content and metadata.

DataSync

Synchronize only the file content.

Instances

Instances details
Show SyncType Source # 
Instance details

Defined in System.LibFuse3.Internal

Eq SyncType Source # 
Instance details

Defined in System.LibFuse3.Internal

data FileStat Source #

A file status a.k.a. metadata.

The differences from FileStatus are:

  • Is a record type with a Storable instance.
  • Has an extra field blockCount.

    • An equivalent accessor fileBlocks was added in unix-2.8.0.0, but it is a Maybe.
  • Provides an exact representation (TimeSpec) of the time fields without converting to POSIXTime.

    • This assumes that the struct stat has st_atim, st_mtim and st_ctim fields. On Linux this requires Linux >= 2.6.

Ptr FileStat can be cast to Ptr CStat and vice versa.

Use defaultFileStat and modify its fields you are interested in.

The st_ino field is ignored unless the use_ino mount option is given.

The st_dev and st_blksize fields are ignored by libfuse, so not provided.

Constructors

FileStat 

Fields

defaultFileStat :: FileStat Source #

The default value of FileStat.

The Haskell Equivalent of zero-setting C code { struct stat st; memset(&st, 0, sizeof(struct stat)); }.

getFileStat :: FilePath -> IO FileStat Source #

Reads a file status of a given file.

Calls lstat.

getFileStatFd :: Fd -> IO FileStat Source #

Reads a file status of a given file.

Calls fstat.

getFileSystemStats Source #

Arguments

:: FilePath

A path of any file within the filesystem

-> IO FileSystemStats 

Gets filesystem statistics.

Calls statvfs.

getFileSystemStatsFd :: Fd -> IO FileSystemStats Source #

Gets filesystem statistics.

Calls fstatvfs.

data SetxattrFlag Source #

Passed to fuseSetxattr.

Constructors

SetxattrDefault

Create a new attribute if it does not exist, or replace the value if it already exists (0)

SetxattrCreate

Perform a pure create, which fails if the named attribute exists already (XATTR_CREATE)

SetxattrReplace

Perform a pure replace operation, which fails if the named attribute does not already exist (XATTR_REPLACE)

fuseMain :: Exception e => FuseOperations fh dh -> ExceptionHandler e -> IO () Source #

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.

type ExceptionHandler e = e -> IO Errno Source #

An exception handler which converts Haskell exceptions from FuseOperations methods to Errno.

defaultExceptionHandler :: ExceptionHandler SomeException Source #

Catches any exception, logs it to stderr, and returns eIO.

Suitable as a default exception handler.

NOTE 1 This differs from the one in the HFuse package which returns eFAULT.

NOTE 2 If the filesystem is daemonized (as default), the exceptions will not be logged because stderr is redirected to /dev/null.