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.