Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(virtual-fs): Add FsError::StorageFull variant #3956

Merged
merged 1 commit into from
Jun 5, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/virtual-fs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -481,6 +481,8 @@ pub enum FsError {
/// Directory not Empty
#[error("directory not empty")]
DirectoryNotEmpty,
#[error("storage full")]
StorageFull,
/// Some other unhandled error. If you see this, it's probably a bug.
#[error("unknown error found")]
UnknownError,
Expand All @@ -506,6 +508,8 @@ impl From<io::Error> for FsError {
io::ErrorKind::UnexpectedEof => FsError::UnexpectedEof,
io::ErrorKind::WouldBlock => FsError::WouldBlock,
io::ErrorKind::WriteZero => FsError::WriteZero,
// NOTE: Add this once the "io_error_more" Rust feature is stabilized
// io::ErrorKind::StorageFull => FsError::StorageFull,
io::ErrorKind::Other => FsError::IOError,
// if the following triggers, a new error type was added to this non-exhaustive enum
_ => FsError::UnknownError,
Expand Down Expand Up @@ -541,6 +545,9 @@ impl From<FsError> for io::Error {
FsError::NoDevice => io::ErrorKind::Other,
FsError::DirectoryNotEmpty => io::ErrorKind::Other,
FsError::UnknownError => io::ErrorKind::Other,
FsError::StorageFull => io::ErrorKind::Other,
// NOTE: Add this once the "io_error_more" Rust feature is stabilized
// FsError::StorageFull => io::ErrorKind::StorageFull,
};
kind.into()
}
Expand Down
1 change: 1 addition & 0 deletions lib/wasi/src/fs/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1978,6 +1978,7 @@ pub fn fs_error_into_wasi_err(fs_error: FsError) -> Errno {
FsError::WouldBlock => Errno::Again,
FsError::WriteZero => Errno::Nospc,
FsError::DirectoryNotEmpty => Errno::Notempty,
FsError::StorageFull => Errno::Overflow,
FsError::Lock | FsError::UnknownError => Errno::Io,
}
}