1
0
mirror of https://github.com/rcore-os/rCore.git synced 2025-01-19 01:07:05 +04:00

Updata rcore-fs version to 7e7c74a

Support non-zero return value for INode::io_control()
This commit is contained in:
equation314 2020-04-14 20:24:27 +08:00
parent f9bfd157b7
commit 395b8b51c1
6 changed files with 40 additions and 45 deletions

38
kernel/Cargo.lock generated
View File

@ -363,11 +363,11 @@ dependencies = [
"raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)",
"rboot 0.1.2",
"rcore-console 0.1.0 (git+https://github.com/rcore-os/rcore-console?rev=b7bacf9)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs-devfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs-mountfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs-ramfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs-sfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"rcore-fs-devfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"rcore-fs-mountfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"rcore-fs-ramfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"rcore-fs-sfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"rcore-memory 0.1.0",
"rcore-thread 0.1.0 (git+https://github.com/rcore-os/rcore-thread?rev=d727949b)",
"riscv 0.5.0 (git+https://github.com/rcore-os/riscv)",
@ -393,7 +393,7 @@ dependencies = [
[[package]]
name = "rcore-fs"
version = "0.1.0"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac#7f5eeac8b77f6bab11f6f2ce631a194bee658555"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a#7e7c74a921803d6c8edc99b8ebb6fc85774819b9"
dependencies = [
"filetime 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)",
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
@ -403,42 +403,42 @@ dependencies = [
[[package]]
name = "rcore-fs-devfs"
version = "0.1.0"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac#7f5eeac8b77f6bab11f6f2ce631a194bee658555"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a#7e7c74a921803d6c8edc99b8ebb6fc85774819b9"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rcore-fs-mountfs"
version = "0.1.0"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac#7f5eeac8b77f6bab11f6f2ce631a194bee658555"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a#7e7c74a921803d6c8edc99b8ebb6fc85774819b9"
dependencies = [
"lazy_static 1.4.0 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rcore-fs-ramfs"
version = "0.1.0"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac#7f5eeac8b77f6bab11f6f2ce631a194bee658555"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a#7e7c74a921803d6c8edc99b8ebb6fc85774819b9"
dependencies = [
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
]
[[package]]
name = "rcore-fs-sfs"
version = "0.1.0"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac#7f5eeac8b77f6bab11f6f2ce631a194bee658555"
source = "git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a#7e7c74a921803d6c8edc99b8ebb6fc85774819b9"
dependencies = [
"bitvec 0.17.2 (registry+https://github.com/rust-lang/crates.io-index)",
"log 0.4.8 (registry+https://github.com/rust-lang/crates.io-index)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)",
"rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)",
"spin 0.5.2 (registry+https://github.com/rust-lang/crates.io-index)",
"static_assertions 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)",
]
@ -758,11 +758,11 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)" = "30a9d219c32c9132f7be513c18be77c9881c7107d2ab5569d205a6a0f0e6dc7d"
"checksum raw-cpuid 7.0.3 (registry+https://github.com/rust-lang/crates.io-index)" = "b4a349ca83373cfa5d6dbb66fd76e58b2cca08da71a5f6400de0a0a6a9bceeaf"
"checksum rcore-console 0.1.0 (git+https://github.com/rcore-os/rcore-console?rev=b7bacf9)" = "<none>"
"checksum rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)" = "<none>"
"checksum rcore-fs-devfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)" = "<none>"
"checksum rcore-fs-mountfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)" = "<none>"
"checksum rcore-fs-ramfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)" = "<none>"
"checksum rcore-fs-sfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7f5eeac)" = "<none>"
"checksum rcore-fs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)" = "<none>"
"checksum rcore-fs-devfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)" = "<none>"
"checksum rcore-fs-mountfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)" = "<none>"
"checksum rcore-fs-ramfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)" = "<none>"
"checksum rcore-fs-sfs 0.1.0 (git+https://github.com/rcore-os/rcore-fs?rev=7e7c74a)" = "<none>"
"checksum rcore-thread 0.1.0 (git+https://github.com/rcore-os/rcore-thread?rev=d727949b)" = "<none>"
"checksum redox_syscall 0.1.56 (registry+https://github.com/rust-lang/crates.io-index)" = "2439c63f3f6139d1b57529d16bc3b8bb855230c8efcc5d3a896c8bea7c3b1e84"
"checksum register 0.2.1 (registry+https://github.com/rust-lang/crates.io-index)" = "e10f31b6d2299e5620986ad9fcdd66463e125ad72af4f403f9aedf7592d5ccdb"

View File

@ -66,11 +66,11 @@ bitmap-allocator = { git = "https://github.com/rcore-os/bitmap-allocator" }
rcore-console = { git = "https://github.com/rcore-os/rcore-console", rev = "b7bacf9", default-features = false }
rcore-memory = { path = "../crate/memory" }
rcore-thread = { git = "https://github.com/rcore-os/rcore-thread", rev = "d727949b" }
rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7f5eeac" }
rcore-fs-sfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7f5eeac" }
rcore-fs-ramfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7f5eeac" }
rcore-fs-mountfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7f5eeac" }
rcore-fs-devfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7f5eeac" }
rcore-fs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7e7c74a" }
rcore-fs-sfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7e7c74a" }
rcore-fs-ramfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7e7c74a" }
rcore-fs-mountfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7e7c74a" }
rcore-fs-devfs = { git = "https://github.com/rcore-os/rcore-fs", rev = "7e7c74a" }
compression = { version = "0.1.4", default-features = false, features = ["gzip"] }

View File

@ -66,7 +66,7 @@ impl INode for Fbdev {
rdev: make_rdev(29, 0),
})
}
fn io_control(&self, cmd: u32, data: usize) -> Result<()> {
fn io_control(&self, cmd: u32, data: usize) -> Result<usize> {
const FBIOGET_VSCREENINFO: u32 = 0x4600;
const FBIOGET_FSCREENINFO: u32 = 0x4602;
@ -76,14 +76,14 @@ impl INode for Fbdev {
if let Some(fb) = FRAME_BUFFER.read().as_ref() {
fb_fix_info.fill_from(&fb.fb_info);
}
Ok(())
Ok(0)
}
FBIOGET_VSCREENINFO => {
let fb_var_info = unsafe { &mut *(data as *mut FbVarScreeninfo) };
if let Some(fb) = FRAME_BUFFER.read().as_ref() {
fb_var_info.fill_from(&fb.fb_info);
}
Ok(())
Ok(0)
}
_ => {
warn!("use never support ioctl !");

View File

@ -72,17 +72,17 @@ impl INode for Stdin {
error: false,
})
}
fn io_control(&self, cmd: u32, data: usize) -> Result<()> {
fn io_control(&self, cmd: u32, data: usize) -> Result<usize> {
match cmd as usize {
TCGETS | TIOCGWINSZ | TIOCSPGRP => {
// pretend to be tty
Ok(())
Ok(0)
}
TIOCGPGRP => {
// pretend to be have a tty process group
// TODO: verify pointer
unsafe { *(data as *mut u32) = 0 };
Ok(())
Ok(0)
}
_ => Err(FsError::NotSupported),
}
@ -110,17 +110,17 @@ impl INode for Stdout {
error: false,
})
}
fn io_control(&self, cmd: u32, data: usize) -> Result<()> {
fn io_control(&self, cmd: u32, data: usize) -> Result<usize> {
match cmd as usize {
TCGETS | TIOCGWINSZ | TIOCSPGRP => {
// pretend to be tty
Ok(())
Ok(0)
}
TIOCGPGRP => {
// pretend to be have a tty process group
// TODO: verify pointer
unsafe { *(data as *mut u32) = 0 };
Ok(())
Ok(0)
}
_ => Err(FsError::NotSupported),
}

View File

@ -139,7 +139,7 @@ impl FileHandle {
self.inode.poll()
}
pub fn io_control(&self, cmd: u32, arg: usize) -> Result<()> {
pub fn io_control(&self, cmd: u32, arg: usize) -> Result<usize> {
self.inode.io_control(cmd, arg)
}

View File

@ -43,18 +43,13 @@ impl FileLike {
// TODO: place flags & path in FileLike instead of FileHandle/Socket
FIOCLEX => Ok(0),
FIONBIO => Ok(0),
_ => {
match self {
FileLike::File(file) => file.io_control(request as u32, arg1)?,
FileLike::Socket(socket) => {
socket.ioctl(request, arg1, arg2, arg3)?;
}
FileLike::EpollInstance(_) => {
return Err(SysError::ENOSYS);
}
_ => match self {
FileLike::File(file) => file.io_control(request as u32, arg1).map_err(Into::into),
FileLike::Socket(socket) => socket.ioctl(request, arg1, arg2, arg3),
FileLike::EpollInstance(_) => {
return Err(SysError::ENOSYS);
}
Ok(0)
}
},
}
}
pub fn mmap(&mut self, area: MMapArea) -> SysResult {