Skip to content

Commit 4bc53e3

Browse files
committed
Fixes from PR
1. Fix Cargo.lock: Just fixing all the downgrades that heppened during rebase. 2. Add comments suggested in PR 3. Bug fixes Signed-off-by: Ayush Singh <ayushsingh1325@gmail.com>
1 parent 8cd315c commit 4bc53e3

File tree

13 files changed

+44
-50
lines changed

13 files changed

+44
-50
lines changed

Cargo.lock

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -927,11 +927,11 @@ dependencies = [
927927

928928
[[package]]
929929
name = "crc32fast"
930-
version = "1.2.0"
930+
version = "1.3.2"
931931
source = "registry+https://github.com/rust-lang/crates.io-index"
932-
checksum = "ba125de2af0df55319f41944744ad91c71113bf74a4646efff39afe1f6842db1"
932+
checksum = "b540bd8bc810d3885c6ea91e2018302f68baba2129ab3e88f32389ee9370880d"
933933
dependencies = [
934-
"cfg-if 0.1.10",
934+
"cfg-if 1.0.0",
935935
]
936936

937937
[[package]]
@@ -1635,9 +1635,9 @@ checksum = "9b919933a397b79c37e33b77bb2aa3dc8eb6e165ad809e58ff75bc7db2e34574"
16351635

16361636
[[package]]
16371637
name = "globset"
1638-
version = "0.4.5"
1638+
version = "0.4.9"
16391639
source = "registry+https://github.com/rust-lang/crates.io-index"
1640-
checksum = "7ad1da430bd7281dde2576f44c84cc3f0f7b475e7202cd503042dff01a8c8120"
1640+
checksum = "0a1e17342619edbc21a964c2afbeb6c820c6a2560032872f397bb97ea127bd0a"
16411641
dependencies = [
16421642
"aho-corasick",
16431643
"bstr 0.2.17",
@@ -1861,9 +1861,9 @@ checksum = "c3360c7b59e5ffa2653671fb74b4741a5d343c03f331c0a4aeda42b5c2b0ec7d"
18611861

18621862
[[package]]
18631863
name = "ignore"
1864-
version = "0.4.17"
1864+
version = "0.4.18"
18651865
source = "registry+https://github.com/rust-lang/crates.io-index"
1866-
checksum = "b287fb45c60bb826a0dc68ff08742b9d88a2fea13d6e0c286b3172065aaf878c"
1866+
checksum = "713f1b139373f96a2e0ce3ac931cd01ee973c3c5dd7c40c0c2efe96ad2b6751d"
18671867
dependencies = [
18681868
"crossbeam-utils",
18691869
"globset",
@@ -1911,12 +1911,9 @@ dependencies = [
19111911

19121912
[[package]]
19131913
name = "indoc"
1914-
version = "1.0.3"
1914+
version = "1.0.6"
19151915
source = "registry+https://github.com/rust-lang/crates.io-index"
1916-
checksum = "e5a75aeaaef0ce18b58056d306c27b07436fbb34b8816c53094b76dd81803136"
1917-
dependencies = [
1918-
"unindent",
1919-
]
1916+
checksum = "05a0bd019339e5d968b37855180087b7b9d512c5046fbd244cf8c95687927d6e"
19201917

19211918
[[package]]
19221919
name = "installer"
@@ -2539,9 +2536,9 @@ dependencies = [
25392536

25402537
[[package]]
25412538
name = "openssl-probe"
2542-
version = "0.1.2"
2539+
version = "0.1.5"
25432540
source = "registry+https://github.com/rust-lang/crates.io-index"
2544-
checksum = "77af24da69f9d9341038eba93a073b1fdaaa1b788221b00a69bce9e762cb32de"
2541+
checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf"
25452542

25462543
[[package]]
25472544
name = "openssl-src"
@@ -5564,12 +5561,6 @@ dependencies = [
55645561
"diff",
55655562
]
55665563

5567-
[[package]]
5568-
name = "unindent"
5569-
version = "0.1.7"
5570-
source = "registry+https://github.com/rust-lang/crates.io-index"
5571-
checksum = "f14ee04d9415b52b3aeab06258a3f07093182b88ba0f9b8d203f211a7a7d41c7"
5572-
55735564
[[package]]
55745565
name = "unstable-book-gen"
55755566
version = "0.1.0"

Cargo.toml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,5 +113,3 @@ rustc-std-workspace-std = { path = 'library/rustc-std-workspace-std' }
113113

114114
[patch."https://github.com/rust-lang/rust-clippy"]
115115
clippy_lints = { path = "src/tools/clippy/clippy_lints" }
116-
117-

library/std/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -234,6 +234,7 @@
234234
)]
235235
//
236236
// Language features:
237+
#![feature(abi_efiapi)]
237238
#![feature(alloc_error_handler)]
238239
#![feature(allocator_internals)]
239240
#![feature(allow_internal_unsafe)]
@@ -251,6 +252,7 @@
251252
#![feature(doc_masked)]
252253
#![feature(doc_notable_trait)]
253254
#![feature(dropck_eyepatch)]
255+
#![feature(exclusive_range_pattern)]
254256
#![feature(exhaustive_patterns)]
255257
#![feature(if_let_guard)]
256258
#![feature(intra_doc_pointers)]
@@ -272,15 +274,13 @@
272274
#![feature(thread_local)]
273275
#![feature(try_blocks)]
274276
#![feature(utf8_chunks)]
275-
#![feature(abi_efiapi)]
276-
#![feature(exclusive_range_pattern)]
277-
#![feature(const_option)]
278277
//
279278
// Library features (core):
280279
#![feature(array_error_internals)]
281280
#![feature(atomic_mut_ptr)]
282281
#![feature(char_error_internals)]
283282
#![feature(char_internals)]
283+
#![feature(const_option)]
284284
#![feature(core_intrinsics)]
285285
#![feature(cstr_from_bytes_until_nul)]
286286
#![feature(cstr_internals)]

library/std/src/os/mod.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,9 +147,10 @@ pub mod solid;
147147
pub mod vxworks;
148148
#[cfg(target_os = "watchos")]
149149
pub(crate) mod watchos;
150-
151150
#[cfg(target_os = "uefi")]
152151
pub mod uefi;
152+
#[cfg(target_os = "vxworks")]
153+
pub mod vxworks;
153154

154155
#[cfg(any(unix, target_os = "wasi", doc))]
155156
pub mod fd;

library/std/src/os/uefi/env.rs

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,37 +20,37 @@ pub(crate) fn init_globals(handle: NonNull<c_void>, system_table: NonNull<System
2020
GLOBAL_SYSTEM_HANDLE.store(handle.as_ptr(), Ordering::SeqCst);
2121
}
2222

23-
#[unstable(feature = "uefi_std", issue = "none")]
2423
/// Get the SystemTable Pointer.
24+
#[unstable(feature = "uefi_std", issue = "100499")]
2525
pub fn get_system_table() -> Option<NonNull<SystemTable>> {
2626
NonNull::new(GLOBAL_SYSTEM_TABLE.load(Ordering::SeqCst))
2727
}
2828

29-
#[unstable(feature = "uefi_std", issue = "none")]
3029
/// Get the SystemHandle Pointer.
30+
#[unstable(feature = "uefi_std", issue = "100499")]
3131
pub fn get_system_handle() -> Option<NonNull<c_void>> {
3232
NonNull::new(GLOBAL_SYSTEM_HANDLE.load(Ordering::SeqCst))
3333
}
3434

35-
#[unstable(feature = "uefi_std", issue = "none")]
3635
/// Get the BootServices Pointer.
36+
#[unstable(feature = "uefi_std", issue = "100499")]
3737
pub fn get_boot_services() -> Option<NonNull<BootServices>> {
3838
let system_table = get_system_table()?;
3939
let boot_services = unsafe { (*system_table.as_ptr()).boot_services };
4040
NonNull::new(boot_services)
4141
}
4242

43-
#[unstable(feature = "uefi_std", issue = "none")]
4443
/// Get the RuntimeServices Pointer.
44+
#[unstable(feature = "uefi_std", issue = "100499")]
4545
pub fn get_runtime_services() -> Option<NonNull<RuntimeServices>> {
4646
let system_table = get_system_table()?;
4747
let runtime_services = unsafe { (*system_table.as_ptr()).runtime_services };
4848
NonNull::new(runtime_services)
4949
}
5050

51-
#[unstable(feature = "uefi_std", issue = "none")]
5251
/// Open Protocol on a handle
5352
/// Implemented using `EFI_BOOT_SERVICES.OpenProtocol()`
53+
#[unstable(feature = "uefi_std", issue = "100499")]
5454
pub fn open_protocol<T>(
5555
handle: NonNull<c_void>,
5656
mut protocol_guid: Guid,
@@ -80,9 +80,9 @@ pub fn open_protocol<T>(
8080
}
8181
}
8282

83-
#[unstable(feature = "uefi_std", issue = "none")]
84-
// Locate handles with a particula protocol Guid
83+
// Locate handles with a particular protocol GUID
8584
/// Implemented using `EFI_BOOT_SERVICES.LocateHandles()`
85+
#[unstable(feature = "uefi_std", issue = "100499")]
8686
pub fn locate_handles(mut guid: Guid) -> io::Result<Vec<NonNull<c_void>>> {
8787
fn inner(
8888
guid: &mut Guid,
@@ -117,11 +117,14 @@ pub fn locate_handles(mut guid: Guid) -> io::Result<Vec<NonNull<c_void>>> {
117117
},
118118
}
119119

120-
let mut buf: Vec<Handle> = Vec::with_capacity(buf_len);
121-
120+
// The returned buf_len is in bytes
121+
let mut buf: Vec<Handle> = Vec::with_capacity(buf_len / crate::mem::size_of::<Handle>());
122122
match inner(&mut guid, boot_services, &mut buf_len, buf.as_mut_ptr()) {
123123
Ok(()) => {
124-
unsafe { buf.set_len(buf_len) };
124+
// SAFETY: This is safe because the call will succeed only if buf_len >= required
125+
// length. Also, on success, the `buf_len` is updated with the size of bufferv (in
126+
// bytes) written
127+
unsafe { buf.set_len(buf_len / crate::mem::size_of::<Handle>()) };
125128
Ok(buf.iter().filter_map(|x| NonNull::new(*x)).collect())
126129
}
127130
Err(e) => Err(e),

library/std/src/os/uefi/ffi.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@ use crate::ffi::{OsStr, OsString};
22
use crate::sealed::Sealed;
33
use crate::sys_common::ucs2;
44

5-
#[unstable(feature = "uefi_std", issue = "none")]
5+
#[unstable(feature = "uefi_std", issue = "100499")]
66
pub trait OsStrExt: Sealed {
77
/// This function does not do any allocation
88
fn to_ucs2<'a>(&'a self) -> ucs2::EncodeUcs2<'a>;
99

1010
/// Creates a UCS-2 Vec which can be passed for FFI.
11-
/// Note: The returned string is NULL terminated.
12-
/// Note: The supplied should not contain NULL.
11+
/// Note: This function will replace `NULL` and other characters which are not valid in UEFI
12+
/// strings with `std::sys_common::ucs::Ucs2Char::REPLACEMENT_CHARACTER`
1313
fn to_ffi_string(&self) -> Vec<u16> {
1414
let mut v: Vec<u16> = self
1515
.to_ucs2()
@@ -32,7 +32,7 @@ impl OsStrExt for OsStr {
3232
}
3333
}
3434

35-
#[unstable(feature = "uefi_std", issue = "none")]
35+
#[unstable(feature = "uefi_std", issue = "100499")]
3636
pub trait OsStringExt: Sealed
3737
where
3838
Self: Sized,

library/std/src/os/uefi/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
//! Platform-specific extensions to `std` for UEFI.
22
3-
#![unstable(feature = "uefi_std", issue = "none")]
3+
#![unstable(feature = "uefi_std", issue = "100499")]
44

55
pub mod env;
66
pub mod ffi;

library/std/src/os/uefi/net.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,25 @@
1-
#[unstable(feature = "uefi_std", issue = "none")]
1+
#[unstable(feature = "uefi_std", issue = "100499")]
22
impl From<r_efi::efi::Ipv6Address> for crate::net::Ipv6Addr {
33
fn from(t: r_efi::efi::Ipv6Address) -> Self {
44
Self::from(t.addr)
55
}
66
}
77

8-
#[unstable(feature = "uefi_std", issue = "none")]
8+
#[unstable(feature = "uefi_std", issue = "100499")]
99
impl From<&crate::net::Ipv6Addr> for r_efi::efi::Ipv6Address {
1010
fn from(t: &crate::net::Ipv6Addr) -> Self {
1111
Self { addr: t.octets() }
1212
}
1313
}
1414

15-
#[unstable(feature = "uefi_std", issue = "none")]
15+
#[unstable(feature = "uefi_std", issue = "100499")]
1616
impl From<r_efi::efi::Ipv4Address> for crate::net::Ipv4Addr {
1717
fn from(t: r_efi::efi::Ipv4Address) -> Self {
1818
Self::from(t.addr)
1919
}
2020
}
2121

22-
#[unstable(feature = "uefi_std", issue = "none")]
22+
#[unstable(feature = "uefi_std", issue = "100499")]
2323
impl From<&crate::net::Ipv4Addr> for r_efi::efi::Ipv4Address {
2424
fn from(t: &crate::net::Ipv4Addr) -> Self {
2525
Self { addr: t.octets() }

library/std/src/os/uefi/path.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use crate::ptr::NonNull;
77
use crate::sys_common::{ucs2, AsInner};
88
use r_efi::protocols::{device_path, device_path_from_text, device_path_to_text};
99

10-
#[unstable(feature = "uefi_std", issue = "none")]
10+
#[unstable(feature = "uefi_std", issue = "100499")]
1111
impl TryFrom<&DevicePath> for PathBuf {
1212
type Error = crate::io::Error;
1313

@@ -16,7 +16,7 @@ impl TryFrom<&DevicePath> for PathBuf {
1616
}
1717
}
1818

19-
#[unstable(feature = "uefi_std", issue = "none")]
19+
#[unstable(feature = "uefi_std", issue = "100499")]
2020
impl TryFrom<NonNull<device_path::Protocol>> for PathBuf {
2121
type Error = crate::io::Error;
2222

library/std/src/path.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ pub enum Prefix<'a> {
189189

190190
/// UEFI Device Prefix. e.g., `PciRoot(0x0)/Pci(0x1,0x1)/Ata(0x0)/CDROM(0x0)`
191191
/// Sometimes also represented like Windows Disks, but this is more general
192-
#[unstable(feature = "uefi_std", issue = "none")]
192+
#[unstable(feature = "uefi_std", issue = "100499")]
193193
UefiDevice(&'a OsStr),
194194
}
195195

0 commit comments

Comments
 (0)