Skip to content
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

uefi: Implement path #135475

Merged
merged 1 commit into from
Jan 31, 2025
Merged

uefi: Implement path #135475

merged 1 commit into from
Jan 31, 2025

Conversation

Ayush1325
Copy link
Contributor

@Ayush1325 Ayush1325 commented Jan 14, 2025

This PR is split off from #135368 to reduce noise.

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.

cc @nicholasbishop

@rustbot
Copy link
Collaborator

rustbot commented Jan 14, 2025

r? @Amanieu

rustbot has assigned @Amanieu.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Jan 14, 2025
@Ayush1325 Ayush1325 force-pushed the uefi-absolute-path branch 2 times, most recently from 4549114 to aeeb1fd Compare January 15, 2025 05:50
library/std/src/sys/pal/uefi/helpers.rs Outdated Show resolved Hide resolved
library/std/src/sys/path/uefi.rs Outdated Show resolved Hide resolved
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 <[email protected]>
@Ayush1325
Copy link
Contributor Author

cc @tgross35

@Ayush1325
Copy link
Contributor Author

r? @jhpratt

@rustbot rustbot assigned jhpratt and unassigned Amanieu Jan 29, 2025
@jhpratt
Copy link
Member

jhpratt commented Jan 29, 2025

As a target maintainer has already given this the okay, this LGTM.

@bors r+

@bors
Copy link
Contributor

bors commented Jan 29, 2025

📌 Commit c1790b1 has been approved by jhpratt

It is now in the queue for this repository.

@bors bors added S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Jan 29, 2025
bors added a commit to rust-lang-ci/rust that referenced this pull request Jan 30, 2025
…iaskrgr

Rollup of 9 pull requests

Successful merges:

 - rust-lang#135026 (Cast global variables to default address space)
 - rust-lang#135475 (uefi: Implement path)
 - rust-lang#135852 (Add `AsyncFn*` to `core` prelude)
 - rust-lang#136004 (tests: Skip const OOM tests on aarch64-unknown-linux-gnu)
 - rust-lang#136157 (override build profile for bootstrap tests)
 - rust-lang#136180 (Introduce a wrapper for "typed valtrees" and properly check the type before extracting the value)
 - rust-lang#136256 (Add release notes for 1.84.1)
 - rust-lang#136271 (Remove minor future footgun in `impl Debug for MaybeUninit`)
 - rust-lang#136288 (Improve documentation for file locking)

r? `@ghost`
`@rustbot` modify labels: rollup
@bors bors merged commit 55c7a02 into rust-lang:master Jan 31, 2025
6 checks passed
@rustbot rustbot added this to the 1.86.0 milestone Jan 31, 2025
rust-timer added a commit to rust-lang-ci/rust that referenced this pull request Jan 31, 2025
Rollup merge of rust-lang#135475 - Ayush1325:uefi-absolute-path, r=jhpratt

uefi: Implement path

This PR is split off from rust-lang#135368 to reduce noise.

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.

cc `@nicholasbishop`
@Ayush1325 Ayush1325 deleted the uefi-absolute-path branch January 31, 2025 08:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-bors Status: Waiting on bors to run and complete tests. Bors will change the label on completion. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants