Skip to content

Commit 118afe7

Browse files
authored
Merge pull request #624 from phip1611/debug-for-files
debug: add debug implementation for file-related structs
2 parents 6d889f0 + 8f9c65d commit 118afe7

File tree

4 files changed

+7
-2
lines changed

4 files changed

+7
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
- Added the `ComponentName1` and `ComponentName2` protocols. The `ComponentName`
88
wrapper will automatically select `ComponentName2` if available, and fall back
99
to `ComponentName1` otherwise.
10+
- `FileType`, `FileHandle`, `RegularFile`, and `Directory` now implement `Debug`.
1011

1112
### Changed
1213

uefi/src/proto/media/file/dir.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ use {alloc::alloc::Global, core::alloc::Allocator};
1313
/// addition to supporting the normal `File` operations, `Directory`
1414
/// supports iterating over its contained files.
1515
#[repr(transparent)]
16+
#[derive(Debug)]
1617
pub struct Directory(RegularFile);
1718

1819
impl Directory {

uefi/src/proto/media/file/mod.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,6 +236,7 @@ impl<T: File> FileInternal for T {}
236236
///
237237
/// Dropping this structure will result in the file handle being closed.
238238
#[repr(transparent)]
239+
#[derive(Debug)]
239240
pub struct FileHandle(*mut FileImpl);
240241

241242
impl FileHandle {
@@ -365,7 +366,8 @@ pub(super) struct FileImpl {
365366
flush: extern "efiapi" fn(this: &mut FileImpl) -> Status,
366367
}
367368

368-
/// Disambiguates the file type. Returned by `File::into_type()`.
369+
/// Disambiguate the file type. Returned by `File::into_type()`.
370+
#[derive(Debug)]
369371
pub enum FileType {
370372
/// The file was a regular (data) file.
371373
Regular(RegularFile),

uefi/src/proto/media/file/regular.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,12 @@ use crate::{Result, Status};
77
/// In addition to supporting the normal `File` operations, `RegularFile`
88
/// supports direct reading and writing.
99
#[repr(transparent)]
10+
#[derive(Debug)]
1011
pub struct RegularFile(FileHandle);
1112

1213
impl RegularFile {
1314
/// A special position used to seek to the end of a file with `set_position()`.
14-
pub const END_OF_FILE: u64 = core::u64::MAX;
15+
pub const END_OF_FILE: u64 = u64::MAX;
1516

1617
/// Coverts a `FileHandle` into a `RegularFile` without checking the file kind.
1718
/// # Safety

0 commit comments

Comments
 (0)