Skip to content

Commit 8c99426

Browse files
committed
multiboot2: remove deprecated functions
1 parent 9a11495 commit 8c99426

File tree

4 files changed

+17
-36
lines changed

4 files changed

+17
-36
lines changed

multiboot2/Changelog.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,8 @@
77
`typ` parameter anymore, as it can be deduced from the provided type.
88
- **BREAKING** `BoxedDst::new` doesn't have the `typ` parameter anymore. This
99
only effects you when you wrote a custom DST tag.
10+
- **BREAKING** Removed deprecated functions `load` and `load_with_offset`. Use
11+
`BootInformation::load` instead.
1012

1113
## 0.17.0 (2023-07-12)
1214
- **BREAKING** Make functions of `InformationBuilder` chainable. They now consume the builder.

multiboot2/src/boot_loader_name.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,9 @@ impl BootLoaderNameTag {
3838
/// # Examples
3939
///
4040
/// ```rust,no_run
41-
/// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
41+
/// # use multiboot2::{BootInformation, BootInformationHeader};
42+
/// # let ptr = 0xdeadbeef as *const BootInformationHeader;
43+
/// # let boot_info = unsafe { BootInformation::load(ptr).unwrap() };
4244
/// if let Some(tag) = boot_info.boot_loader_name_tag() {
4345
/// assert_eq!(Ok("GRUB 2.02~beta3-5"), tag.name());
4446
/// }

multiboot2/src/command_line.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,9 @@ impl CommandLineTag {
4747
/// # Examples
4848
///
4949
/// ```rust,no_run
50-
/// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
50+
/// # use multiboot2::{BootInformation, BootInformationHeader};
51+
/// # let ptr = 0xdeadbeef as *const BootInformationHeader;
52+
/// # let boot_info = unsafe { BootInformation::load(ptr).unwrap() };
5153
/// if let Some(tag) = boot_info.command_line_tag() {
5254
/// let command_line = tag.cmdline();
5355
/// assert_eq!(Ok("/bootarg"), command_line);

multiboot2/src/lib.rs

Lines changed: 9 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -101,26 +101,6 @@ pub mod builder;
101101
/// that the Rust compiler output changes `eax` before you can access it.
102102
pub const MAGIC: u32 = 0x36d76289;
103103

104-
/// # Safety
105-
/// Deprecated. Please use BootInformation::load() instead.
106-
#[deprecated = "Please use BootInformation::load() instead."]
107-
pub unsafe fn load<'a>(address: usize) -> Result<BootInformation<'a>, MbiLoadError> {
108-
let ptr = address as *const BootInformationHeader;
109-
BootInformation::load(ptr)
110-
}
111-
112-
/// # Safety
113-
/// Deprecated. Please use BootInformation::load() instead.
114-
#[deprecated = "Please use BootInformation::load() instead."]
115-
pub unsafe fn load_with_offset<'a>(
116-
address: usize,
117-
offset: usize,
118-
) -> Result<BootInformation<'a>, MbiLoadError> {
119-
let ptr = address as *const u8;
120-
let ptr = ptr.add(offset);
121-
BootInformation::load(ptr.cast())
122-
}
123-
124104
/// Error type that describes errors while loading/parsing a multiboot2 information structure
125105
/// from a given address.
126106
#[derive(Display, Copy, Clone, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
@@ -262,7 +242,9 @@ impl<'a> BootInformation<'a> {
262242
/// This is the same as doing:
263243
///
264244
/// ```rust,no_run
265-
/// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
245+
/// # use multiboot2::{BootInformation, BootInformationHeader};
246+
/// # let ptr = 0xdeadbeef as *const BootInformationHeader;
247+
/// # let boot_info = unsafe { BootInformation::load(ptr).unwrap() };
266248
/// let end_addr = boot_info.start_address() + boot_info.total_size();
267249
/// ```
268250
pub fn end_address(&self) -> usize {
@@ -285,7 +267,9 @@ impl<'a> BootInformation<'a> {
285267
/// # Examples
286268
///
287269
/// ```rust,no_run
288-
/// # let boot_info = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
270+
/// # use multiboot2::{BootInformation, BootInformationHeader};
271+
/// # let ptr = 0xdeadbeef as *const BootInformationHeader;
272+
/// # let boot_info = unsafe { BootInformation::load(ptr).unwrap() };
289273
/// if let Some(sections) = boot_info.elf_sections() {
290274
/// let mut total = 0;
291275
/// for section in sections {
@@ -414,7 +398,7 @@ impl<'a> BootInformation<'a> {
414398
///
415399
/// ```no_run
416400
/// use std::str::Utf8Error;
417-
/// use multiboot2::{Tag, TagTrait, TagType, TagTypeId};
401+
/// use multiboot2::{BootInformation, BootInformationHeader, Tag, TagTrait, TagType, TagTypeId};
418402
///
419403
/// #[repr(C)]
420404
/// #[derive(multiboot2::Pointee)] // Only needed for DSTs.
@@ -442,8 +426,8 @@ impl<'a> BootInformation<'a> {
442426
/// Tag::get_dst_str_slice(&self.name)
443427
/// }
444428
/// }
445-
///
446-
/// let mbi = unsafe { multiboot2::load(0xdeadbeef).unwrap() };
429+
/// let mbi_ptr = 0xdeadbeef as *const BootInformationHeader;
430+
/// let mbi = unsafe { BootInformation::load(mbi_ptr).unwrap() };
447431
///
448432
/// let tag = mbi
449433
/// .get_tag::<CustomTag>()
@@ -1258,15 +1242,6 @@ mod tests {
12581242
let bi = bi.unwrap();
12591243
test_grub2_boot_info(&bi, addr, string_addr, &bytes.0, &string_bytes.0);
12601244

1261-
let bi = unsafe { load_with_offset(addr, 0) };
1262-
let bi = bi.unwrap();
1263-
test_grub2_boot_info(&bi, addr, string_addr, &bytes.0, &string_bytes.0);
1264-
1265-
let offset = 8usize;
1266-
let bi = unsafe { load_with_offset(addr - offset, offset) };
1267-
let bi = bi.unwrap();
1268-
test_grub2_boot_info(&bi, addr, string_addr, &bytes.0, &string_bytes.0);
1269-
12701245
// Check that the MBI's debug output can be printed without SEGFAULT.
12711246
// If this works, it is a good indicator than transitively a lot of
12721247
// stuff works.

0 commit comments

Comments
 (0)