module

Fuse

handle_table.cr

OPTIONAL helper — not loaded by require "crystalfuse". Pull it in explicitly with require "crystalfuse/handle_table" if you want a ready-made registry for file handles.

Typical use from a FileSystem:

@open = Fuse::HandleTable(MyOpenFile).new

def open(path : String, fi : Fuse::FileInfo) : Int32
  fi.fh = @open.add(MyOpenFile.new(path))
  0
end

def read(path, size, offset, fi : Fuse::FileInfo) : Bytes | Int32
  (f = @open[fi.fh]?) ? f.read(size, offset) : -Errno::EBADF.value
end

def release(path, fi : Fuse::FileInfo) : Int32
  @open.delete(fi.fh)
  0
end

Constants

VERSION = "0.3.0"

Class methods

mount(fs : FileSystem, args : Array(String)) : Int32

Mount fs, passing args (an argv-style array, e.g. ["myfs", "-f", "/mnt/point"]) straight through to libfuse. Blocks until the filesystem is unmounted. Returns libfuse's exit status.

Source

Nested types