Skip to content

uefi/test-runner: Remove crate:: and uefi:: prefix from Status #1714

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

Merged
merged 1 commit into from
Jun 29, 2025
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
4 changes: 2 additions & 2 deletions uefi-test-runner/src/proto/media.rs
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ fn test_raw_disk_io2(handle: Handle) {
let mut task = DiskIoTask {
token: DiskIo2Token {
event: Some(event.unsafe_clone()),
transaction_status: uefi::Status::NOT_READY,
transaction_status: Status::NOT_READY,
},
buffer: [0; 512],
};
Expand All @@ -337,7 +337,7 @@ fn test_raw_disk_io2(handle: Handle) {
.expect("Failed to wait on completion event");

// Verify that the disk's MBR signature is correct
assert_eq!(task.token.transaction_status, uefi::Status::SUCCESS);
assert_eq!(task.token.transaction_status, Status::SUCCESS);
assert_eq!(task.buffer[510], 0x55);
assert_eq!(task.buffer[511], 0xaa);

Expand Down
28 changes: 14 additions & 14 deletions uefi/src/proto/media/block.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ impl BlockIO {
/// exhaustive verification operation of the device during reset.
///
/// # Errors
/// * `uefi::Status::DEVICE_ERROR` The block device is not functioning
/// * `Status::DEVICE_ERROR` The block device is not functioning
/// correctly and could not be reset.
pub fn reset(&mut self, extended_verification: bool) -> Result {
unsafe { (self.0.reset)(&mut self.0, extended_verification.into()) }.to_result()
Expand All @@ -43,13 +43,13 @@ impl BlockIO {
/// * `buffer` - The target buffer of the read operation
///
/// # Errors
/// * `uefi::Status::DEVICE_ERROR` The device reported an error while attempting to perform the read
/// * `Status::DEVICE_ERROR` The device reported an error while attempting to perform the read
/// operation.
/// * `uefi::Status::NO_MEDIA` There is no media in the device.
/// * `uefi::Status::MEDIA_CHANGED` The `media_id` is not for the current media.
/// * `uefi::Status::BAD_BUFFER_SIZE` The buffer size parameter is not a multiple of the intrinsic block size of
/// * `Status::NO_MEDIA` There is no media in the device.
/// * `Status::MEDIA_CHANGED` The `media_id` is not for the current media.
/// * `Status::BAD_BUFFER_SIZE` The buffer size parameter is not a multiple of the intrinsic block size of
/// the device.
/// * `uefi::Status::INVALID_PARAMETER` The read request contains LBAs that are not valid, or the buffer is not on
/// * `Status::INVALID_PARAMETER` The read request contains LBAs that are not valid, or the buffer is not on
/// proper alignment.
pub fn read_blocks(&self, media_id: u32, lba: Lba, buffer: &mut [u8]) -> Result {
let buffer_size = buffer.len();
Expand All @@ -73,14 +73,14 @@ impl BlockIO {
/// * `buffer` Buffer to be written
///
/// # Errors
/// * `uefi::Status::WRITE_PROTECTED` The device cannot be written to.
/// * `uefi::Status::NO_MEDIA` There is no media in the device.
/// * `uefi::Status::MEDIA_CHANGED` The `media_id` is not for the current media.
/// * `uefi::Status::DEVICE_ERROR` The device reported an error while attempting to perform the write
/// * `Status::WRITE_PROTECTED` The device cannot be written to.
/// * `Status::NO_MEDIA` There is no media in the device.
/// * `Status::MEDIA_CHANGED` The `media_id` is not for the current media.
/// * `Status::DEVICE_ERROR` The device reported an error while attempting to perform the write
/// operation.
/// * `uefi::Status::BAD_BUFFER_SIZE` The buffer size parameter is not a multiple of the intrinsic block size
/// * `Status::BAD_BUFFER_SIZE` The buffer size parameter is not a multiple of the intrinsic block size
/// of the device.
/// * `uefi::Status::INVALID_PARAMETER` The write request contains LBAs that are not valid, or the buffer is not
/// * `Status::INVALID_PARAMETER` The write request contains LBAs that are not valid, or the buffer is not
/// on proper alignment.
pub fn write_blocks(&mut self, media_id: u32, lba: Lba, buffer: &[u8]) -> Result {
let buffer_size = buffer.len();
Expand All @@ -99,8 +99,8 @@ impl BlockIO {
/// Flushes all modified data to a physical block device.
///
/// # Errors
/// * `uefi::Status::DEVICE_ERROR` The device reported an error while attempting to write data.
/// * `uefi::Status::NO_MEDIA` There is no media in the device.
/// * `Status::DEVICE_ERROR` The device reported an error while attempting to write data.
/// * `Status::NO_MEDIA` There is no media in the device.
pub fn flush_blocks(&mut self) -> Result {
unsafe { (self.0.flush_blocks)(&mut self.0) }.to_result()
}
Expand Down
33 changes: 18 additions & 15 deletions uefi/src/proto/media/disk_info.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ use crate::StatusExt;
use uefi_macros::unsafe_protocol;
use uefi_raw::protocol::disk::DiskInfoProtocol;

#[cfg(doc)]
use crate::Status;

/// Enum representing the interface type of the disk.
///
/// This protocol abstracts various disk interfaces, including IDE, USB, AHCI, NVME, and more.
Expand Down Expand Up @@ -60,7 +63,7 @@ pub struct DeviceLocationInfo {
///
/// Not all operations are supported by all interface types!
/// Either use [`DiskInfo::interface`] to determine what should be possible, or simply
/// try and handle the [`crate::Status::UNSUPPORTED`] error return value.
/// try and handle the [`Status::UNSUPPORTED`] error return value.
///
/// # UEFI Spec Description
/// Provides the basic interfaces to abstract platform information regarding an IDE controller.
Expand Down Expand Up @@ -99,10 +102,10 @@ impl DiskInfo {
/// Length of the response (amount of bytes that were written to the given buffer).
///
/// # Errors
/// - [`crate::Status::SUCCESS`] The command was accepted without any errors.
/// - [`crate::Status::NOT_FOUND`] The device does not support this data class.
/// - [`crate::Status::DEVICE_ERROR`] An error occurred while reading the InquiryData from the device.
/// - [`crate::Status::BUFFER_TOO_SMALL`] The provided InquiryDataSize buffer is not large enough to store the required data.
/// - [`Status::SUCCESS`] The command was accepted without any errors.
/// - [`Status::NOT_FOUND`] The device does not support this data class.
/// - [`Status::DEVICE_ERROR`] An error occurred while reading the InquiryData from the device.
/// - [`Status::BUFFER_TOO_SMALL`] The provided InquiryDataSize buffer is not large enough to store the required data.
pub fn inquiry(&self, bfr: &mut [u8]) -> crate::Result<usize> {
let mut len: u32 = bfr.len() as u32;
unsafe {
Expand All @@ -120,10 +123,10 @@ impl DiskInfo {
/// Length of the response (amount of bytes that were written to the given buffer).
///
/// # Errors
/// - [`crate::Status::SUCCESS`] The command was accepted without any errors.
/// - [`crate::Status::NOT_FOUND`] The device does not support this data class.
/// - [`crate::Status::DEVICE_ERROR`] An error occurred while reading the IdentifyData from the device.
/// - [`crate::Status::BUFFER_TOO_SMALL`] The provided IdentifyDataSize buffer is not large enough to store the required data.
/// - [`Status::SUCCESS`] The command was accepted without any errors.
/// - [`Status::NOT_FOUND`] The device does not support this data class.
/// - [`Status::DEVICE_ERROR`] An error occurred while reading the IdentifyData from the device.
/// - [`Status::BUFFER_TOO_SMALL`] The provided IdentifyDataSize buffer is not large enough to store the required data.
pub fn identify(&self, bfr: &mut [u8]) -> crate::Result<usize> {
let mut len: u32 = bfr.len() as u32;
unsafe {
Expand All @@ -141,10 +144,10 @@ impl DiskInfo {
/// [`SenseDataInfo`] struct containing the number of bytes of sense data and the number of sense data structures.
///
/// # Errors
/// - [`crate::Status::SUCCESS`] The command was accepted without any errors.
/// - [`crate::Status::NOT_FOUND`] The device does not support this data class.
/// - [`crate::Status::DEVICE_ERROR`] An error occurred while reading the SenseData from the device.
/// - [`crate::Status::BUFFER_TOO_SMALL`] The provided SenseDataSize buffer is not large enough to store the required data.
/// - [`Status::SUCCESS`] The command was accepted without any errors.
/// - [`Status::NOT_FOUND`] The device does not support this data class.
/// - [`Status::DEVICE_ERROR`] An error occurred while reading the SenseData from the device.
/// - [`Status::BUFFER_TOO_SMALL`] The provided SenseDataSize buffer is not large enough to store the required data.
pub fn sense_data(&self, bfr: &mut [u8]) -> crate::Result<SenseDataInfo> {
let mut len: u32 = bfr.len() as u32;
let mut number: u8 = 0;
Expand All @@ -166,8 +169,8 @@ impl DiskInfo {
/// [`DeviceLocationInfo`] struct containing the channel and device numbers.
///
/// # Errors
/// - [`crate::Status::SUCCESS`] The `IdeChannel` and `IdeDevice` values are valid.
/// - [`crate::Status::UNSUPPORTED`] Not supported by this disk's interface type.
/// - [`Status::SUCCESS`] The `IdeChannel` and `IdeDevice` values are valid.
/// - [`Status::UNSUPPORTED`] Not supported by this disk's interface type.
pub fn bus_location(&self) -> crate::Result<DeviceLocationInfo> {
let mut ide_channel: u32 = 0; // called ide, but also useful for other interfaces
let mut ide_device: u32 = 0;
Expand Down
62 changes: 31 additions & 31 deletions uefi/src/proto/media/file/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -55,18 +55,18 @@ pub trait File: Sized {
/// errors returned by this function, but some implementations (such as EDK2) perform
/// additional validation and may return that status for invalid inputs.
///
/// [`INVALID_PARAMETER`]: uefi::Status::INVALID_PARAMETER
/// [`INVALID_PARAMETER`]: Status::INVALID_PARAMETER
///
/// * [`uefi::Status::INVALID_PARAMETER`]
/// * [`uefi::Status::NOT_FOUND`]
/// * [`uefi::Status::NO_MEDIA`]
/// * [`uefi::Status::MEDIA_CHANGED`]
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`uefi::Status::VOLUME_CORRUPTED`]
/// * [`uefi::Status::WRITE_PROTECTED`]
/// * [`uefi::Status::ACCESS_DENIED`]
/// * [`uefi::Status::OUT_OF_RESOURCES`]
/// * [`uefi::Status::VOLUME_FULL`]
/// * [`Status::INVALID_PARAMETER`]
/// * [`Status::NOT_FOUND`]
/// * [`Status::NO_MEDIA`]
/// * [`Status::MEDIA_CHANGED`]
/// * [`Status::DEVICE_ERROR`]
/// * [`Status::VOLUME_CORRUPTED`]
/// * [`Status::WRITE_PROTECTED`]
/// * [`Status::ACCESS_DENIED`]
/// * [`Status::OUT_OF_RESOURCES`]
/// * [`Status::VOLUME_FULL`]
fn open(
&mut self,
filename: &CStr16,
Expand Down Expand Up @@ -96,7 +96,7 @@ pub trait File: Sized {
///
/// See section `EFI_FILE_PROTOCOL.Delete()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::WARN_DELETE_FAILURE`]
/// * [`Status::WARN_DELETE_FAILURE`]
fn delete(mut self) -> Result {
let result = unsafe { (self.imp().delete)(self.imp()) }.to_result();
mem::forget(self);
Expand All @@ -117,11 +117,11 @@ pub trait File: Sized {
///
/// See section `EFI_FILE_PROTOCOL.GetInfo()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::UNSUPPORTED`]
/// * [`uefi::Status::NO_MEDIA`]
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`uefi::Status::VOLUME_CORRUPTED`]
/// * [`uefi::Status::BUFFER_TOO_SMALL`]
/// * [`Status::UNSUPPORTED`]
/// * [`Status::NO_MEDIA`]
/// * [`Status::DEVICE_ERROR`]
/// * [`Status::VOLUME_CORRUPTED`]
/// * [`Status::BUFFER_TOO_SMALL`]
fn get_info<'buf, Info: FileProtocolInfo + ?Sized>(
&mut self,
buffer: &'buf mut [u8],
Expand Down Expand Up @@ -162,14 +162,14 @@ pub trait File: Sized {
///
/// See section `EFI_FILE_PROTOCOL.SetInfo()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::UNSUPPORTED`]
/// * [`uefi::Status::NO_MEDIA`]
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`uefi::Status::VOLUME_CORRUPTED`]
/// * [`uefi::Status::WRITE_PROTECTED`]
/// * [`uefi::Status::ACCESS_DENIED`]
/// * [`uefi::Status::VOLUME_FULL`]
/// * [`uefi::Status::BAD_BUFFER_SIZE`]
/// * [`Status::UNSUPPORTED`]
/// * [`Status::NO_MEDIA`]
/// * [`Status::DEVICE_ERROR`]
/// * [`Status::VOLUME_CORRUPTED`]
/// * [`Status::WRITE_PROTECTED`]
/// * [`Status::ACCESS_DENIED`]
/// * [`Status::VOLUME_FULL`]
/// * [`Status::BAD_BUFFER_SIZE`]
fn set_info<Info: FileProtocolInfo + ?Sized>(&mut self, info: &Info) -> Result {
let info_ptr = ptr::from_ref(info).cast::<c_void>();
let info_size = size_of_val(info);
Expand All @@ -182,12 +182,12 @@ pub trait File: Sized {
///
/// See section `EFI_FILE_PROTOCOL.Flush()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::NO_MEDIA`]
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`uefi::Status::VOLUME_CORRUPTED`]
/// * [`uefi::Status::WRITE_PROTECTED`]
/// * [`uefi::Status::ACCESS_DENIED`]
/// * [`uefi::Status::VOLUME_FULL`]
/// * [`Status::NO_MEDIA`]
/// * [`Status::DEVICE_ERROR`]
/// * [`Status::VOLUME_CORRUPTED`]
/// * [`Status::WRITE_PROTECTED`]
/// * [`Status::ACCESS_DENIED`]
/// * [`Status::VOLUME_FULL`]
fn flush(&mut self) -> Result {
unsafe { (self.imp().flush)(self.imp()) }.to_result()
}
Expand Down
22 changes: 11 additions & 11 deletions uefi/src/proto/media/file/regular.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,9 @@ impl RegularFile {
///
/// See section `EFI_FILE_PROTOCOL.Read()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::NO_MEDIA`]
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`uefi::Status::VOLUME_CORRUPTED`]
/// * [`Status::NO_MEDIA`]
/// * [`Status::DEVICE_ERROR`]
/// * [`Status::VOLUME_CORRUPTED`]
///
/// # Quirks
///
Expand Down Expand Up @@ -91,12 +91,12 @@ impl RegularFile {
///
/// See section `EFI_FILE_PROTOCOL.Write()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::NO_MEDIA`]
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`uefi::Status::VOLUME_CORRUPTED`]
/// * [`uefi::Status::WRITE_PROTECTED`]
/// * [`uefi::Status::ACCESS_DENIED`]
/// * [`uefi::Status::VOLUME_FULL`]
/// * [`Status::NO_MEDIA`]
/// * [`Status::DEVICE_ERROR`]
/// * [`Status::VOLUME_CORRUPTED`]
/// * [`Status::WRITE_PROTECTED`]
/// * [`Status::ACCESS_DENIED`]
/// * [`Status::VOLUME_FULL`]
pub fn write(&mut self, buffer: &[u8]) -> Result<(), usize> {
let mut buffer_size = buffer.len();
unsafe { (self.imp().write)(self.imp(), &mut buffer_size, buffer.as_ptr().cast()) }
Expand All @@ -109,7 +109,7 @@ impl RegularFile {
///
/// See section `EFI_FILE_PROTOCOL.GetPosition()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`Status::DEVICE_ERROR`]
pub fn get_position(&mut self) -> Result<u64> {
let mut pos = 0u64;
unsafe { (self.imp().get_position)(self.imp(), &mut pos) }.to_result_with_val(|| pos)
Expand All @@ -129,7 +129,7 @@ impl RegularFile {
///
/// See section `EFI_FILE_PROTOCOL.SetPosition()` in the UEFI Specification for more details.
///
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`Status::DEVICE_ERROR`]
pub fn set_position(&mut self, position: u64) -> Result {
unsafe { (self.imp().set_position)(self.imp(), position) }.to_result()
}
Expand Down
17 changes: 10 additions & 7 deletions uefi/src/proto/media/fs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ use crate::{Result, StatusExt};
use core::ptr;
use uefi_raw::protocol::file_system::SimpleFileSystemProtocol;

#[cfg(doc)]
use crate::Status;

/// Simple File System [`Protocol`]. Allows access to a FAT-12/16/32 file
/// system.
///
Expand Down Expand Up @@ -41,13 +44,13 @@ impl SimpleFileSystem {
/// `EFI_SIMPLE_FILE SYSTEM_PROTOCOL.OpenVolume()` (this has a space in between FILE and
/// SYSTEM; it could be a typo in the UEFI spec).
///
/// * [`uefi::Status::UNSUPPORTED`]
/// * [`uefi::Status::NO_MEDIA`]
/// * [`uefi::Status::DEVICE_ERROR`]
/// * [`uefi::Status::VOLUME_CORRUPTED`]
/// * [`uefi::Status::ACCESS_DENIED`]
/// * [`uefi::Status::OUT_OF_RESOURCES`]
/// * [`uefi::Status::MEDIA_CHANGED`]
/// * [`Status::UNSUPPORTED`]
/// * [`Status::NO_MEDIA`]
/// * [`Status::DEVICE_ERROR`]
/// * [`Status::VOLUME_CORRUPTED`]
/// * [`Status::ACCESS_DENIED`]
/// * [`Status::OUT_OF_RESOURCES`]
/// * [`Status::MEDIA_CHANGED`]
pub fn open_volume(&mut self) -> Result<Directory> {
let mut ptr = ptr::null_mut();
unsafe { (self.0.open_volume)(&mut self.0, &mut ptr) }
Expand Down
Loading
Loading