Skip to content

Commit

Permalink
xous: format directory
Browse files Browse the repository at this point in the history
Signed-off-by: Sean Cross <[email protected]>
  • Loading branch information
xobs committed Aug 24, 2023
1 parent df71bc8 commit bdab5dc
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 19 deletions.
26 changes: 11 additions & 15 deletions library/std/src/sys/xous/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ use alloc::str::FromStr;
use crate::ffi::OsString;
use crate::fmt;
use crate::hash::Hash;
use crate::io::{self, IoSlice, IoSliceMut, BorrowedCursor, SeekFrom};
use crate::io::{self, BorrowedCursor, IoSlice, IoSliceMut, SeekFrom};
use crate::os::xous::ffi::{InvokeType, OsStrExt, Syscall, SyscallResult};
use crate::path::{Path, PathBuf};
use crate::sys::time::SystemTime;
Expand Down Expand Up @@ -164,13 +164,11 @@ impl DirEntry {

pub fn metadata(&self) -> io::Result<FileAttr> {
match self.kind {
FileType::None | FileType::Unknown => {
Err(crate::io::Error::new(
crate::io::ErrorKind::NotFound,
"File or directory does not exist, or is corrupted"
))
}
_ => Ok(FileAttr { kind: self.kind, len: 0 })
FileType::None | FileType::Unknown => Err(crate::io::Error::new(
crate::io::ErrorKind::NotFound,
"File or directory does not exist, or is corrupted",
)),
_ => Ok(FileAttr { kind: self.kind, len: 0 }),
}
}

Expand Down Expand Up @@ -712,13 +710,11 @@ pub fn stat(p: &Path) -> io::Result<FileAttr> {
};

match kind {
FileType::None | FileType::Unknown => {
Err(crate::io::Error::new(
crate::io::ErrorKind::NotFound,
"File or directory does not exist, or is corrupted"
))
}
_ => Ok(FileAttr { kind, len: 0 })
FileType::None | FileType::Unknown => Err(crate::io::Error::new(
crate::io::ErrorKind::NotFound,
"File or directory does not exist, or is corrupted",
)),
_ => Ok(FileAttr { kind, len: 0 }),
}
}

Expand Down
5 changes: 1 addition & 4 deletions library/std/src/sys/xous/senres.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,7 @@ impl<'a> Message<'a> {
message_id,
auto_return: true,
data: unsafe {
core::slice::from_raw_parts_mut(
core::ptr::from_exposed_addr_mut::<u8>(data),
len,
)
core::slice::from_raw_parts_mut(core::ptr::from_exposed_addr_mut::<u8>(data), len)
},
})
}
Expand Down

0 comments on commit bdab5dc

Please sign in to comment.