diff --git a/Cargo.lock b/Cargo.lock index 7d1abdf502..633c9f1ae7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -15,9 +15,9 @@ dependencies = [ [[package]] name = "redox_syscall" -version = "0.2.4" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "05ec8ca9416c5ea37062b502703cd7fcb207736bc294f6e0cf367ac6fc234570" +checksum = "5ab49abadf3f9e1c4bc499e8845e152ad87d2ad2d30371841171169e9d75feee" dependencies = [ "bitflags", ] diff --git a/Cargo.toml b/Cargo.toml index 9e1671da11..f228eacfbf 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,4 +9,4 @@ description = "In-memory filesystem for Redox, which is useful for early logging # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html [dependencies] -redox_syscall = "0.2.4" +redox_syscall = "0.2.9" diff --git a/src/scheme.rs b/src/scheme.rs index 7dbc5ca956..fd0c2f7231 100644 --- a/src/scheme.rs +++ b/src/scheme.rs @@ -174,21 +174,22 @@ impl Scheme { } impl SchemeMut for Scheme { - fn open(&mut self, path: &[u8], flags: usize, uid: u32, gid: u32) -> Result { - let exists = self.filesystem.resolve(path, 0, 0).is_ok(); + fn open(&mut self, path: &str, flags: usize, uid: u32, gid: u32) -> Result { + let exists = self.filesystem.resolve(path.as_bytes(), 0, 0).is_ok(); if flags & O_CREAT != 0 && flags & O_EXCL != 0 && exists { return Err(Error::new(EEXIST)); } let handle = if flags & O_CREAT != 0 && exists { - self.open_existing(path, flags, uid, gid)? + self.open_existing(path.as_bytes(), flags, uid, gid)? } else if flags & O_CREAT != 0 { if flags & O_STAT != 0 { return Err(Error::new(EINVAL)); } let (parent_dir_inode, new_name) = - self.filesystem.resolve_except_last(path, uid, gid)?; + self.filesystem + .resolve_except_last(path.as_bytes(), uid, gid)?; let new_name = new_name.ok_or(Error::new(EINVAL))?; // cannot mkdir / let current_time = filesystem::current_time(); @@ -266,7 +267,7 @@ impl SchemeMut for Scheme { current_perm, } } else { - self.open_existing(path, flags, uid, gid)? + self.open_existing(path.as_bytes(), flags, uid, gid)? }; let fd = self.next_fd; @@ -276,8 +277,8 @@ impl SchemeMut for Scheme { Ok(fd) } - fn chmod(&mut self, path: &[u8], mode: u16, uid: u32, gid: u32) -> Result { - let inode_num = self.filesystem.resolve(path, uid, gid)?; + fn chmod(&mut self, path: &str, mode: u16, uid: u32, gid: u32) -> Result { + let inode_num = self.filesystem.resolve(path.as_bytes(), uid, gid)?; let inode = self .filesystem .files @@ -295,11 +296,11 @@ impl SchemeMut for Scheme { inode.mode = mode | cur_mode; Ok(0) } - fn rmdir(&mut self, path: &[u8], uid: u32, gid: u32) -> Result { - self.remove_dentry(path, uid, gid, true) + fn rmdir(&mut self, path: &str, uid: u32, gid: u32) -> Result { + self.remove_dentry(path.as_bytes(), uid, gid, true) } - fn unlink(&mut self, path: &[u8], uid: u32, gid: u32) -> Result { - self.remove_dentry(path, uid, gid, false) + fn unlink(&mut self, path: &str, uid: u32, gid: u32) -> Result { + self.remove_dentry(path.as_bytes(), uid, gid, false) } fn dup(&mut self, old_fd: usize, _buf: &[u8]) -> Result { let handle = self @@ -492,7 +493,7 @@ impl SchemeMut for Scheme { // TODO Err(Error::new(ENOSYS)) } - fn frename(&mut self, fd: usize, path: &[u8], uid: u32, gid: u32) -> Result { + fn frename(&mut self, fd: usize, path: &str, uid: u32, gid: u32) -> Result { if !self.handles.contains_key(&fd) { return Err(Error::new(EBADF)); }