diff --git a/kernel/Cargo.lock b/kernel/Cargo.lock index b4870cf0..f95c60c6 100644 --- a/kernel/Cargo.lock +++ b/kernel/Cargo.lock @@ -409,7 +409,7 @@ dependencies = [ [[package]] name = "rcore-fs" version = "0.1.0" -source = "git+https://github.com/rcore-os/rcore-fs#585eb6197aa687320618ee8c3c550a4e32aa9d15" +source = "git+https://github.com/rcore-os/rcore-fs#ee0d0b31a1cea4c905100cef501a3bc522ded00d" dependencies = [ "spin 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -417,7 +417,7 @@ dependencies = [ [[package]] name = "rcore-fs-sfs" version = "0.1.0" -source = "git+https://github.com/rcore-os/rcore-fs#585eb6197aa687320618ee8c3c550a4e32aa9d15" +source = "git+https://github.com/rcore-os/rcore-fs#ee0d0b31a1cea4c905100cef501a3bc522ded00d" dependencies = [ "bitvec 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)", "log 0.4.6 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/kernel/src/drivers/bus/pci.rs b/kernel/src/drivers/bus/pci.rs index 48a254fa..c1226469 100644 --- a/kernel/src/drivers/bus/pci.rs +++ b/kernel/src/drivers/bus/pci.rs @@ -175,9 +175,7 @@ pub fn init_driver(dev: &PCIDevice) { assert!(len as usize <= PAGE_SIZE); let vaddr = phys_to_virt(addr as usize); if let Some(driver) = ahci::init(irq, vaddr, len as usize) { - PCI_DRIVERS - .lock() - .insert(dev.loc, driver); + PCI_DRIVERS.lock().insert(dev.loc, driver); } } } diff --git a/kernel/src/fs/file.rs b/kernel/src/fs/file.rs index 538b53c3..1f409a07 100644 --- a/kernel/src/fs/file.rs +++ b/kernel/src/fs/file.rs @@ -50,21 +50,23 @@ impl FileHandle { return Err(FsError::InvalidParam); // FIXME: => EBADF } let mut len: usize = 0; - /* if !self.options.nonblock { // block loop { - len = self.inode.read_at(offset, buf)?; - if len > 0 { - break; + match self.inode.read_at(offset, buf) { + Ok(read_len) => { + len = read_len; + break; + } + Err(FsError::Again) => {} + Err(err) => { + return Err(err); + } } } } else { len = self.inode.read_at(offset, buf)?; } - */ - // TODO: handle block/nonblock correctly - len = self.inode.read_at(offset, buf)?; Ok(len) } diff --git a/kernel/src/fs/file_like.rs b/kernel/src/fs/file_like.rs index d489e01b..bd45dc8e 100644 --- a/kernel/src/fs/file_like.rs +++ b/kernel/src/fs/file_like.rs @@ -32,7 +32,7 @@ impl FileLike { } pub fn ioctl(&mut self, request: usize, arg1: usize, arg2: usize, arg3: usize) -> SysResult { match request { - // TODO: place flags & path in FileLike in stead of FileHandle/Socket + // TODO: place flags & path in FileLike instead of FileHandle/Socket FIOCLEX => Ok(0), FIONBIO => Ok(0), _ => { diff --git a/kernel/src/fs/pseudo.rs b/kernel/src/fs/pseudo.rs index fdcc5358..273a200e 100644 --- a/kernel/src/fs/pseudo.rs +++ b/kernel/src/fs/pseudo.rs @@ -72,6 +72,7 @@ impl INode for Pseudo { nlinks: 0, uid: 0, gid: 0, + rdev: 0, }) } impl_inode!(); diff --git a/kernel/src/fs/stdio.rs b/kernel/src/fs/stdio.rs index fae5dc74..a3f84a1d 100644 --- a/kernel/src/fs/stdio.rs +++ b/kernel/src/fs/stdio.rs @@ -95,7 +95,7 @@ impl INode for Stdin { buf[0] = self.pop() as u8; Ok(1) } else { - Ok(0) + Err(FsError::Again) } } fn write_at(&self, _offset: usize, _buf: &[u8]) -> Result { diff --git a/kernel/src/fs/vga.rs b/kernel/src/fs/vga.rs index b3faa6b2..3f34116f 100755 --- a/kernel/src/fs/vga.rs +++ b/kernel/src/fs/vga.rs @@ -64,6 +64,7 @@ impl INode for Vga { nlinks: 0, uid: 0, gid: 0, + rdev: 0, }) } fn io_control(&self, cmd: u32, data: usize) -> Result<()> { diff --git a/kernel/src/syscall/fs.rs b/kernel/src/syscall/fs.rs index 5e3c46fd..27f8464f 100644 --- a/kernel/src/syscall/fs.rs +++ b/kernel/src/syscall/fs.rs @@ -948,6 +948,9 @@ impl From for SysError { FsError::DirNotEmpty => SysError::ENOTEMPTY, FsError::WrongFs => SysError::EINVAL, FsError::DeviceError => SysError::EIO, + FsError::IOCTLError => SysError::EINVAL, + FsError::NoDevice => SysError::EINVAL, + FsError::Again => SysError::EAGAIN, } } } diff --git a/user b/user index bf02e72b..4f90dd04 160000 --- a/user +++ b/user @@ -1 +1 @@ -Subproject commit bf02e72b85784af3555c7abe6b985aefc215023e +Subproject commit 4f90dd042bacdb7eee61ae35ab60b9e17bc70cf7