Skip to content

Commit 8d4c97e

Browse files
committed
Fixes from PR
- Some comment fixes. - Make some functions unsafe. - Make helpers module private. - Rebase on master - Update r-efi to v4.2.0 Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
1 parent 48a9985 commit 8d4c97e

File tree

4 files changed

+8
-6
lines changed

4 files changed

+8
-6
lines changed

std/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ hermit-abi = { version = "0.3.2", features = ['rustc-dep-of-std'], public = true
4949
wasi = { version = "0.11.0", features = ['rustc-dep-of-std'], default-features = false }
5050

5151
[target.'cfg(target_os = "uefi")'.dependencies]
52-
r-efi = { version = "4.1.0", features = ['rustc-dep-of-std', 'efiapi']}
52+
r-efi = { version = "4.2.0", features = ['rustc-dep-of-std']}
5353
r-efi-alloc = { version = "1.0.0", features = ['rustc-dep-of-std']}
5454

5555
[features]

std/src/os/uefi/env.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub(crate) fn try_system_table() -> Option<NonNull<c_void>> {
6666
}
6767

6868
/// Get the SystemHandle Pointer.
69-
/// This function is mostly intended for places where panic is not an option
69+
/// This function is mostly intended for places where panicking is not an option
7070
pub(crate) fn try_image_handle() -> Option<NonNull<c_void>> {
7171
GLOBALS.get().map(|x| x.1)
7272
}

std/src/sys/uefi/helpers.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,9 @@ pub(crate) fn create_event(
295295
}
296296
}
297297

298-
pub(crate) fn close_event(evt: NonNull<crate::ffi::c_void>) -> io::Result<()> {
298+
/// # SAFETY
299+
/// - The supplied event must be valid
300+
pub(crate) unsafe fn close_event(evt: NonNull<crate::ffi::c_void>) -> io::Result<()> {
299301
let boot_services: NonNull<efi::BootServices> =
300302
boot_services().ok_or(BOOT_SERVICES_UNAVAILABLE)?.cast();
301303
let r = unsafe {

std/src/sys/uefi/mod.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub mod thread_local_key;
4747
#[path = "../unsupported/time.rs"]
4848
pub mod time;
4949

50-
pub(crate) mod helpers;
50+
mod helpers;
5151

5252
#[cfg(test)]
5353
mod tests;
@@ -96,7 +96,7 @@ pub(crate) unsafe fn init(argc: isize, argv: *const *const u8, _sigpipe: u8) {
9696
/// - must be called only once during runtime cleanup.
9797
pub unsafe fn cleanup() {
9898
if let Some(exit_boot_service_event) = EXIT_BOOT_SERVICE_EVENT.take() {
99-
let _ = helpers::close_event(exit_boot_service_event);
99+
let _ = unsafe { helpers::close_event(exit_boot_service_event) };
100100
}
101101
}
102102

@@ -123,7 +123,7 @@ pub fn decode_error_kind(code: i32) -> crate::io::ErrorKind {
123123

124124
pub fn abort_internal() -> ! {
125125
if let Some(exit_boot_service_event) = EXIT_BOOT_SERVICE_EVENT.take() {
126-
let _ = helpers::close_event(exit_boot_service_event);
126+
let _ = unsafe { helpers::close_event(exit_boot_service_event) };
127127
}
128128

129129
if let (Some(boot_services), Some(handle)) =

0 commit comments

Comments
 (0)