mirror of
https://github.com/hexagonal-sun/moss-kernel.git
synced 2026-04-20 07:08:37 -04:00
Merge pull request #203 from arihant2math/statfs
Implement `sys_statfs` and `sys_fstatfs`
This commit is contained in:
@@ -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?;
|
||||
|
||||
@@ -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(
|
||||
|
||||
@@ -821,6 +821,10 @@ where
|
||||
fn id(&self) -> u64 {
|
||||
self.id
|
||||
}
|
||||
|
||||
fn magic(&self) -> u64 {
|
||||
0x01021994 // Tmpfs magic number
|
||||
}
|
||||
}
|
||||
|
||||
#[cfg(test)]
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user