Skip to main content

fs_core/
lib.rs

1#![cfg_attr(not(feature = "std"), no_std)]
2
3extern crate alloc;
4
5// Logging support: conditional compilation for zero-cost when disabled
6#[cfg(feature = "logging")]
7pub use log::{debug, error, info, trace, warn};
8
9#[cfg(not(feature = "logging"))]
10#[macro_export]
11macro_rules! trace {
12    ($($t:tt)*) => {};
13}
14
15#[cfg(not(feature = "logging"))]
16#[macro_export]
17macro_rules! debug {
18    ($($t:tt)*) => {};
19}
20
21#[cfg(not(feature = "logging"))]
22#[macro_export]
23macro_rules! info {
24    ($($t:tt)*) => {};
25}
26
27#[cfg(not(feature = "logging"))]
28#[macro_export]
29macro_rules! warn {
30    ($($t:tt)*) => {};
31}
32
33#[cfg(not(feature = "logging"))]
34#[macro_export]
35macro_rules! error {
36    ($($t:tt)*) => {};
37}
38
39mod error;
40mod handle;
41mod inode;
42pub mod snapshot;
43mod storage;
44mod time;
45mod types;
46
47// Filesystem implementation: choose based on thread-safe feature
48// - thread-safe: Arc<RwLock> + DashMap (for vfs-host, requires Send+Sync)
49// - single-threaded: Rc<RefCell> + HashMap (for vfs-adapter, vfs-rpc-server)
50#[cfg(feature = "thread-safe")]
51mod fs;
52#[cfg(not(feature = "thread-safe"))]
53#[path = "fs_singlethread.rs"]
54mod fs;
55
56// Re-export public API
57pub use error::FsError;
58pub use fs::Fs;
59pub use inode::{FileContent, Inode, Metadata};
60pub use storage::BlockStorage;
61pub use time::{MonotonicCounter, TimeProvider};
62pub use types::{BLOCK_SIZE, Fd, InodeId, O_APPEND, O_CREAT, O_RDONLY, O_RDWR, O_TRUNC, O_WRONLY};