#[non_exhaustive]pub enum Error {
Show 24 variants
Io(Error),
BadMagic {
found: u16,
expected: u16,
},
BadChecksum {
what: &'static str,
},
UnsupportedIncompat(u32),
UnsupportedRoCompat(u32),
NotFound,
NotADirectory,
IsADirectory,
AlreadyExists,
DirectoryNotEmpty,
ReadOnly,
NameTooLong,
NoSpaceLeftOnDevice,
InvalidArgument(&'static str),
InvalidInode(u32),
InvalidBlock(u64),
OutOfBounds,
CorruptExtentTree(&'static str),
CorruptDirEntry(&'static str),
Corrupt(&'static str),
TooManyLinks,
Unsupported(&'static str),
JournalNotReplayed,
Stale,
}Expand description
#[non_exhaustive] (#120): a new way to fail is a new variant, and without
this every variant added was a break for any caller matching exhaustively.
A match outside this crate needs a _ arm.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Io(Error)
Underlying device I/O failure.
BadMagic
Magic number mismatch — not an ext4 filesystem.
BadChecksum
On-disk structure failed checksum validation.
UnsupportedIncompat(u32)
Filesystem uses an INCOMPAT feature we don’t implement.
UnsupportedRoCompat(u32)
Filesystem uses a RO_COMPAT feature we don’t implement (read-only mount required anyway).
NotFound
Path component or inode not found.
NotADirectory
Path resolution hit a non-directory mid-walk.
IsADirectory
Operation refused because the target is a directory and the syscall
only operates on regular files (POSIX EISDIR — used by unlink(2),
truncate(2), etc).
AlreadyExists
Target already exists (POSIX EEXIST — used by create(2), mkdir(2),
rename(2) when no-replace is requested).
DirectoryNotEmpty
Directory must be empty (POSIX ENOTEMPTY — used by rmdir(2),
rename(2) replacing a non-empty dir).
ReadOnly
Write attempted on a device opened read-only (POSIX EROFS).
NameTooLong
Path component longer than EXT4_NAME_LEN (255 bytes) — POSIX ENAMETOOLONG.
NoSpaceLeftOnDevice
Container (xattr in-inode region, xattr block, etc.) has no free space for the requested entry — POSIX ENOSPC.
InvalidArgument(&'static str)
Caller passed a malformed argument or attempted a semantically invalid mutation (POSIX EINVAL — e.g. truncate-grow, moving a dir into its own subtree, operating on a legacy non-EXTENTS inode).
InvalidInode(u32)
Inode number is invalid (0, > total inodes, etc.).
InvalidBlock(u64)
Block number is invalid (> total blocks).
OutOfBounds
Read/write past end of file.
CorruptExtentTree(&'static str)
Extent tree structure is corrupt.
CorruptDirEntry(&'static str)
Directory entry corrupt (rec_len out of range, name too long, etc.).
Corrupt(&'static str)
Generic spec-violation error.
TooManyLinks
The inode’s link count has no room for another link (POSIX
EMLINK): a file at MAX_LINKS (65000) links, or a directory
with that many on a volume without DIR_NLINK.
Unsupported(&'static str)
A structure this driver can read but cannot correctly modify.
Distinct from Error::ReadOnly, which is about the mount, and
from the Unsupported* feature errors, which are about the volume:
this is one operation on one object being refused because doing it
would leave the filesystem worse than not doing it.
JournalNotReplayed
A write refused because the volume’s journal holds committed
transactions this mount has not yet replayed onto the device: a
lazy mount before crate::fs::Filesystem::replay_journal_if_dirty.
Writing first would commit over the unreplayed log and lose it.
Maps to EROFS: the mount is read-only until the replay runs.
Stale
An inode handle no longer names the file it was taken from (POSIX ESTALE): the inode number is out of range or reserved, the inode has been freed, or it has been freed and reused under a new generation.
Implementations§
Trait Implementations§
Source§impl Error for Error
impl Error for Error
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()