API Reference wick v#0.1.0

Copy Markdown View Source

Modules

Build FUSE userspace filesystems on the BEAM.

Mount and unmount FUSE filesystems via the fusermount3 helper.

Low-level transport bindings for the Linux FUSE kernel ABI.

Pure-Elixir codec for the Linux FUSE kernel protocol, targeting FUSE_KERNEL_VERSION 7.31 (the version exposed by libfuse 3.10+ and the Linux 5.4+ kernel).

fuse_attr — the 88-byte embedded POSIX-attribute struct used inside fuse_entry_out, fuse_attr_out, and a few notification payloads.

fuse_in_header — the 40-byte prefix on every request the kernel sends to userspace.

Opcode-specific request structs and decode/2 dispatcher.

FUSE_BATCH_FORGET — fuse_batch_forget_in (8 bytes) followed by count × fuse_forget_one records. Exposed as a list of {nodeid, nlookup} tuples.

FUSE_CREATE — fuse_create_in (16 bytes) + name + NUL.

FUSE_DESTROY request — empty body.

FUSE_FALLOCATE — fuse_fallocate_in (32 bytes). Wick doesn't support sparse pre-allocation, so the session will reply -ENOSYS regardless of the fields; we still parse the body so decode-time validation works.

fuse_file_lock (24 bytes) — embedded in GetLk / SetLk requests and the matching GetLkReply. start / end are byte-range bounds (ignored for FLOCK semantics). type is one of 0 (F_RDLCK) / 1 (F_WRLCK) / 2 (F_UNLCK). pid is the requesting process id (kernel fills it for us; we echo it in GetLk replies).

FUSE_FLUSH — fuse_flush_in (24 bytes).

FUSE_FORGET — fuse_forget_in (8 bytes).

FUSE_FSYNC — fuse_fsync_in (16 bytes).

FUSE_FSYNCDIR — same wire layout as Fsync (fuse_fsync_in, 16 bytes); semantics differ (it flushes the directory's metadata rather than the file's data).

FUSE_GETATTR — fuse_getattr_in (16 bytes).

FUSE_GETLK — fuse_lk_in (48 bytes). Probes for a conflicting byte-range lock. lk_flags & FUSE_LK_FLOCK (= 1) is meaningless for GETLK in POSIX terms — the kernel doesn't issue GETLK for flock when FUSE_FLOCK_LOCKS is advertised; handlers fall back to F_UNLCK if it ever does.

FUSE_GETXATTR — fuse_getxattr_in (8 bytes) + name + NUL.

FUSE_INIT request — fuse_init_in (16 bytes).

FUSE_INTERRUPT — fuse_interrupt_in (8 bytes). Carries the unique of a previously-issued in-flight request that the kernel wants to cancel (e.g. because userspace received a signal during a blocking SETLKW).

FUSE_LISTXATTR — fuse_getxattr_in (8 bytes), no name. The nodeid in the request header identifies the file. Same size-probe convention as GetXattr.

FUSE_LOOKUP request — a NUL-terminated name. The parent directory is the nodeid in the request header.

FUSE_MKDIR — fuse_mkdir_in (8 bytes) + name + NUL.

FUSE_OPEN — fuse_open_in (8 bytes).

FUSE_READ — fuse_read_in (40 bytes).

FUSE_READDIR — fuse_read_in (40 bytes). Same wire layout as Read, but offset is a directory-stream cookie.

FUSE_READDIRPLUS — same wire layout as Readdir (fuse_read_in, 40 bytes). The reply layout differs (each entry carries inline attributes via fuse_direntplus).

FUSE_RELEASE — fuse_release_in (24 bytes).

FUSE_REMOVEXATTR — name + NUL. Nodeid in header.

FUSE_RENAME (12) — fuse_rename_in (8 bytes) with the new parent nodeid, then oldname+NUL, then newname+NUL. The old parent is in the request header.

FUSE_RENAME2 (45) — like RENAME plus a flags field.

FUSE_RMDIR — name + NUL. Parent nodeid in header.

FUSE_SETATTR — fuse_setattr_in (88 bytes).

FUSE_SETLK / FUSE_SETLKW — fuse_lk_in (48 bytes). The lk_flags & FUSE_LK_FLOCK (= 1) bit distinguishes whole-file flock(2) semantics from POSIX byte-range fcntl(F_SETLK) semantics. The same struct decodes both opcodes; the request atom (:setlk vs :setlkw) tells the handler whether to block.

FUSE_SETXATTR — fuse_setxattr_in (8 bytes for v7.31) + name + NUL + value.

FUSE_STATFS — empty body.

FUSE_UNLINK — name + NUL. Parent nodeid in header.

FUSE_WRITE — fuse_write_in (40 bytes) plus size bytes of payload.

Opcode-specific response structs and encode/1 dispatcher.

fuse_attr_out (104 bytes) — reply to GETATTR / SETATTR.

FUSE_CREATE reply — fuse_entry_out (128) + fuse_open_out (16) back-to-back. Modelled as a struct with two embedded replies to make pattern matching at the handler side easier.

A single directory entry for READDIR. On the wire this is a 24-byte header (ino, off, namelen, type) followed by the name bytes (no NUL) and 0–7 zero bytes of padding so each record ends on an 8-byte boundary.

A single READDIRPLUS entry — fuse_direntplus on the wire. The record is a 128-byte fuse_entry_out followed by the same 24-byte dirent header as Dirent, the name bytes (no NUL), and 0–7 zero bytes of padding so each record ends on an 8-byte boundary.

Marker for replies that carry only the 16-byte out-header.

fuse_entry_out (128 bytes) — reply to LOOKUP / MKDIR / CREATE (CREATE also appends an Open reply).

fuse_lk_out (24 bytes) — reply to GETLK. Carries a fuse_file_lock describing either the conflicting lock that would have been blocked, or F_UNLCK (type=2) when the range is free. SETLK / SETLKW success replies use Empty instead (header-only).

FUSE_INIT reply — fuse_init_out (64 bytes).

fuse_open_out (16 bytes) — reply to OPEN / OPENDIR.

FUSE_READ reply — a raw binary, length ≤ requested size. Used verbatim as the response body (no wrapper struct on the wire).

READDIR reply — an ordered list of Dirent records.

READDIRPLUS reply — an ordered list of DirentPlus records.

fuse_statfs_out / fuse_kstatfs (80 bytes) — reply to STATFS.

fuse_write_out (8 bytes) — reply to WRITE.

Reply to a real-fetch GETXATTR (request size > 0): the value bytes; or to LISTXATTR: the NUL-separated, NUL-terminated list of attribute names. The kernel rejects this reply with ERANGE if the data exceeds the buffer it allocated based on its prior probe — handlers are responsible for ensuring byte_size(data) fits within the request's size budget.

Reply to a size-probe GETXATTR / LISTXATTR (the request's size field was 0). The kernel uses the returned size to allocate a buffer and re-issue the request. Encoded as fuse_getxattr_out (8 bytes).