Merge pull request #203 from arihant2math/statfs

Implement `sys_statfs` and `sys_fstatfs`
This commit is contained in:
Matthew Leach
2026-02-15 20:05:13 +00:00
committed by GitHub
13 changed files with 134 additions and 3 deletions

View File

@@ -362,6 +362,11 @@ where
self.id
}
fn magic(&self) -> u64 {
// TODO: retrieve magic from superblock instead of hardcoding
0xef53 // EXT4 magic number
}
/// Returns the root inode of the mounted EXT4 filesystem.
async fn root_inode(&self) -> Result<Arc<dyn Inode>> {
let root = self.inner.read_root_inode().await?;

View File

@@ -168,6 +168,10 @@ impl Filesystem for Fat32Filesystem {
self.id
}
fn magic(&self) -> u64 {
0x4D44 // MSDOS magic number
}
/// Get the root inode of this filesystem.
async fn root_inode(&self) -> Result<Arc<dyn Inode>> {
Ok(Arc::new(Fat32DirNode::new(

View File

@@ -821,6 +821,10 @@ where
fn id(&self) -> u64 {
self.id
}
fn magic(&self) -> u64 {
0x01021994 // Tmpfs magic number
}
}
#[cfg(test)]

View File

@@ -65,6 +65,9 @@ pub trait Filesystem: Send + Sync {
/// Returns the instance ID for this FS.
fn id(&self) -> u64;
/// Get magic
fn magic(&self) -> u64;
/// Flushes all pending data to the underlying storage device(s).
///
/// The default implementation is a no-op so that read-only filesystems do