1use crate::vfs::{FsError, Inode};
2use alloc::string::String;
3use alloc::sync::Arc;
4
5pub trait FileSystem: Send + Sync {
9 fn fs_type(&self) -> &'static str;
14
15 fn root_inode(&self) -> Arc<dyn Inode>;
19
20 fn sync(&self) -> Result<(), FsError>;
24
25 fn statfs(&self) -> Result<StatFs, FsError>;
27
28 fn umount(&self) -> Result<(), FsError> {
32 self.sync()
33 }
34}
35
36#[derive(Debug, Clone)]
38pub struct StatFs {
39 pub block_size: usize,
41
42 pub total_blocks: usize,
44
45 pub free_blocks: usize,
47
48 pub available_blocks: usize,
50
51 pub total_inodes: usize,
53
54 pub free_inodes: usize,
56
57 pub fsid: u64,
59
60 pub max_filename_len: usize,
62}