Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

EFI Shell Interface: CurDir Functions #1740

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

Conversation

Copy link
Contributor

@RenTrieu RenTrieu commented Aug 11, 2025

This PR implements the wrappers for the GetCurDir and SetCurDir EFI Shell Protocol functions as part of the effort to address #448 .

Checklist

  • GetCurDir
  • SetCurDir

This commit implements wrappers for the following EFI Shell Protocol
functions: set_cur_dir() and get_cur_dir().
This commit includes tests for the following EFI Shell Protocol functions:
get_cur_dir() and set_cur_dir().
@RenTrieu RenTrieu force-pushed the enhancement/efi_shell_interface_cur_dir branch from 4bef474 to 873e382 Compare August 12, 2025 15:29
Copy link
Contributor Author

Hi Philipp. Thanks for catching these! It looks like when rebasing the commits, although I removed references to the other PR from the commit messages I neglected to do so from the code in all but the most recent commit. I've addressed it now and will also do so shortly for #1679.

phip1611 reacted with hooray emoji

@@ -2,12 +2,64 @@

//! EFI Shell Protocol v2.2

use crate::proto::unsafe_protocol;
use uefi_macros::unsafe_protocol;
Copy link
Member

@nicholasbishop nicholasbishop Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We're not entirely consistent in this project, but I'd prefer to use crate::proto::unsafe_protocol.

phip1611 and RenTrieu reacted with thumbs up emoji
/// * `Some(cwd)` - CStr16 containing the current working directory
/// * `None` - Could not retrieve current directory
#[must_use]
pub fn current_dir(&self, file_system_mapping: Option<&CStr16>) -> Option<&CStr16> {
Copy link
Member

@nicholasbishop nicholasbishop Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should return Result. That does mean we need to pick an error code. I think Status::NOT_FOUND should work fine.

RenTrieu reacted with thumbs up emoji
#[unsafe_protocol(ShellProtocol::GUID)]
pub struct Shell(ShellProtocol);
impl Shell {
/// Returns the current directory on the specified device
Copy link
Member

@nicholasbishop nicholasbishop Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: period at end of sentence.

RenTrieu reacted with thumbs up emoji
/// # Arguments
///
/// * `file_system` - Pointer to the file system's mapped name.
/// * `directory` - Points to the directory on the device specified by
Copy link
Member

@nicholasbishop nicholasbishop Aug 14, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Drop the Pointer/Points to. E.g. file_system - File system's mapped name.`

RenTrieu reacted with thumbs up emoji
@RenTrieu RenTrieu force-pushed the enhancement/efi_shell_interface_cur_dir branch from 938b425 to 3b60964 Compare August 18, 2025 17:01
@RenTrieu RenTrieu force-pushed the enhancement/efi_shell_interface_cur_dir branch from 3b60964 to 175340a Compare August 18, 2025 18:40
Co-authored-by: Nicholas Bishop <nbishop@nbishop.net>
@RenTrieu RenTrieu force-pushed the enhancement/efi_shell_interface_cur_dir branch from 175340a to 18953be Compare August 18, 2025 20:10
Copy link
Member

@nicholasbishop nicholasbishop left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lgtm, thanks :)

RenTrieu reacted with hooray emoji
@nicholasbishop nicholasbishop added this pull request to the merge queue Aug 18, 2025
Merged via the queue into rust-osdev:main with commit a288116 Aug 18, 2025
27 of 28 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers

@phip1611 phip1611 phip1611 left review comments

@nicholasbishop nicholasbishop nicholasbishop approved these changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /