Add statvfs

This commit is contained in:
Jeremy Soller 2016-11-18 08:44:03 -07:00
parent 35e9253365
commit 121fb0b781
7 changed files with 16 additions and 7 deletions

View file

@ -425,6 +425,7 @@ coreutils: \
filesystem/bin/cut \ filesystem/bin/cut \
filesystem/bin/date \ filesystem/bin/date \
filesystem/bin/dd \ filesystem/bin/dd \
filesystem/bin/df \
filesystem/bin/du \ filesystem/bin/du \
filesystem/bin/echo \ filesystem/bin/echo \
filesystem/bin/env \ filesystem/bin/env \

View file

@ -11,7 +11,7 @@ use context::{self, Context};
use context::memory::Grant; use context::memory::Grant;
use scheme::{AtomicSchemeId, ATOMIC_SCHEMEID_INIT, SchemeId}; use scheme::{AtomicSchemeId, ATOMIC_SCHEMEID_INIT, SchemeId};
use sync::{WaitQueue, WaitMap}; use sync::{WaitQueue, WaitMap};
use syscall::data::{Packet, Stat}; use syscall::data::{Packet, Stat, StatVfs};
use syscall::error::*; use syscall::error::*;
use syscall::flag::{EVENT_READ, O_NONBLOCK}; use syscall::flag::{EVENT_READ, O_NONBLOCK};
use syscall::number::*; use syscall::number::*;
@ -332,7 +332,15 @@ impl Scheme for UserScheme {
fn fstat(&self, file: usize, stat: &mut Stat) -> Result<usize> { fn fstat(&self, file: usize, stat: &mut Stat) -> Result<usize> {
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?; let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
let address = inner.capture_mut(stat)?; let address = inner.capture_mut(stat)?;
let result = inner.call(SYS_FSTAT, file, address, 0); let result = inner.call(SYS_FSTAT, file, address, mem::size_of::<Stat>());
let _ = inner.release(address);
result
}
fn fstatvfs(&self, file: usize, stat: &mut StatVfs) -> Result<usize> {
let inner = self.inner.upgrade().ok_or(Error::new(ENODEV))?;
let address = inner.capture_mut(stat)?;
let result = inner.call(SYS_FSTATVFS, file, address, mem::size_of::<StatVfs>());
let _ = inner.release(address); let _ = inner.release(address);
result result
} }

@ -1 +1 @@
Subproject commit 4b58de0b3c66634f95668e47466014138c5f71bd Subproject commit 3308c4507cfe7c3922e41ad472d792dac864e83f

@ -1 +1 @@
Subproject commit 1d0e93bb3c35ef58cd1ad8039b30701033ff2e98 Subproject commit b3d8bf61860cd4c7c2263b2798779aa182cab1d6

@ -1 +1 @@
Subproject commit fca407875c4184d17105fe2d455d0f1e85f80a05 Subproject commit 2ce04b5f82a04f9d88ed8664dde18fc2468a046f

@ -1 +1 @@
Subproject commit 31605167ceb20bc3e2ffb6ef0b15fc05ca16ad7c Subproject commit dcaf5c76be265bbfa5013cf131f14fa79680a634

@ -1 +1 @@
Subproject commit 8ce29a6ea29042d4101733cc25e84a013a74018a Subproject commit cc90408d147cc1d23b0e820d5b47522bd7dfc847