Skip to content

Commit cf52999

Browse files
uefi: Drop FileSystem conversion from table::boot::ScopedProtocol
1 parent 6896037 commit cf52999

File tree

2 files changed

+11
-32
lines changed

2 files changed

+11
-32
lines changed

uefi/CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## Changed
44
- **Breaking:** Deleted deprecated function `helpers::system_table`.
5+
- **Breaking:** `FileSystem` no longer has a lifetime parameter, and the
6+
deprecated conversion from `uefi::table::boot::ScopedProtocol` has been
7+
removed.
58

69

710
# uefi - 0.32.0 (2024-09-09)

uefi/src/fs/file_system/fs.rs

Lines changed: 8 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -8,31 +8,21 @@ use alloc::vec;
88
use alloc::vec::Vec;
99
use core::fmt;
1010
use core::fmt::{Debug, Formatter};
11-
use core::ops::Deref;
11+
use uefi::boot::ScopedProtocol;
1212

1313
/// Return type for public [`FileSystem`] operations.
1414
pub type FileSystemResult<T> = Result<T, Error>;
1515

16-
/// Contents of the `FileSystem` struct, allowing either variant of
17-
/// `ScopedProtocol` to be used. This is temporary; once `BootServices` and the
18-
/// associated `ScopedProtocol<'a>` structs are removed this inner type can be
19-
/// removed as well.
20-
enum FileSystemInner<'a> {
21-
#[allow(deprecated)]
22-
WithLifetime(uefi::table::boot::ScopedProtocol<'a, SimpleFileSystemProtocol>),
23-
WithoutLifetime(uefi::boot::ScopedProtocol<SimpleFileSystemProtocol>),
24-
}
25-
2616
/// High-level file-system abstraction for UEFI volumes with an API that is
2717
/// close to `std::fs`. It acts as convenient accessor around the
2818
/// [`SimpleFileSystemProtocol`].
2919
///
3020
/// Please refer to the [module documentation] for more information.
3121
///
3222
/// [module documentation]: uefi::fs
33-
pub struct FileSystem<'a>(FileSystemInner<'a>);
23+
pub struct FileSystem(ScopedProtocol<SimpleFileSystemProtocol>);
3424

35-
impl<'a> FileSystem<'a> {
25+
impl FileSystem {
3626
/// Constructor.
3727
#[must_use]
3828
pub fn new(proto: impl Into<Self>) -> Self {
@@ -396,11 +386,7 @@ impl<'a> FileSystem<'a> {
396386

397387
/// Opens a fresh handle to the root directory of the volume.
398388
fn open_root(&mut self) -> FileSystemResult<UefiDirectoryHandle> {
399-
match &mut self.0 {
400-
FileSystemInner::WithLifetime(proto) => proto.open_volume(),
401-
FileSystemInner::WithoutLifetime(proto) => proto.open_volume(),
402-
}
403-
.map_err(|err| {
389+
self.0.open_volume().map_err(|err| {
404390
Error::Io(IoError {
405391
path: {
406392
let mut path = PathBuf::new();
@@ -445,25 +431,15 @@ impl<'a> FileSystem<'a> {
445431
}
446432
}
447433

448-
impl<'a> Debug for FileSystem<'a> {
434+
impl Debug for FileSystem {
449435
fn fmt(&self, f: &mut Formatter<'_>) -> fmt::Result {
450-
let ptr: *const _ = match &self.0 {
451-
FileSystemInner::WithLifetime(proto) => proto.deref(),
452-
FileSystemInner::WithoutLifetime(proto) => proto.deref(),
453-
};
436+
let ptr: *const _ = &self.0;
454437
f.debug_tuple("FileSystem").field(&ptr).finish()
455438
}
456439
}
457440

458-
#[allow(deprecated)]
459-
impl<'a> From<uefi::table::boot::ScopedProtocol<'a, SimpleFileSystemProtocol>> for FileSystem<'a> {
460-
fn from(proto: uefi::table::boot::ScopedProtocol<'a, SimpleFileSystemProtocol>) -> Self {
461-
Self(FileSystemInner::WithLifetime(proto))
462-
}
463-
}
464-
465-
impl<'a> From<uefi::boot::ScopedProtocol<SimpleFileSystemProtocol>> for FileSystem<'a> {
441+
impl From<uefi::boot::ScopedProtocol<SimpleFileSystemProtocol>> for FileSystem {
466442
fn from(proto: uefi::boot::ScopedProtocol<SimpleFileSystemProtocol>) -> Self {
467-
Self(FileSystemInner::WithoutLifetime(proto))
443+
Self(proto)
468444
}
469445
}

0 commit comments

Comments
 (0)