[][src]Trait fuser::Filesystem

pub trait Filesystem {
    pub fn init(
        &mut self,
        _req: &Request<'_>,
        _config: &mut KernelConfig
    ) -> Result<(), c_int> { ... }
pub fn destroy(&mut self, _req: &Request<'_>) { ... }
pub fn lookup(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        reply: ReplyEntry
    ) { ... }
pub fn forget(&mut self, _req: &Request<'_>, _ino: u64, _nlookup: u64) { ... }
pub fn getattr(&mut self, _req: &Request<'_>, _ino: u64, reply: ReplyAttr) { ... }
pub fn setattr(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _mode: Option<u32>,
        _uid: Option<u32>,
        _gid: Option<u32>,
        _size: Option<u64>,
        _atime: Option<TimeOrNow>,
        _mtime: Option<TimeOrNow>,
        _ctime: Option<SystemTime>,
        _fh: Option<u64>,
        _crtime: Option<SystemTime>,
        _chgtime: Option<SystemTime>,
        _bkuptime: Option<SystemTime>,
        _flags: Option<u32>,
        reply: ReplyAttr
    ) { ... }
pub fn readlink(&mut self, _req: &Request<'_>, _ino: u64, reply: ReplyData) { ... }
pub fn mknod(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        _mode: u32,
        _umask: u32,
        _rdev: u32,
        reply: ReplyEntry
    ) { ... }
pub fn mkdir(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        _mode: u32,
        _umask: u32,
        reply: ReplyEntry
    ) { ... }
pub fn unlink(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        reply: ReplyEmpty
    ) { ... }
pub fn rmdir(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        reply: ReplyEmpty
    ) { ... }
pub fn symlink(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        _link: &Path,
        reply: ReplyEntry
    ) { ... }
pub fn rename(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        _newparent: u64,
        _newname: &OsStr,
        _flags: u32,
        reply: ReplyEmpty
    ) { ... }
pub fn link(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _newparent: u64,
        _newname: &OsStr,
        reply: ReplyEntry
    ) { ... }
pub fn open(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _flags: i32,
        reply: ReplyOpen
    ) { ... }
pub fn read(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _offset: i64,
        _size: u32,
        _flags: i32,
        _lock_owner: Option<u64>,
        reply: ReplyData
    ) { ... }
pub fn write(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _offset: i64,
        _data: &[u8],
        _write_flags: u32,
        _flags: i32,
        _lock_owner: Option<u64>,
        reply: ReplyWrite
    ) { ... }
pub fn flush(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _lock_owner: u64,
        reply: ReplyEmpty
    ) { ... }
pub fn release(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _flags: i32,
        _lock_owner: Option<u64>,
        _flush: bool,
        reply: ReplyEmpty
    ) { ... }
pub fn fsync(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _datasync: bool,
        reply: ReplyEmpty
    ) { ... }
pub fn opendir(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _flags: i32,
        reply: ReplyOpen
    ) { ... }
pub fn readdir(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _offset: i64,
        reply: ReplyDirectory
    ) { ... }
pub fn readdirplus(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _offset: i64,
        reply: ReplyDirectoryPlus
    ) { ... }
pub fn releasedir(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _flags: i32,
        reply: ReplyEmpty
    ) { ... }
pub fn fsyncdir(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _datasync: bool,
        reply: ReplyEmpty
    ) { ... }
pub fn statfs(&mut self, _req: &Request<'_>, _ino: u64, reply: ReplyStatfs) { ... }
pub fn setxattr(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _name: &OsStr,
        _value: &[u8],
        _flags: i32,
        _position: u32,
        reply: ReplyEmpty
    ) { ... }
pub fn getxattr(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _name: &OsStr,
        _size: u32,
        reply: ReplyXattr
    ) { ... }
pub fn listxattr(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _size: u32,
        reply: ReplyXattr
    ) { ... }
pub fn removexattr(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _name: &OsStr,
        reply: ReplyEmpty
    ) { ... }
pub fn access(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _mask: i32,
        reply: ReplyEmpty
    ) { ... }
pub fn create(
        &mut self,
        _req: &Request<'_>,
        _parent: u64,
        _name: &OsStr,
        _mode: u32,
        _umask: u32,
        _flags: i32,
        reply: ReplyCreate
    ) { ... }
pub fn getlk(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _lock_owner: u64,
        _start: u64,
        _end: u64,
        _typ: i32,
        _pid: u32,
        reply: ReplyLock
    ) { ... }
pub fn setlk(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _lock_owner: u64,
        _start: u64,
        _end: u64,
        _typ: i32,
        _pid: u32,
        _sleep: bool,
        reply: ReplyEmpty
    ) { ... }
pub fn bmap(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _blocksize: u32,
        _idx: u64,
        reply: ReplyBmap
    ) { ... }
pub fn ioctl(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _flags: u32,
        _cmd: u32,
        _in_data: &[u8],
        _out_size: u32,
        reply: ReplyIoctl
    ) { ... }
pub fn fallocate(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _offset: i64,
        _length: i64,
        _mode: i32,
        reply: ReplyEmpty
    ) { ... }
pub fn lseek(
        &mut self,
        _req: &Request<'_>,
        _ino: u64,
        _fh: u64,
        _offset: i64,
        _whence: i32,
        reply: ReplyLseek
    ) { ... }
pub fn copy_file_range(
        &mut self,
        _req: &Request<'_>,
        _ino_in: u64,
        _fh_in: u64,
        _offset_in: i64,
        _ino_out: u64,
        _fh_out: u64,
        _offset_out: i64,
        _len: u64,
        _flags: u32,
        reply: ReplyWrite
    ) { ... } }

Filesystem trait.

This trait must be implemented to provide a userspace filesystem via FUSE. These methods correspond to fuse_lowlevel_ops in libfuse. Reasonable default implementations are provided here to get a mountable filesystem that does nothing.

Provided methods

pub fn init(
    &mut self,
    _req: &Request<'_>,
    _config: &mut KernelConfig
) -> Result<(), c_int>
[src]

Initialize filesystem. Called before any other filesystem method. The kernel module connection can be configured using the KernelConfig object

pub fn destroy(&mut self, _req: &Request<'_>)[src]

Clean up filesystem. Called on filesystem exit.

pub fn lookup(
    &mut self,
    _req: &Request<'_>,
    _parent: u64,
    _name: &OsStr,
    reply: ReplyEntry
)
[src]

Look up a directory entry by name and get its attributes.

pub fn forget(&mut self, _req: &Request<'_>, _ino: u64, _nlookup: u64)[src]

Forget about an inode. The nlookup parameter indicates the number of lookups previously performed on this inode. If the filesystem implements inode lifetimes, it is recommended that inodes acquire a single reference on each lookup, and lose nlookup references on each forget. The filesystem may ignore forget calls, if the inodes don't need to have a limited lifetime. On unmount it is not guaranteed, that all referenced inodes will receive a forget message.

pub fn getattr(&mut self, _req: &Request<'_>, _ino: u64, reply: ReplyAttr)[src]

Get file attributes.

pub fn setattr(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _mode: Option<u32>,
    _uid: Option<u32>,
    _gid: Option<u32>,
    _size: Option<u64>,
    _atime: Option<TimeOrNow>,
    _mtime: Option<TimeOrNow>,
    _ctime: Option<SystemTime>,
    _fh: Option<u64>,
    _crtime: Option<SystemTime>,
    _chgtime: Option<SystemTime>,
    _bkuptime: Option<SystemTime>,
    _flags: Option<u32>,
    reply: ReplyAttr
)
[src]

Set file attributes.

Read symbolic link.

pub fn mknod(
    &mut self,
    _req: &Request<'_>,
    _parent: u64,
    _name: &OsStr,
    _mode: u32,
    _umask: u32,
    _rdev: u32,
    reply: ReplyEntry
)
[src]

Create file node. Create a regular file, character device, block device, fifo or socket node.

pub fn mkdir(
    &mut self,
    _req: &Request<'_>,
    _parent: u64,
    _name: &OsStr,
    _mode: u32,
    _umask: u32,
    reply: ReplyEntry
)
[src]

Create a directory.

Remove a file.

pub fn rmdir(
    &mut self,
    _req: &Request<'_>,
    _parent: u64,
    _name: &OsStr,
    reply: ReplyEmpty
)
[src]

Remove a directory.

Create a symbolic link.

pub fn rename(
    &mut self,
    _req: &Request<'_>,
    _parent: u64,
    _name: &OsStr,
    _newparent: u64,
    _newname: &OsStr,
    _flags: u32,
    reply: ReplyEmpty
)
[src]

Rename a file.

Create a hard link.

pub fn open(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _flags: i32,
    reply: ReplyOpen
)
[src]

Open a file. Open flags (with the exception of O_CREAT, O_EXCL, O_NOCTTY and O_TRUNC) are available in flags. Filesystem may store an arbitrary file handle (pointer, index, etc) in 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 fh. There are also some flags (direct_io, keep_cache) which the filesystem may set, to change the way the file is opened. See fuse_file_info structure in <fuse_common.h> for more details.

pub fn read(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _offset: i64,
    _size: u32,
    _flags: i32,
    _lock_owner: Option<u64>,
    reply: ReplyData
)
[src]

Read data. Read should send 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 file has been opened in 'direct_io' mode, in which case the return value of the read system call will reflect the return value of this operation. fh will contain the value set by the open method, or will be undefined if the open method didn't set any value.

flags: these are the file flags, such as O_SYNC. Only supported with ABI >= 7.9 lock_owner: only supported with ABI >= 7.9

pub fn write(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _offset: i64,
    _data: &[u8],
    _write_flags: u32,
    _flags: i32,
    _lock_owner: Option<u64>,
    reply: ReplyWrite
)
[src]

Write data. Write should return exactly the number of bytes requested except on error. An exception to this is when the file has been opened in 'direct_io' mode, in which case the return value of the write system call will reflect the return value of this operation. fh will contain the value set by the open method, or will be undefined if the open method didn't set any value.

write_flags: will contain FUSE_WRITE_CACHE, if this write is from the page cache. If set, the pid, uid, gid, and fh may not match the value that would have been sent if write cachin is disabled flags: these are the file flags, such as O_SYNC. Only supported with ABI >= 7.9 lock_owner: only supported with ABI >= 7.9

pub fn flush(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _lock_owner: u64,
    reply: ReplyEmpty
)
[src]

Flush method. This is called on each close() of the opened file. Since file descriptors can be duplicated (dup, dup2, fork), for one open call there may be many flush calls. Filesystems shouldn't assume that flush will always be called after some writes, or that if will be called at all. fh will contain the value set by the open method, or will be undefined if the open method didn't set any value. NOTE: the name of the method is misleading, since (unlike fsync) the filesystem is not forced to flush pending writes. One reason to flush data, is if the filesystem wants to return write errors. If the filesystem supports file locking operations (setlk, getlk) it should remove all locks belonging to 'lock_owner'.

pub fn release(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _flags: i32,
    _lock_owner: Option<u64>,
    _flush: bool,
    reply: ReplyEmpty
)
[src]

Release 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. The filesystem may reply with an error, but error values are not returned to close() or munmap() which triggered the release. fh will contain the value set by the open method, or will be undefined if the open method didn't set any value. flags will contain the same flags as for open.

pub fn fsync(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _datasync: bool,
    reply: ReplyEmpty
)
[src]

Synchronize file contents. If the datasync parameter is non-zero, then only the user data should be flushed, not the meta data.

pub fn opendir(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _flags: i32,
    reply: ReplyOpen
)
[src]

Open a directory. Filesystem may store an arbitrary file handle (pointer, index, etc) in fh, and use this in other all other directory stream operations (readdir, releasedir, fsyncdir). Filesystem may also implement stateless directory I/O and not store anything in fh, though that makes it impossible to implement standard conforming directory stream operations in case the contents of the directory can change between opendir and releasedir.

pub fn readdir(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _offset: i64,
    reply: ReplyDirectory
)
[src]

Read directory. Send a buffer filled using buffer.fill(), with size not exceeding the requested size. Send an empty buffer on end of stream. fh will contain the value set by the opendir method, or will be undefined if the opendir method didn't set any value.

pub fn readdirplus(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _offset: i64,
    reply: ReplyDirectoryPlus
)
[src]

Read directory. Send a buffer filled using buffer.fill(), with size not exceeding the requested size. Send an empty buffer on end of stream. fh will contain the value set by the opendir method, or will be undefined if the opendir method didn't set any value.

pub fn releasedir(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _flags: i32,
    reply: ReplyEmpty
)
[src]

Release an open directory. For every opendir call there will be exactly one releasedir call. fh will contain the value set by the opendir method, or will be undefined if the opendir method didn't set any value.

pub fn fsyncdir(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _datasync: bool,
    reply: ReplyEmpty
)
[src]

Synchronize directory contents. If the datasync parameter is set, then only the directory contents should be flushed, not the meta data. fh will contain the value set by the opendir method, or will be undefined if the opendir method didn't set any value.

pub fn statfs(&mut self, _req: &Request<'_>, _ino: u64, reply: ReplyStatfs)[src]

Get file system statistics.

pub fn setxattr(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _name: &OsStr,
    _value: &[u8],
    _flags: i32,
    _position: u32,
    reply: ReplyEmpty
)
[src]

Set an extended attribute.

pub fn getxattr(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _name: &OsStr,
    _size: u32,
    reply: ReplyXattr
)
[src]

Get an extended attribute. If size is 0, the size of the value should be sent with reply.size(). If size is not 0, and the value fits, send it with reply.data(), or reply.error(ERANGE) if it doesn't.

pub fn listxattr(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _size: u32,
    reply: ReplyXattr
)
[src]

List extended attribute names. If size is 0, the size of the value should be sent with reply.size(). If size is not 0, and the value fits, send it with reply.data(), or reply.error(ERANGE) if it doesn't.

pub fn removexattr(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _name: &OsStr,
    reply: ReplyEmpty
)
[src]

Remove an extended attribute.

pub fn access(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _mask: i32,
    reply: ReplyEmpty
)
[src]

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 not called under Linux kernel versions 2.4.x

pub fn create(
    &mut self,
    _req: &Request<'_>,
    _parent: u64,
    _name: &OsStr,
    _mode: u32,
    _umask: u32,
    _flags: i32,
    reply: ReplyCreate
)
[src]

Create and open a file. If the file does not exist, first create it with the specified mode, and then open it. Open flags (with the exception of O_NOCTTY) are available in flags. Filesystem may store an arbitrary file handle (pointer, index, etc) in fh, and use this in other all other file operations (read, write, flush, release, fsync). There are also some flags (direct_io, keep_cache) which the filesystem may set, to change the way the file is opened. See fuse_file_info structure in <fuse_common.h> for more details. 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.

pub fn getlk(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _lock_owner: u64,
    _start: u64,
    _end: u64,
    _typ: i32,
    _pid: u32,
    reply: ReplyLock
)
[src]

Test for a POSIX file lock.

pub fn setlk(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _lock_owner: u64,
    _start: u64,
    _end: u64,
    _typ: i32,
    _pid: u32,
    _sleep: bool,
    reply: ReplyEmpty
)
[src]

Acquire, modify or release a POSIX file lock. For POSIX threads (NPTL) there's a 1-1 relation between pid and owner, but otherwise this is not always the case. For checking lock ownership, 'fi->owner' must be used. The l_pid field in 'struct flock' should only be used to fill in this field in getlk(). Note: if the locking methods are not implemented, the kernel will still allow file locking to work locally. Hence these are only interesting for network filesystems and similar.

pub fn bmap(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _blocksize: u32,
    _idx: u64,
    reply: ReplyBmap
)
[src]

Map block index within file to block index within device. Note: This makes sense only for block device backed filesystems mounted with the 'blkdev' option

pub fn ioctl(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _flags: u32,
    _cmd: u32,
    _in_data: &[u8],
    _out_size: u32,
    reply: ReplyIoctl
)
[src]

control device

pub fn fallocate(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _offset: i64,
    _length: i64,
    _mode: i32,
    reply: ReplyEmpty
)
[src]

Preallocate or deallocate space to a file

pub fn lseek(
    &mut self,
    _req: &Request<'_>,
    _ino: u64,
    _fh: u64,
    _offset: i64,
    _whence: i32,
    reply: ReplyLseek
)
[src]

Reposition read/write file offset

pub fn copy_file_range(
    &mut self,
    _req: &Request<'_>,
    _ino_in: u64,
    _fh_in: u64,
    _offset_in: i64,
    _ino_out: u64,
    _fh_out: u64,
    _offset_out: i64,
    _len: u64,
    _flags: u32,
    reply: ReplyWrite
)
[src]

Copy the specified range from the source inode to the destination inode

Loading content...

Implementors

Loading content...