Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit c064fba

Browse files
committed
a
1 parent d716d92 commit c064fba

File tree

2 files changed

+18
-17
lines changed

2 files changed

+18
-17
lines changed

‎uefi-test-runner/src/fs/mod.rs‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,15 @@
22
33
use alloc::string::{String, ToString};
44
use alloc::vec::Vec;
5-
use uefi::fs::{FileSystem, FileSystemError, FileSystemIOError, FileSystemIOErrorContext, PathBuf};
5+
use uefi::fs;
6+
use uefi::fs::{FileSystem, FileSystemIOErrorContext, IOError, PathBuf};
67
use uefi::proto::media::fs::SimpleFileSystem;
78
use uefi::table::boot::ScopedProtocol;
8-
use uefi::{cstr16, Error,Status};
9+
use uefi::{cstr16, Status};
910

1011
/// Tests functionality from the `uefi::fs` module. This test relies on a
1112
/// working File System Protocol, which is tested at a dedicated place.
12-
pub fn test(sfs: ScopedProtocol<SimpleFileSystem>) -> Result<(), FileSystemError> {
13+
pub fn test(sfs: ScopedProtocol<SimpleFileSystem>) -> Result<(), fs::Error> {
1314
let mut fs = FileSystem::new(sfs);
1415

1516
// test create dir
@@ -26,10 +27,10 @@ pub fn test(sfs: ScopedProtocol<SimpleFileSystem>) -> Result<(), FileSystemError
2627

2728
// test copy from non-existent file: does the error type work as expected?
2829
let err = fs.copy(cstr16!("not_found"), cstr16!("abc"));
29-
let expected_err = FileSystemError::IO(FileSystemIOError {
30+
let expected_err = uefi::Error::IO(IOError {
3031
path: PathBuf::from(cstr16!("not_found")),
3132
context: FileSystemIOErrorContext::OpenError,
32-
uefi_error: Error::new(Status::NOT_FOUND, ()),
33+
uefi_error: uefi::Error::new(Status::NOT_FOUND, ()),
3334
});
3435
assert_eq!(err, Err(expected_err));
3536

‎uefi/src/fs/file_system/error.rs‎

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ use derive_more::Display;
77
///
88
/// [`FileSystem`]: super::FileSystem
99
#[derive(Debug, Clone, Display, PartialEq, Eq)]
10-
pub enum FileSystemError {
10+
pub enum Error {
1111
/// Logical errors. See [`LogicError`].
1212
Logic(LogicError),
13-
/// IO (low-level UEFI-errors) errors. See [`FileSystemIOError`].
14-
IO(FileSystemIOError),
13+
/// IO (low-level UEFI-errors) errors. See [`IOError`].
14+
IO(IOError),
1515
/// Path-related errors. See [`PathError`].
1616
Path(PathError),
1717
/// Can't parse file content as UTF-8. See [`FromUtf8Error`].
@@ -21,7 +21,7 @@ pub enum FileSystemError {
2121
/// UEFI-error with context when working with the underlying UEFI file protocol.
2222
#[derive(Debug, Clone, Display, PartialEq, Eq)]
2323
#[display(fmt = "FileSystemIOError({},{})", context, path)]
24-
pub struct FileSystemIOError {
24+
pub struct IOError {
2525
/// The path that led to the error.
2626
pub path: PathBuf,
2727
/// The context in which the path was used.
@@ -41,7 +41,7 @@ pub enum LogicError {
4141
NotAFile(PathBuf),
4242
}
4343

44-
/// Enum that further specifies the context in that a [`FileSystemError`]
44+
/// Enum that further specifies the context in that a [`Error`]
4545
/// occurred.
4646
#[derive(Debug, Clone, Display, PartialEq, Eq)]
4747
pub enum FileSystemIOErrorContext {
@@ -64,26 +64,26 @@ pub enum FileSystemIOErrorContext {
6464
WriteFailure,
6565
}
6666

67-
impl From<PathError> for FileSystemError {
67+
impl From<PathError> for Error {
6868
fn from(value: PathError) -> Self {
6969
Self::Path(value)
7070
}
7171
}
7272

7373
#[cfg(feature = "unstable")]
74-
impl core::error::Error for FileSystemError {
74+
impl core::error::Error for Error {
7575
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
7676
match self {
77-
FileSystemError::IO(err) => Some(err),
78-
FileSystemError::Path(err) => Some(err),
79-
FileSystemError::Utf8Encoding(err) => Some(err),
80-
FileSystemError::Logic(err) => Some(err),
77+
Error::IO(err) => Some(err),
78+
Error::Path(err) => Some(err),
79+
Error::Utf8Encoding(err) => Some(err),
80+
Error::Logic(err) => Some(err),
8181
}
8282
}
8383
}
8484

8585
#[cfg(feature = "unstable")]
86-
impl core::error::Error for FileSystemIOError {
86+
impl core::error::Error for IOError {
8787
fn source(&self) -> Option<&(dyn core::error::Error + 'static)> {
8888
Some(&self.uefi_error)
8989
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /