Movatterモバイル変換


[0]ホーム

URL:


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

Commit61c00b9

Browse files
committed
uefi: mem: memory-map: break API
As deprecated re-exports are unsupported [0], we go the hard way andjust make it a breaking change.Along the way, I reordered some statements in some files to follow our typicalorder of:- pub mod- private mod- pub use- private use[0]rust-lang/rust#30827
1 parentdd14f00 commit61c00b9

File tree

13 files changed

+46
-41
lines changed

13 files changed

+46
-41
lines changed

‎uefi-test-runner/src/boot/memory.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
1-
use uefi::boot;
2-
use uefi::table::boot::{AllocateType,BootServices,MemoryMap,MemoryMapMut,MemoryType};
3-
41
use alloc::vec::Vec;
2+
use uefi::boot;
3+
use uefi::mem::memory_map::{MemoryMap,MemoryMapMut,MemoryType};
4+
use uefi::table::boot::{AllocateType,BootServices};
55

66
pubfntest(bt:&BootServices){
77
info!("Testing memory functions");

‎uefi-test-runner/src/boot/misc.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,11 @@ use core::ffi::c_void;
22
use core::ptr::{self,NonNull};
33

44
use core::mem;
5+
use uefi::mem::memory_map::MemoryType;
56
use uefi::proto::unsafe_protocol;
67
use uefi::table::boot::{
7-
BootServices,EventType,MemoryType,OpenProtocolAttributes,OpenProtocolParams,SearchType,
8-
TimerTrigger,Tpl,
8+
BootServices,EventType,OpenProtocolAttributes,OpenProtocolParams,SearchType,TimerTrigger,
9+
Tpl,
910
};
1011
use uefi::table::{Boot,SystemTable};
1112
use uefi::{guid,Event,Guid,Identify};

‎uefi-test-runner/src/main.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,11 @@ extern crate alloc;
88

99
use alloc::string::ToString;
1010
use alloc::vec::Vec;
11+
use uefi::mem::memory_map::{MemoryMap,MemoryType};
1112
use uefi::prelude::*;
1213
use uefi::proto::console::serial::Serial;
1314
use uefi::proto::device_path::build::{self,DevicePathBuilder};
1415
use uefi::proto::device_path::messaging::Vendor;
15-
use uefi::table::boot::{MemoryMap,MemoryType};
1616
use uefi::{print, println, system,Result};
1717

1818
mod boot;

‎uefi/CHANGELOG.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,16 @@
2424
-**Breaking:**`PcrEvent::new_in_buffer` and`PcrEventInputs::new_in_buffer`
2525
now take an initialized buffer (`[u8`] instead of`[MaybeUninit<u8>]`), and if
2626
the buffer is too small the required size is returned in the error data.
27-
- Exports of Memory Map-related types from`uefi::table::boot` are now
28-
deprecated. Use`uefi::mem::memory_map` instead.
29-
27+
-**Breaking** Exports of Memory Map-related types from`uefi::table::boot` are
28+
now removed. Use`uefi::mem::memory_map` instead. The patch you have to apply
29+
to the`use` statements of your code might look as follows:
30+
```diff
31+
1c1,2
32+
< use uefi::table::boot::{BootServices, MemoryMap, MemoryMapMut, MemoryType};
33+
---
34+
> use uefi::mem::memory_map::{MemoryMap, MemoryMapMut, MemoryType};
35+
> use uefi::table::boot::BootServices;
36+
```
3037

3138
#uefi - 0.29.0 (2024-07-02)
3239

‎uefi/src/allocator.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,9 @@ use core::ffi::c_void;
1616
use core::ptr;
1717
use core::sync::atomic::{AtomicPtr,AtomicU32,Ordering};
1818

19+
usecrate::mem::memory_map::MemoryType;
1920
usecrate::proto::loaded_image::LoadedImage;
20-
usecrate::table::boot::{BootServices,MemoryType};
21+
usecrate::table::boot::BootServices;
2122
usecrate::table::{Boot,SystemTable};
2223

2324
/// Reference to the system table, used to call the boot services pool memory

‎uefi/src/mem/memory_map/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
//! # Usecase: Obtain UEFI Memory Map
1010
//!
1111
//! You can use [`SystemTable::exit_boot_services`] or
12-
//! [`BootServices::memory_map`], which returns an properly initialized
12+
//! [`BootServices::memory_map`], which returns an properly initialized
1313
//! [`MemoryMapOwned`].
1414
//!
1515
//! # Usecase: Parse Memory Slice as UEFI Memory Map
@@ -70,7 +70,7 @@ pub struct MemoryMapMeta {
7070
/// and never `size_of::<MemoryDescriptor>()`!
7171
pubdesc_size:usize,
7272
/// A unique memory key bound to a specific memory map version/state.
73-
pubmap_key:crate::table::boot::MemoryMapKey,
73+
pubmap_key:MemoryMapKey,
7474
/// The version of the descriptor struct.
7575
pubdesc_version:u32,
7676
}

‎uefi/src/proto/device_path/device_path_gen.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@
66
// See `/xtask/src/device_path/README.md` for more details.
77

88
usecrate::data_types::UnalignedSlice;
9+
usecrate::mem::memory_map::MemoryType;
910
usecrate::polyfill::maybe_uninit_slice_as_mut_ptr;
1011
usecrate::proto::device_path::{
1112
DevicePathHeader,DevicePathNode,DeviceSubType,DeviceType,NodeConversionError,
1213
};
1314
usecrate::proto::network::IpAddress;
14-
usecrate::table::boot::MemoryType;
1515
usecrate::{guid,Guid};
1616
use bitflags::bitflags;
1717
use core::mem::{size_of, size_of_val};

‎uefi/src/proto/loaded_image.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
//! `LoadedImage` protocol.
22
33
usecrate::data_types::FromSliceWithNulError;
4+
usecrate::mem::memory_map::MemoryType;
45
usecrate::proto::device_path::DevicePath;
56
usecrate::proto::unsafe_protocol;
6-
usecrate::table::boot::MemoryType;
77
usecrate::util::usize_from_u32;
88
usecrate::{CStr16,Handle,Status};
99
use core::ffi::c_void;

‎uefi/src/proto/security/memory_protection.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
usecrate::data_types::PhysicalAddress;
2+
usecrate::mem::memory_map::MemoryAttribute;
23
usecrate::proto::unsafe_protocol;
3-
usecrate::table::boot::MemoryAttribute;
44
usecrate::{Result,StatusExt};
55
use core::ops::Range;
66
use uefi_raw::protocol::memory_protection::MemoryAttributeProtocol;

‎uefi/src/table/boot.rs

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,27 @@
11
//! UEFI services available during boot.
22
3+
pubuse uefi_raw::table::boot::{EventType,InterfaceType,Tpl};
4+
35
usesuper::Revision;
46
usecrate::data_types::PhysicalAddress;
7+
usecrate::mem::memory_map::*;
58
usecrate::proto::device_path::DevicePath;
69
usecrate::proto::loaded_image::LoadedImage;
710
usecrate::proto::media::fs::SimpleFileSystem;
811
usecrate::proto::{Protocol,ProtocolPointer};
912
usecrate::util::opt_nonnull_to_ptr;
1013
usecrate::{Char16,Error,Event,Guid,Handle,Result,Status,StatusExt};
14+
#[cfg(feature ="alloc")]
15+
use alloc::vec::Vec;
1116
use core::cell::UnsafeCell;
1217
use core::ffi::c_void;
18+
use core::fmt::Debug;
1319
use core::mem::{self,MaybeUninit};
1420
use core::ops::{Deref,DerefMut};
1521
use core::ptr::NonNull;
1622
use core::sync::atomic::{AtomicPtr,Ordering};
1723
use core::{ptr, slice};
1824

19-
#[cfg(feature ="alloc")]
20-
use alloc::vec::Vec;
21-
use core::fmt::Debug;
22-
23-
#[deprecated ="Use the `uefi::mem::memory_map` module."]
24-
pubusecrate::mem::memory_map::*;
25-
pubuse uefi_raw::table::boot::{EventType,InterfaceType,Tpl};
26-
2725
/// Global image handle. This is only set by `BootServices::set_image_handle`,
2826
/// and it is only read by `BootServices::image_handle`.
2927
staticIMAGE_HANDLE:AtomicPtr<c_void> =AtomicPtr::new(ptr::null_mut());

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp