Skip to main content

btrfs_fs/
lib.rs

1//! High-level filesystem API on top of `btrfs-disk`.
2//!
3//! [`Filesystem`] exposes the operations a userspace driver needs:
4//! `lookup`, `readdir`, `read`, `readlink`, `getattr`, `xattr_get`,
5//! `xattr_list`, and `statfs`. Each returns plain `std::io::Result`
6//! values and does not depend on any FUSE protocol crate, so the same
7//! API drives the [`btrfs-fuse`] mount and any other embedder
8//! (offline tools, tests, alternate FUSE bindings).
9//!
10//! # Inode model
11//!
12//! [`Inode`] is the pair `(subvol, ino)`. For now only the default
13//! subvolume is exposed, but multi-subvolume support is the next phase
14//! and the API is shaped for it from the start. Callers that need a
15//! flat `u64` (e.g. FUSE) translate at the boundary.
16//!
17//! # Status
18//!
19//! Read-only. Write support is planned via the `btrfs-transaction`
20//! crate; see the project roadmap.
21//!
22//! [`btrfs-fuse`]: https://docs.rs/btrfs-fuse
23
24#![warn(clippy::pedantic)]
25#![allow(
26    clippy::missing_errors_doc,
27    clippy::missing_panics_doc,
28    clippy::module_name_repetitions
29)]
30
31mod cache;
32mod filesystem;
33mod read;
34mod xattr;
35
36pub mod dir;
37pub mod stat;
38
39pub use btrfs_disk::{
40    items::{DeviceItem, RootRef},
41    superblock::Superblock,
42};
43pub use cache::{CacheConfig, CacheStats, LruTreeBlockCache};
44pub use dir::{Entry, FileKind};
45pub use filesystem::{
46    Filesystem, Inode, SearchFilter, SearchItem, SeekHoleData, StatFs,
47    SubvolId, SubvolInfo,
48};
49pub use stat::Stat;
50pub use uuid::Uuid;