Skip to content

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
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
Collaborator

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 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
@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