use the simple-filesystem crate with FsError

toolchain_update
Ben Pig Chu 6 years ago
parent d737b1e7ba
commit fa03f7b112

6
kernel/Cargo.lock generated

@ -253,7 +253,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
[[package]] [[package]]
name = "simple-filesystem" name = "simple-filesystem"
version = "0.0.1" version = "0.0.1"
source = "git+https://github.com/wangrunji0408/SimpleFileSystem-Rust?branch=multi-thread#249383f7e3f195e0a8ce858f40394e9d5f7f58e0" source = "git+https://github.com/benpigchu/SimpleFileSystem-Rust?branch=ucore-fs-enhance#b216da64ce4ee9cb24059478ffd4fa80ab8f30d2"
dependencies = [ dependencies = [
"bit-vec 0.5.0 (git+https://github.com/AltSysrq/bit-vec.git)", "bit-vec 0.5.0 (git+https://github.com/AltSysrq/bit-vec.git)",
"spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
@ -323,7 +323,7 @@ dependencies = [
"pc-keyboard 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", "pc-keyboard 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)",
"raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "raw-cpuid 6.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"riscv 0.3.0 (git+https://github.com/riscv-and-rust-and-decaf/riscv)", "riscv 0.3.0 (git+https://github.com/riscv-and-rust-and-decaf/riscv)",
"simple-filesystem 0.0.1 (git+https://github.com/wangrunji0408/SimpleFileSystem-Rust?branch=multi-thread)", "simple-filesystem 0.0.1 (git+https://github.com/benpigchu/SimpleFileSystem-Rust?branch=ucore-fs-enhance)",
"spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)", "spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)",
"uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", "uart_16550 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)",
"ucore-memory 0.1.0", "ucore-memory 0.1.0",
@ -466,7 +466,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
"checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a" "checksum rustc_version 0.2.3 (registry+https://github.com/rust-lang/crates.io-index)" = "138e3e0acb6c9fb258b19b67cb8abd63c00679d2851805ea151465464fe9030a"
"checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403" "checksum semver 0.9.0 (registry+https://github.com/rust-lang/crates.io-index)" = "1d7eb9ef2c18661902cc47e535f9bc51b78acd254da71d375c2f6720d9a40403"
"checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3" "checksum semver-parser 0.7.0 (registry+https://github.com/rust-lang/crates.io-index)" = "388a1df253eca08550bef6c72392cfe7c30914bf41df5269b68cbd6ff8f570a3"
"checksum simple-filesystem 0.0.1 (git+https://github.com/wangrunji0408/SimpleFileSystem-Rust?branch=multi-thread)" = "<none>" "checksum simple-filesystem 0.0.1 (git+https://github.com/benpigchu/SimpleFileSystem-Rust?branch=ucore-fs-enhance)" = "<none>"
"checksum skeptic 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "061203a849117b0f7090baf8157aa91dac30545208fbb85166ac58b4ca33d89c" "checksum skeptic 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)" = "061203a849117b0f7090baf8157aa91dac30545208fbb85166ac58b4ca33d89c"
"checksum spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f" "checksum spin 0.4.10 (registry+https://github.com/rust-lang/crates.io-index)" = "ceac490aa12c567115b40b7b7fceca03a6c9d53d5defea066123debc83c5dc1f"
"checksum static_assertions 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "389ce475f424f267dbed6479cbd8f126c5e1afb053b0acdaa019c74305fc65d1" "checksum static_assertions 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)" = "389ce475f424f267dbed6479cbd8f126c5e1afb053b0acdaa019c74305fc65d1"

@ -56,6 +56,9 @@ aarch64 = { git = "https://github.com/equation314/aarch64" }
atags = { path = "../crate/atags" } atags = { path = "../crate/atags" }
bcm2837 = { path = "../crate/bcm2837", optional = true } bcm2837 = { path = "../crate/bcm2837", optional = true }
[patch.'https://github.com/wangrunji0408/SimpleFileSystem-Rust']
simple-filesystem = { git = "https://github.com/benpigchu/SimpleFileSystem-Rust", branch = "ucore-fs-enhance" }
[package.metadata.bootimage] [package.metadata.bootimage]
default-target = "x86_64-blog_os.json" default-target = "x86_64-blog_os.json"
output = "target/x86_64-blog_os/bootimage.bin" output = "target/x86_64-blog_os/bootimage.bin"

@ -136,7 +136,8 @@ impl INode for Stdout {
fn read_at(&self, _offset: usize, _buf: &mut [u8]) -> Result<usize> { unimplemented!() } fn read_at(&self, _offset: usize, _buf: &mut [u8]) -> Result<usize> { unimplemented!() }
fn write_at(&self, _offset: usize, buf: &[u8]) -> Result<usize> { fn write_at(&self, _offset: usize, buf: &[u8]) -> Result<usize> {
use core::str; use core::str;
let s = str::from_utf8(buf).map_err(|_| ())?; //we do not care the utf-8 things, we just want to print it!
let s = unsafe{ str::from_utf8_unchecked(buf) };
print!("{}", s); print!("{}", s);
Ok(buf.len()) Ok(buf.len())
} }

@ -1,6 +1,6 @@
//! System call //! System call
use simple_filesystem::{INode, file::File, FileInfo, FileType}; use simple_filesystem::{INode, file::File, FileInfo, FileType, FsError};
use core::{slice, str}; use core::{slice, str};
use alloc::{sync::Arc, vec::Vec, string::String}; use alloc::{sync::Arc, vec::Vec, string::String};
use spin::Mutex; use spin::Mutex;
@ -291,8 +291,8 @@ pub enum SysError {
InvalidArgument, InvalidArgument,
} }
impl From<()> for SysError { impl From<FsError> for SysError {
fn from(_: ()) -> Self { fn from(_: FsError) -> Self {
SysError::VfsError SysError::VfsError
} }
} }

Loading…
Cancel
Save