Trim in env scheme, do not debug initfs

This commit is contained in:
Jeremy Soller 2016-09-22 20:49:28 -06:00
parent 421f046abb
commit d5ac1a70bd
2 changed files with 3 additions and 3 deletions

View file

@ -1,5 +1,5 @@
use collections::BTreeMap;
use core::cmp;
use core::{cmp, str};
use core::sync::atomic::{AtomicUsize, Ordering};
use spin::RwLock;
@ -41,7 +41,8 @@ impl EnvScheme {
impl Scheme for EnvScheme {
fn open(&self, path: &[u8], _flags: usize) -> Result<usize> {
let data = self.files.get(path).ok_or(Error::new(ENOENT))?;
let path = str::from_utf8(path).map_err(|_err| Error::new(ENOENT))?.trim_matches('/');
let data = self.files.get(path.as_bytes()).ok_or(Error::new(ENOENT))?;
let id = self.next_id.fetch_add(1, Ordering::SeqCst);
self.handles.write().insert(id, Handle {

View file

@ -36,7 +36,6 @@ impl InitFsScheme {
impl Scheme for InitFsScheme {
fn open(&self, path: &[u8], _flags: usize) -> Result<usize> {
let path = str::from_utf8(path).map_err(|_err| Error::new(ENOENT))?.trim_matches('/');
println!("{}", path);
let file = self.files.get(path.as_bytes()).ok_or(Error::new(ENOENT))?;
let id = self.next_id.fetch_add(1, Ordering::SeqCst);