1use crate::{TagHeader, TagType};
4use core::mem;
5use multiboot2_common::{MaybeDynSized, Tag};
6
7#[derive(Debug)]
9#[repr(C, align(8))]
10pub struct BootdevTag {
11 header: TagHeader,
12 biosdev: u32,
13 slice: u32,
14 part: u32,
15}
16
17impl BootdevTag {
18 #[must_use]
20 pub fn new(biosdev: u32, slice: u32, part: u32) -> Self {
21 Self {
22 header: TagHeader::new(Self::ID, mem::size_of::<Self>() as u32),
23 biosdev,
24 slice,
25 part,
26 }
27 }
28
29 #[must_use]
34 pub const fn biosdev(&self) -> u32 {
35 self.biosdev
36 }
37
38 #[must_use]
42 pub const fn slice(&self) -> u32 {
43 self.slice
44 }
45
46 #[must_use]
50 pub const fn part(&self) -> u32 {
51 self.part
52 }
53}
54
55impl MaybeDynSized for BootdevTag {
56 type Header = TagHeader;
57
58 const BASE_SIZE: usize = mem::size_of::<Self>();
59
60 fn dst_len(_: &TagHeader) {}
61}
62
63impl Tag for BootdevTag {
64 type IDType = TagType;
65
66 const ID: TagType = TagType::Bootdev;
67}