Skip to content

Commit 895156d

Browse files
committed
uefi: mem: memory-map: break API
As deprecated re-exports are unsupported [0], we go the hard way and just make it a breaking change. Along the way, I reordered some statements in some files to follow our typical order of: - pub mod - private mod - pub use - private use
1 parent dd14f00 commit 895156d

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
pub fn test(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+
use crate::mem::memory_map::MemoryType;
1920
use crate::proto::loaded_image::LoadedImage;
20-
use crate::table::boot::{BootServices, MemoryType};
21+
use crate::table::boot::BootServices;
2122
use crate::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
pub desc_size: usize,
7272
/// A unique memory key bound to a specific memory map version/state.
73-
pub map_key: crate::table::boot::MemoryMapKey,
73+
pub map_key: MemoryMapKey,
7474
/// The version of the descriptor struct.
7575
pub desc_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
use crate::data_types::UnalignedSlice;
9+
use crate::mem::memory_map::MemoryType;
910
use crate::polyfill::maybe_uninit_slice_as_mut_ptr;
1011
use crate::proto::device_path::{
1112
DevicePathHeader, DevicePathNode, DeviceSubType, DeviceType, NodeConversionError,
1213
};
1314
use crate::proto::network::IpAddress;
14-
use crate::table::boot::MemoryType;
1515
use crate::{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
use crate::data_types::FromSliceWithNulError;
4+
use crate::mem::memory_map::MemoryType;
45
use crate::proto::device_path::DevicePath;
56
use crate::proto::unsafe_protocol;
6-
use crate::table::boot::MemoryType;
77
use crate::util::usize_from_u32;
88
use crate::{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
use crate::data_types::PhysicalAddress;
2+
use crate::mem::memory_map::MemoryAttribute;
23
use crate::proto::unsafe_protocol;
3-
use crate::table::boot::MemoryAttribute;
44
use crate::{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+
pub use uefi_raw::table::boot::{EventType, InterfaceType, Tpl};
4+
35
use super::Revision;
46
use crate::data_types::PhysicalAddress;
7+
use crate::mem::memory_map::*;
58
use crate::proto::device_path::DevicePath;
69
use crate::proto::loaded_image::LoadedImage;
710
use crate::proto::media::fs::SimpleFileSystem;
811
use crate::proto::{Protocol, ProtocolPointer};
912
use crate::util::opt_nonnull_to_ptr;
1013
use crate::{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-
pub use crate::mem::memory_map::*;
25-
pub use 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
static IMAGE_HANDLE: AtomicPtr<c_void> = AtomicPtr::new(ptr::null_mut());

0 commit comments

Comments
 (0)