Skip to content

Commit 2955277

Browse files
Caduser2020Caduser2020
Caduser2020
authored and
Caduser2020
committed
Improve usage of repr(packed)
1 parent 66c533c commit 2955277

File tree

4 files changed

+5
-5
lines changed

4 files changed

+5
-5
lines changed

src/framebuffer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ pub struct FramebufferField {
6666

6767
/// A framebuffer color descriptor in the palette.
6868
#[derive(Clone, Copy, Debug, PartialEq)]
69-
#[repr(C, packed)]
69+
#[repr(C, packed)] // only repr(C) would add unwanted padding at the end
7070
pub struct FramebufferColor {
7171
/// The Red component of the color.
7272
pub red: u8,

src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ pub struct BootInformation {
115115
}
116116

117117
#[derive(Clone, Copy)]
118-
#[repr(C, packed)]
118+
#[repr(C)]
119119
struct BootInformationInner {
120120
total_size: u32,
121121
_reserved: u32,

src/module.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ use header::{Tag, TagIter};
33
/// This tag indicates to the kernel what boot module was loaded along with
44
/// the kernel image, and where it can be found.
55
#[derive(Clone, Copy, Debug)]
6-
#[repr(C, packed)]
6+
#[repr(C, packed)] // only repr(C) would add unwanted padding near name_byte.
77
pub struct ModuleTag {
88
typ: u32,
99
size: u32,

src/rsdp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ const RSDPV1_LENGTH: usize = 20;
1313

1414
/// EFI system table in 32 bit mode
1515
#[derive(Clone, Copy, Debug)]
16-
#[repr(C, packed)]
16+
#[repr(C, packed)] // only repr(C) would add unwanted padding before first_section
1717
pub struct EFISdt32 {
1818
typ: u32,
1919
size: u32,
@@ -29,7 +29,7 @@ impl EFISdt32 {
2929

3030
/// EFI system table in 64 bit mode
3131
#[derive(Clone, Copy, Debug)]
32-
#[repr(C, packed)]
32+
#[repr(C)]
3333
pub struct EFISdt64 {
3434
typ: u32,
3535
size: u32,

0 commit comments

Comments
 (0)