about summary refs log tree commit diff
path: root/library/std/src/sys/path/mod.rs
diff options
context:
space:
mode:
authorAyush Singh <ayush@beagleboard.org>2025-01-14 11:40:22 +0530
committerAyush Singh <ayush@beagleboard.org>2025-01-16 10:19:22 +0530
commitc1790b14bcd62df7bccdfa7d7fbe4533dfdcdc8c (patch)
tree0b8411c4a82206d30ccbe8f034f88dd34bbc7313 /library/std/src/sys/path/mod.rs
parent35c2908177a17ca4e0acbc9013e42ee525ba155c (diff)
downloadrust-c1790b14bcd62df7bccdfa7d7fbe4533dfdcdc8c.tar.gz
rust-c1790b14bcd62df7bccdfa7d7fbe4533dfdcdc8c.zip
uefi: Implement path
UEFI paths can be of 4 types:
1. Absolute Shell Path: Uses shell mappings
2. Absolute Device Path: this is what we want
3: Relative root: path relative to the current root.
4: Relative

Absolute shell path can be identified with `:` and Absolute Device path
can be identified with `/`. Relative root path will start with `\`.

The algorithm is mostly taken from edk2 UEFI shell implementation and is
somewhat simple. Check for the path type in order.

For Absolute Shell path, use `EFI_SHELL->GetDevicePathFromMap` to
get a BorrowedDevicePath for the volume.

For Relative paths, we use the current working directory to construct
the new path.

BorrowedDevicePath abstraction is needed to interact with
`EFI_SHELL->GetDevicePathFromMap` which returns a Device Path Protocol
with the lifetime of UEFI shell.

Absolute Shell paths cannot exist if UEFI shell is missing.

Signed-off-by: Ayush Singh <ayush@beagleboard.org>
Diffstat (limited to 'library/std/src/sys/path/mod.rs')
-rw-r--r--library/std/src/sys/path/mod.rs8
1 files changed, 4 insertions, 4 deletions
diff --git a/library/std/src/sys/path/mod.rs b/library/std/src/sys/path/mod.rs
index 24a94ec7828..1fa4e80d678 100644
--- a/library/std/src/sys/path/mod.rs
+++ b/library/std/src/sys/path/mod.rs
@@ -5,12 +5,12 @@ cfg_if::cfg_if! {
     } else if #[cfg(all(target_vendor = "fortanix", target_env = "sgx"))] {
         mod sgx;
         pub use sgx::*;
-    } else if #[cfg(any(
-        target_os = "uefi",
-        target_os = "solid_asp3",
-    ))] {
+    } else if #[cfg(target_os = "solid_asp3")] {
         mod unsupported_backslash;
         pub use unsupported_backslash::*;
+    } else if #[cfg(target_os = "uefi")] {
+        mod uefi;
+        pub use uefi::*;
     } else {
         mod unix;
         pub use unix::*;