class Fuse::FileSystem
- Fuse::FileSystem
- Reference
- Object
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:
- path
String
, the path of the file or directory - handle
UInt64
, a numeric file handle - buffer
Bytes
, a input or output buffer - fi
Binding::FileInfo
, handle information passed from FUSE - offset
LibC::OffT
, an offset in a file or directory listing
These arguments may not have explicit data types for readability purposes.
Exceptions are noted in each methods documentation.
Defined in:
fuse/file_system.crConstructors
Instance Method Summary
-
#getattr(path) : LibC::Stat | Int32 | Nil
Gets a
LibC::Stat
for the given path. -
#open(path) : UInt64 | Int32 | Nil
Opens a file at path.
-
#opendir(path) : UInt64 | Int32 | Nil
Opens a directory at path.
- #operations : Binding::Operations
- #operations=(operations : Binding::Operations)
-
#read(path, handle, buffer : Bytes, offset, fi) : Int32 | Nil
Reads an open file.
-
#readdir(path, handle, offset, fi) : Enumerable(String) | Enumerable(Tuple(String, LibC::Stat)) | Int32 | Nil
Reads the entries of a directory.
-
#readlink(path) : String | Nil
Reads a symlink.
-
#release(path, handle, fi) : Int32 | Nil
Closes a file at path.
-
#releasedir(path, handle, fi) : Int32 | Nil
Closes a directory at path.
-
#run!(argv : Enumerable(String) = ARGV)
Runs the file system.
- #write(path, handle, buffer : Bytes, offset, fi) : Int32 | Nil
Constructor Detail
Instance Method Detail
Gets a LibC::Stat
for the given path. An example path is
/foo/bar.txt
.
Opens a file at path.
Watch out: Return a UInt64
for a file-handle, and return a Int32
to return an errno error!
Reads an open file. Return the read bytes on success.
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.
Closes a file at path. Please read more about it in
Binding::Operations#release
. Return 0
on success.
Runs the file system. This will block until the file-system has been unmounted.