@@ -8,31 +8,21 @@ use alloc::vec;
8
8
use alloc:: vec:: Vec ;
9
9
use core:: fmt;
10
10
use core:: fmt:: { Debug , Formatter } ;
11
- use core :: ops :: Deref ;
11
+ use uefi :: boot :: ScopedProtocol ;
12
12
13
13
/// Return type for public [`FileSystem`] operations.
14
14
pub type FileSystemResult < T > = Result < T , Error > ;
15
15
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
-
26
16
/// High-level file-system abstraction for UEFI volumes with an API that is
27
17
/// close to `std::fs`. It acts as convenient accessor around the
28
18
/// [`SimpleFileSystemProtocol`].
29
19
///
30
20
/// Please refer to the [module documentation] for more information.
31
21
///
32
22
/// [module documentation]: uefi::fs
33
- pub struct FileSystem < ' a > ( FileSystemInner < ' a > ) ;
23
+ pub struct FileSystem ( ScopedProtocol < SimpleFileSystemProtocol > ) ;
34
24
35
- impl < ' a > FileSystem < ' a > {
25
+ impl FileSystem {
36
26
/// Constructor.
37
27
#[ must_use]
38
28
pub fn new ( proto : impl Into < Self > ) -> Self {
@@ -396,11 +386,7 @@ impl<'a> FileSystem<'a> {
396
386
397
387
/// Opens a fresh handle to the root directory of the volume.
398
388
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| {
404
390
Error :: Io ( IoError {
405
391
path : {
406
392
let mut path = PathBuf :: new ( ) ;
@@ -445,25 +431,15 @@ impl<'a> FileSystem<'a> {
445
431
}
446
432
}
447
433
448
- impl < ' a > Debug for FileSystem < ' a > {
434
+ impl Debug for FileSystem {
449
435
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 ;
454
437
f. debug_tuple ( "FileSystem" ) . field ( & ptr) . finish ( )
455
438
}
456
439
}
457
440
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 {
466
442
fn from ( proto : uefi:: boot:: ScopedProtocol < SimpleFileSystemProtocol > ) -> Self {
467
- Self ( FileSystemInner :: WithoutLifetime ( proto) )
443
+ Self ( proto)
468
444
}
469
445
}
0 commit comments