Skip to content

Conversation

RenTrieu
Copy link
Contributor

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

@RenTrieu RenTrieu mentioned this pull request Aug 11, 2025
45 tasks
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
@RenTrieu
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.

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

//! EFI Shell Protocol v2.2

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

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.

/// * `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

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.

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

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.

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

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 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 :)

@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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants