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

Commit ec9ffa3

Browse files
Merge pull request #785 from nicholasbishop/bishop-move-memdv
uefi: Make MEMORY_DESCRIPTOR_VERSION an associated constant
2 parents 4b08270 + 3feb78b commit ec9ffa3

File tree

3 files changed

+8
-4
lines changed

3 files changed

+8
-4
lines changed

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,8 @@
4141
method has been removed; usually the `guid!` macro is a more convenient
4242
choice, but `new` or `from_bytes` can also be used if needed. There are also a
4343
number of new `Guid` methods.
44+
- The `MEMORY_DESCRIPTOR_VERSION` constant has been moved to
45+
`MemoryDescriptor::VERSION`.
4446

4547
## uefi-macros - [Unreleased]
4648

‎uefi/src/table/boot.rs‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1893,9 +1893,6 @@ impl MemoryType {
18931893
}
18941894
}
18951895

1896-
/// Memory descriptor version number
1897-
pub const MEMORY_DESCRIPTOR_VERSION: u32 = 1;
1898-
18991896
/// A structure describing a region of memory.
19001897
#[derive(Debug, Copy, Clone)]
19011898
#[repr(C)]
@@ -1912,6 +1909,11 @@ pub struct MemoryDescriptor {
19121909
pub att: MemoryAttribute,
19131910
}
19141911

1912+
impl MemoryDescriptor {
1913+
/// Memory descriptor version number.
1914+
pub const VERSION: u32 = 1;
1915+
}
1916+
19151917
impl Default for MemoryDescriptor {
19161918
fn default() -> MemoryDescriptor {
19171919
MemoryDescriptor {

‎uefi/src/table/system.rs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ impl SystemTable<Runtime> {
316316
// See https://rust-lang.github.io/unsafe-code-guidelines/layout/arrays-and-slices.html
317317
let map_size = core::mem::size_of_val(map);
318318
let entry_size = core::mem::size_of::<MemoryDescriptor>();
319-
let entry_version = crate::table::boot::MEMORY_DESCRIPTOR_VERSION;
319+
let entry_version = MemoryDescriptor::VERSION;
320320
let map_ptr = map.as_mut_ptr();
321321
((*(*self.table).runtime).set_virtual_address_map)(
322322
map_size,

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /