BlkError

Enum BlkError 

Source
pub enum BlkError {
    NotSupported,
    Retry,
    NoMemory,
    InvalidBlockIndex(usize),
    Other(Box<dyn Error>),
}
Expand description

Errors that can occur during block device operations.

These errors provide detailed information about what went wrong during block device operations and how the caller should respond.

Variants§

§

NotSupported

The requested operation is not supported by the device.

This error occurs when attempting to perform an operation that the hardware or driver does not support. For example, trying to write to a read-only device.

Recovery: Check device capabilities and use only supported operations.

§

Retry

The operation should be retried later.

This error indicates that the operation failed due to temporary conditions and should be retried. This commonly occurs when:

  • The device queue is full
  • The device is temporarily busy
  • Resource contention prevents immediate completion

Recovery: Wait a short time and retry the operation. Consider implementing exponential backoff for repeated retries.

§

NoMemory

Insufficient memory to complete the operation.

This error occurs when there is not enough memory available to:

  • Allocate DMA buffers
  • Create internal data structures
  • Complete the requested operation

Recovery: Free unused resources or wait for memory to become available. Consider reducing the number of concurrent operations.

§

InvalidBlockIndex(usize)

The specified block index is invalid or out of range.

This error occurs when:

  • The block index exceeds the device’s capacity
  • The block index is negative (in languages that allow it)
  • The block has been marked as bad or unusable

Recovery: Verify that the block index is within the valid range (0 to num_blocks() - 1) and that the block is accessible.

§

Other(Box<dyn Error>)

An unspecified error occurred.

This error wraps other error types that don’t fit into the specific categories above. The wrapped error provides additional context about what went wrong.

Recovery: Examine the wrapped error for specific recovery instructions. This often indicates a lower-level hardware or system error.

Trait Implementations§

Source§

impl Debug for BlkError

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for BlkError

Source§

fn fmt(&self, __formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Error for BlkError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0: use the Display impl or to_string()
1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0: replaced by Error::source, which can support downcasting
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl From<BlkError> for ErrorKind

Source§

fn from(value: BlkError) -> Self

Converts to this type from the input type.
Source§

impl From<DError> for BlkError

Source§

fn from(value: DError) -> Self

Converts to this type from the input type.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.