class Fuse::FileSystem

Overview

Base class for user-defined file systems. Sub-class it and build your own! Use #run! to start it.

There are many methods in this class, but you'll probably only need a couple. Most expect a return type of something (Which is the result and is treated as success), Int32 (Treated as errno code) or nil which will return a ENOSYS (Function not implemented).

Standard arguments are:

These arguments may not have explicit data types for readability purposes.

Exceptions are noted in each methods documentation.

Defined in:

fuse/file_system.cr

Constructors

Instance Method Summary

Constructor Detail

def self.new #

[View source]

Instance Method Detail

def getattr(path) : LibC::Stat | Int32 | Nil #

Gets a LibC::Stat for the given path. An example path is /foo/bar.txt.


[View source]
def open(path) : UInt64 | Int32 | Nil #

Opens a file at path. Watch out: Return a UInt64 for a file-handle, and return a Int32 to return an errno error!


[View source]
def opendir(path) : UInt64 | Int32 | Nil #

Opens a directory at path. Analogous to #open


[View source]
def operations : Binding::Operations #

[View source]
def operations=(operations : Binding::Operations) #

[View source]
def read(path, handle, buffer : Bytes, offset, fi) : Int32 | Nil #

Reads an open file. Return the read bytes on success.


[View source]
def readdir(path, handle, offset, fi) : Enumerable(String) | Enumerable(Tuple(String, LibC::Stat)) | Int32 | Nil #

Reads the entries of a directory. The "." and ".." entries are added automatically. The result may be any enumerable of Strings, or a tuple of a string and a LibC::Stat. If the result is a integer, it's used as resulting error code.


[View source]
def readlink(path) : String | Nil #

Reads a symlink. Returns a string with the target path or nil.


[View source]
def release(path, handle, fi) : Int32 | Nil #

Closes a file at path. Please read more about it in Binding::Operations#release. Return 0 on success.


[View source]
def releasedir(path, handle, fi) : Int32 | Nil #

Closes a directory at path. Analogous to #release


[View source]
def run!(argv : Enumerable(String) = ARGV) #

Runs the file system. This will block until the file-system has been unmounted.


[View source]
def write(path, handle, buffer : Bytes, offset, fi) : Int32 | Nil #

[View source]