-
Notifications
You must be signed in to change notification settings - Fork 38
Open
Description
Summary
Centralize the SmbiosError to efi::Status conversion in protocol.rs by using the existing From<SmbiosError> for EfiError impl and the EfiError → efi::Status conversion chain.
Background
Currently, protocol.rs has manual match statements converting SmbiosError variants to efi::Status in each FFI
function (add_ext, update_string_ext, remove_ext). This duplicates the conversion logic that already exists
in From<SmbiosError> for EfiError.
Proposed Change
-
Update
From<SmbiosError> for EfiErrorin error.rs:- Map
RecordTooSmallandStringPoolTooSmalltoEfiError::BufferTooSmall(instead ofInvalidParameter)
- Map
-
Simplify protocol.rs to use the conversion chain:
// Instead of manual match arms:
Err(SmbiosError::RecordTooSmall) => efi::Status::BUFFER_TOO_SMALL,
Err(SmbiosError::HandleNotFound) => efi::Status::NOT_FOUND,
// ...
// Use:
Err(e) => patina::error::EfiError::from(e).into()Benefits
- Single source of truth for error mappings
- Reduces code duplication across FFI functions
- Easier to maintain and update error mappings
Related
Identified during PR #1147 review.
Metadata
Metadata
Assignees
Labels
No labels
Type
Projects
Status
Ready