Skip to main content

Crate btrfs_fs

Crate btrfs_fs 

Source
Expand description

High-level filesystem API on top of btrfs-disk.

Filesystem exposes the operations a userspace driver needs: lookup, readdir, read, readlink, getattr, xattr_get, xattr_list, and statfs. Each returns plain std::io::Result values and does not depend on any FUSE protocol crate, so the same API drives the btrfs-fuse mount and any other embedder (offline tools, tests, alternate FUSE bindings).

§Inode model

Inode is the pair (subvol, ino). For now only the default subvolume is exposed, but multi-subvolume support is the next phase and the API is shaped for it from the start. Callers that need a flat u64 (e.g. FUSE) translate at the boundary.

§Status

Read-only. Write support is planned via the btrfs-transaction crate; see the project roadmap.

Re-exports§

pub use dir::Entry;
pub use dir::FileKind;
pub use stat::Stat;

Modules§

dir
Directory entries and the file-kind enum.
stat
POSIX-style inode metadata returned by crate::Filesystem::getattr.

Structs§

CacheConfig
Capacities for the three caches a crate::Filesystem holds. Pass to crate::Filesystem::open_with_caches / crate::Filesystem::open_subvol_with_caches to override the defaults — useful for memory-constrained embedders or benchmarking the cold path.
CacheStats
Live counters for an LruTreeBlockCache. Useful for tests, benchmarks, and embedders who want to expose cache hit ratios via metrics.
DeviceItem
Device item describing a single device in the filesystem.
Filesystem
High-level read-only btrfs filesystem.
Inode
A filesystem-level inode reference: the subvolume it lives in plus the on-disk objectid within that subvolume.
LruTreeBlockCache
LRU-evicting TreeBlockCache keyed by logical address.
RootRef
Reference linking a subvolume to its parent directory.
SearchFilter
Compound-key range filter for Filesystem::tree_search. Mirrors the kernel’s btrfs_ioctl_search_key semantics: items are returned where (min_objectid, min_type, min_offset) <= (key) <= (max_objectid, max_type, max_offset) treated as a single 17-byte compound key, AND the leaf’s generation falls in [min_transid, max_transid].
SearchItem
One item returned by Filesystem::tree_search. transid is the leaf’s generation (matching the kernel ioctl’s btrfs_ioctl_search_header.transid).
StatFs
Filesystem-wide statistics, returned by Filesystem::statfs.
SubvolId
Identifier for a subvolume tree (the tree’s root objectid).
SubvolInfo
Metadata for a single subvolume, returned by Filesystem::list_subvolumes and Filesystem::get_subvol_info.
Superblock
Parsed btrfs superblock.
Uuid
A Universally Unique Identifier (UUID).

Enums§

SeekHoleData
Whence value for Filesystem::seek_hole_data. Maps to the POSIX SEEK_HOLE / SEEK_DATA whence constants used by lseek(2).