Interface FuseOperationsDecorator
-
Nested Class Summary
Nested classes/interfaces inherited from interface org.cryptomator.jfuse.api.FuseOperations
FuseOperations.Operation -
Field Summary
Fields inherited from interface org.cryptomator.jfuse.api.FuseOperations
FUSE_READDIR_PLUS -
Method Summary
Modifier and TypeMethodDescriptiondefault intCheck file access permissions.default intChange the permission bits of a filedefault intChange the owner and group of a filedefault intCreate and open a file.delegate()Get the to-be-decorated FuseOperations object.default voiddestroy()Clean up filesystemdefault Errnoerrno()The error constants used by this file system.default intPossibly flush cached data.default intSynchronize file contentsdefault intSynchronize directory contentsdefault intGet file attributes.default intgetxattr(String path, String name, ByteBuffer value) Get extended attributesdefault voidinit(FuseConnInfo conn, @Nullable FuseConfig cfg) Initialize filesystemdefault intCreate a hard link to a filedefault intlistxattr(String path, ByteBuffer list) List extended attributesdefault intCreate a directory.default intCreate a file node.default intOpen a file.default intOpen directory.default intread(String path, ByteBuffer buf, long count, long offset, FileInfo fi) Read data from an open file.default intRead directory.default intreadlink(String path, ByteBuffer buf, long len) Read the target of a symbolic link.default intRelease an open file.default intreleasedir(@Nullable String path, FileInfo fi) Release directorydefault intremovexattr(String path, String name) Remove extended attributesdefault intRename a filedefault intRemove a directorydefault intsetxattr(String path, String name, ByteBuffer value, int flags) Set extended attributesdefault intGet file system statistics.default Set<FuseOperations.Operation> The supported file system operations.default intCreate a symbolic linkdefault intChange the size of a file.default intRemove a filedefault intChange the access and modification times of a file with nanosecond resolution.default intwrite(String path, ByteBuffer buf, long count, long offset, FileInfo fi) Write data to an open file.Methods inherited from interface org.cryptomator.jfuse.api.FuseOperations
fallocate, flock, ioctl
-
Method Details
-
delegate
FuseOperations delegate()Get the to-be-decorated FuseOperations object.- Returns:
- the undecorated operations
-
supportedOperations
Description copied from interface:FuseOperationsThe supported file system operations.- Specified by:
supportedOperationsin interfaceFuseOperations- Returns:
- The set of supported operations.
-
errno
Description copied from interface:FuseOperationsThe error constants used by this file system.- Specified by:
errnoin interfaceFuseOperations- Returns:
- The error codes from
errno.hfor the current platform. - See Also:
-
getattr
Description copied from interface:FuseOperationsGet file attributes.Similar to stat(). The 'st_dev' and 'st_blksize' fields are ignored. The 'st_ino' field is ignored except if the 'use_ino' mount option is given. In that case it is passed to userspace, but libfuse and the kernel will still assign a different inode for internal use (called the "nodeid").
This method doubles as
fgetattrin libfuse2- Specified by:
getattrin interfaceFuseOperations- Parameters:
path- file pathstat- file informationfi- will always benullif the file is not currently open, but may also benullif the file is open.- Returns:
- 0 on success or negated error code (-errno)
-
getxattr
Description copied from interface:FuseOperationsGet extended attributes- Specified by:
getxattrin interfaceFuseOperations- Parameters:
path- file pathname- attribute namevalue- attribute value. If buffer capacity is zero, return the size of the value- Returns:
- the non-negative value size or negated error code (-errno)
-
setxattr
Description copied from interface:FuseOperationsSet extended attributes- Specified by:
setxattrin interfaceFuseOperations- Parameters:
path- file pathname- attribute namevalue- attribute valueflags- defaults to zero, which creates or replaces the attribute. For fine-grained atomic control,XATTR_CREATEorXATTR_REPLACEmay be used.- Returns:
- 0 on success or negated error code (-errno)
-
listxattr
Description copied from interface:FuseOperationsList extended attributes- Specified by:
listxattrin interfaceFuseOperations- Parameters:
path- file pathlist- consecutive list of null-terminated attribute names (as many as fit into the buffer). If buffer capacity is zero, return the size of the list- Returns:
- the non-negative number of bytes written to the list buffer or negated error code (-errno)
-
removexattr
Description copied from interface:FuseOperationsRemove extended attributes- Specified by:
removexattrin interfaceFuseOperations- Parameters:
path- file pathname- attribute name- Returns:
- 0 on success or negated error code (-errno)
-
readlink
Description copied from interface:FuseOperationsRead the target of a symbolic link.- Specified by:
readlinkin interfaceFuseOperations- Parameters:
path- file pathbuf- The buffer should be filled with a null terminated string.len- The buffer size (including the terminating null character). If the linkname is too long to fit in the buffer, it should be truncated.- Returns:
- The return value should be 0
-
mknod
Description copied from interface:FuseOperationsCreate a file node.This is called for creation of all non-directory, non-symlink nodes. If the filesystem defines a create() method, then for regular files that will be called instead.
- Specified by:
mknodin interfaceFuseOperations- Parameters:
path- file pathmode- file mode and type of node to create (using bitwise OR)rdev- ignored if mode does not containS_IFCHRorS_IFBLK- Returns:
- 0 on success or negated error code (-errno)
-
mkdir
Description copied from interface:FuseOperationsCreate a directory.Note that the mode argument may not have the type specification bits set, i.e. S_ISDIR(mode) can be false. To obtain the correct directory type bits use mode|S_IFDIR
- Specified by:
mkdirin interfaceFuseOperations- Parameters:
path- file pathmode- file mode (using bitwise OR)- Returns:
- 0 on success or negated error code (-errno)
-
unlink
Description copied from interface:FuseOperationsRemove a file- Specified by:
unlinkin interfaceFuseOperations- Parameters:
path- file path- Returns:
- 0 on success or negated error code (-errno)
-
rmdir
Description copied from interface:FuseOperationsRemove a directory- Specified by:
rmdirin interfaceFuseOperations- Parameters:
path- file path- Returns:
- 0 on success or negated error code (-errno)
-
symlink
Description copied from interface:FuseOperationsCreate a symbolic link- Specified by:
symlinkin interfaceFuseOperations- Parameters:
linkname- file pathtarget- content of the link- Returns:
- 0 on success or negated error code (-errno)
-
rename
Description copied from interface:FuseOperationsRename a file- Specified by:
renamein interfaceFuseOperations- Parameters:
oldpath- old file pathnewpath- new file pathflags- may be `RENAME_EXCHANGE` or `RENAME_NOREPLACE`. If RENAME_NOREPLACE is specified, the filesystem must not overwrite *newname* if it exists and return an error instead. If `RENAME_EXCHANGE` is specified, the filesystem must atomically exchange the two files, i.e. both must exist and neither may be deleted.- Returns:
- 0 on success or negated error code (-errno)
-
link
Description copied from interface:FuseOperationsCreate a hard link to a file- Specified by:
linkin interfaceFuseOperations- Parameters:
linkname- file pathtarget- content of the link- Returns:
- 0 on success or negated error code (-errno)
-
chmod
Description copied from interface:FuseOperationsChange the permission bits of a file- Specified by:
chmodin interfaceFuseOperations- Parameters:
path- file pathmode- file mode (using bitwise OR)fi- will always benullif the file is not currently open, but may also benullif the file is open.- Returns:
- 0 on success or negated error code (-errno)
-
chown
Description copied from interface:FuseOperationsChange the owner and group of a file- Specified by:
chownin interfaceFuseOperations- Parameters:
path- file pathuid- user idgid- group idfi- will always benullif the file is not currently open, but may also benullif the file is open.- Returns:
- 0 on success or negated error code (-errno)
-
truncate
Description copied from interface:FuseOperationsChange the size of a file.Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is expected to reset the setuid and setgid bits.
This method doubles as
ftruncatein libfuse2- Specified by:
truncatein interfaceFuseOperations- Parameters:
path- file pathsize- new size of the filefi- will always benullif the file is not currently open, but may also benullif the file is open.- Returns:
- 0 on success or negated error code (-errno)
-
open
Description copied from interface:FuseOperationsOpen a file.Open flags are available in fi->flags. The following rules apply.
- Creation (O_CREAT, O_EXCL, O_NOCTTY) flags will be filtered out / handled by the kernel.
- Access modes (O_RDONLY, O_WRONLY, O_RDWR, O_EXEC, O_SEARCH) should be used by the filesystem to check if the operation is permitted. If the ``-o default_permissions`` mount option is given, this check is already done by the kernel before calling open() and may thus be omitted by the filesystem.
- When writeback caching is enabled, the kernel may send read requests even for files opened with O_WRONLY. Thefilesystem should be prepared to handle this.
- When writeback caching is disabled, the filesystem is expected to properly handle the O_APPEND flag and ensurethat each write is appending to the end of the file.
- When writeback caching is enabled, the kernel will handle O_APPEND. However, unless all changes to the file come through the kernel this will not work reliably. The filesystem should thus either ignore the O_APPEND flag (and let the kernel handle it), or return an error (indicating that reliably O_APPEND is not available).
fi->fh, and use this in other all other file operations (read, write, flush, release, fsync).Filesystem may also implement stateless file I/O and not store anything in
fi->fh.There are also some flags (direct_io, keep_cache) which the filesystem may set in fi, to change the way the file is opened. See fuse_file_info structure in fuse_common.h for more details.
If this request is answered with an error code of ENOSYS and FUSE_CAP_NO_OPEN_SUPPORT is set in `fuse_conn_info.capable`, this is treated as success and future calls to open will also succeed without being send to the filesystem process.
- Specified by:
openin interfaceFuseOperations- Parameters:
path- file pathfi- file info, which may be used to store a file handle- Returns:
- 0 on success or negated error code (-errno)
-
read
Description copied from interface:FuseOperationsRead data from an open file.Read should return exactly the number of bytes requested except on EOF or error, otherwise the rest of the data will be substituted with zeroes. An exception to this is when the 'direct_io' mount option is specified, in which case the return value of the read system call will reflect the return value of this operation.
- Specified by:
readin interfaceFuseOperations- Parameters:
path- file pathbuf- the buffer to read intocount- number of bytes to readoffset- position in the file to start readingfi- file info- Returns:
- number of bytes read or negated error code (-errno)
-
write
Description copied from interface:FuseOperationsWrite data to an open file.Write should return exactly the number of bytes requested except on error. An exception to this is when the 'direct_io' mount option is specified (see read operation).
Unless FUSE_CAP_HANDLE_KILLPRIV is disabled, this method is expected to reset the setuid and setgid bits.
- Specified by:
writein interfaceFuseOperations- Parameters:
path- file pathbuf- the buffer containing the data to be writtencount- number of bytes to writeoffset- position in the file to write tofi- file info- Returns:
- number of bytes written or negated error code (-errno)
-
statfs
Description copied from interface:FuseOperationsGet file system statistics.The 'f_favail', 'f_fsid' and 'f_flag' fields are ignored
- Specified by:
statfsin interfaceFuseOperations- Parameters:
path- file path of any file within the file systemstatvfs- The statistics object to be filled with data- Returns:
- 0 on success or negated error code (-errno)
-
flush
Description copied from interface:FuseOperationsPossibly flush cached data.BIG NOTE: This is not equivalent to fsync(). It's not a request to sync dirty data.
Flush is called on each close() of a file descriptor, as opposed to release which is called on the close of the last file descriptor for a file. Under Linux, errors returned by flush() will be passed to userspace as errors from close(), so flush() is a good place to write back any cached dirty data. However, many applications ignore errors on close(), and on non-Linux systems, close() may succeed even if flush() returns an error. For these reasons, filesystems should not assume that errors returned by flush will ever be noticed or even delivered.
NOTE: The flush() method may be called more than once for each open(). This happens if more than one file descriptor refers to an open file handle, e.g. due to dup(), dup2() or fork() calls. It is not possible to determine if a flush is final, so each flush should be treated equally. Multiple write-flush sequences are relatively rare, so this shouldn't be a problem.
Filesystems shouldn't assume that flush will be called at any particular point. It may be called more times than expected, or not at all.
- Specified by:
flushin interfaceFuseOperations- Parameters:
path- file pathfi- file info- Returns:
- 0 on success or negated error code (-errno)
-
fsync
Description copied from interface:FuseOperationsSynchronize file contents- Specified by:
fsyncin interfaceFuseOperations- Parameters:
path- file pathdatasync- if non-zero, then only the user data should be flushed, not the meta data.fi- file info- Returns:
- 0 on success or negated error code (-errno)
-
release
Description copied from interface:FuseOperationsRelease an open file.Release is called when there are no more references to an open file: all file descriptors are closed and all memory mappings are unmapped.
For every open() call there will be exactly one release() call with the same flags and file handle. It is possible to have a file opened more than once, in which case only the last release will mean, that no more reads/writes will happen on the file. The return value of release is ignored.
- Specified by:
releasein interfaceFuseOperations- Parameters:
path- file pathfi- file info- Returns:
- 0 on success or negated error code (-errno)
-
opendir
Description copied from interface:FuseOperationsOpen directory.Unless the 'default_permissions' mount option is given, this method should check if opendir is permitted for this directory. Optionally opendir may also return an arbitrary
filehandle in the fuse_file_info structure, which will be passed to readdir, releasedir and fsyncdir.- Specified by:
opendirin interfaceFuseOperations- Parameters:
path- directory pathfi- file info, which may be used to store a file handle- Returns:
- 0 on success or negated error code (-errno)
-
readdir
Description copied from interface:FuseOperationsRead directory.The filesystem may choose between two modes of operation:
- The readdir implementation ignores the offset parameter, and passes zero to the filler function's offset. The filler function will not return '1' (unless an error happens), so the whole directory is read in a single readdir operation.
- The readdir implementation keeps track of the offsets of the directory entries. It uses the offset parameter and always passes non-zero offset to the filler function. When the buffer is full (or an error happens) the filler function will return '1'.
- Specified by:
readdirin interfaceFuseOperations- Parameters:
path- directory pathfiller- the fill functionoffset- the offsetfi- file infoflags- WhenFuseOperations.FUSE_READDIR_PLUSis not set, only some parameters of the fill function (thefillerparameter) are actually used: The file type (which is part ofStat.getMode()) is used. And if fuse_config::use_ino is set, the inode (stat::st_ino) is also used. The other fields are ignored whenREAD_DIR_PLUSis not set.- Returns:
- 0 on success or negated error code (-errno)
-
fsyncdir
Description copied from interface:FuseOperationsSynchronize directory contents- Specified by:
fsyncdirin interfaceFuseOperations- Parameters:
path- directory path. If the directory has been removed after the call to opendir, the path parameter will benulldatasync- if non-zero, then only the user data should be flushed, not the meta datafi- file info- Returns:
- 0 on success or negated error code (-errno)
-
releasedir
Description copied from interface:FuseOperationsRelease directory- Specified by:
releasedirin interfaceFuseOperations- Parameters:
path- directory path. If the directory has been removed after the call to opendir, the path parameter will benullfi- file info- Returns:
- 0 on success or negated error code (-errno)
-
init
Description copied from interface:FuseOperationsInitialize filesystem- Specified by:
initin interfaceFuseOperations- Parameters:
conn- FUSE connection informationcfg- FUSE configuration object
-
destroy
default void destroy()Description copied from interface:FuseOperationsClean up filesystemCalled on filesystem exit.
- Specified by:
destroyin interfaceFuseOperations
-
access
Description copied from interface:FuseOperationsCheck 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 not called under Linux kernel versions 2.4.x
- Specified by:
accessin interfaceFuseOperations- Parameters:
path- file pathmask- bitwise OR of file access checks- Returns:
- 0 on success or negated error code (-errno)
-
create
Description copied from interface:FuseOperationsCreate and open a file.If the file does not exist, first create it with the specified mode, and then open it.
If this method is not implemented or under Linux kernel versions earlier than 2.6.15, the mknod() and open() methods will be called instead.
- Specified by:
createin interfaceFuseOperations- Parameters:
path- file pathmode- mode used to create the file if it does not exist yetfi- file info, which may be used to store a file handle- Returns:
- 0 on success or negated error code (-errno)
-
utimens
Description copied from interface:FuseOperationsChange the access and modification times of a file with nanosecond resolution.This supersedes the old utime() interface. New applications should use this.
See the utimensat(2) man page for details.
- Specified by:
utimensin interfaceFuseOperations- Parameters:
path- file pathatime- last access timemtime- last modified timefi- will always benullif the file is not currently open, but may also benullif the file is open.- Returns:
- 0 on success or negated error code (-errno)
-