From 5b29eba636c3c61ff5722da9201880fcec0f18d1 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Thu, 9 Jan 2025 01:49:16 +0000 Subject: [PATCH] block: vhdx: use C ABI-qualification for packed structures This fixes the following issue from beta Clippy: error: item uses `packed` representation without ABI-qualification Error: --> block/src/vhdx/vhdx_header.rs:333:1 | 331 | #[repr(packed)] | ------ `packed` representation set here 332 | #[derive(Clone, Copy, Debug)] 333 | / pub struct RegionTableEntry { 334 | | pub guid: Uuid, 335 | | pub file_offset: u64, 336 | | pub length: u32, 337 | | pub required: u32, 338 | | } | |_^ | = warning: unqualified `#[repr(packed)]` defaults to `#[repr(Rust, packed)]`, which has no stable ABI = help: qualify the desired ABI explicity via `#[repr(C, packed)]` or `#[repr(Rust, packed)]` = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#repr_packed_without_abi Signed-off-by: Wei Liu --- block/src/vhdx/vhdx_header.rs | 6 +++--- block/src/vhdx/vhdx_metadata.rs | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/block/src/vhdx/vhdx_header.rs b/block/src/vhdx/vhdx_header.rs index e7863d0da..bed5418d8 100644 --- a/block/src/vhdx/vhdx_header.rs +++ b/block/src/vhdx/vhdx_header.rs @@ -110,7 +110,7 @@ impl FileTypeIdentifier { } } -#[repr(packed)] +#[repr(C, packed)] #[derive(Clone, Copy, Debug)] pub struct Header { pub signature: u32, @@ -203,7 +203,7 @@ impl Header { } } -#[repr(packed)] +#[repr(C, packed)] #[derive(Clone, Copy, Debug)] struct RegionTableHeader { pub signature: u32, @@ -328,7 +328,7 @@ impl RegionInfo { } } -#[repr(packed)] +#[repr(C, packed)] #[derive(Clone, Copy, Debug)] pub struct RegionTableEntry { pub guid: Uuid, diff --git a/block/src/vhdx/vhdx_metadata.rs b/block/src/vhdx/vhdx_metadata.rs index 6284a9a5b..47cc2ff68 100644 --- a/block/src/vhdx/vhdx_metadata.rs +++ b/block/src/vhdx/vhdx_metadata.rs @@ -267,7 +267,7 @@ impl DiskSpec { } } -#[repr(packed)] +#[repr(C, packed)] #[derive(Default, Debug, Clone, Copy)] struct MetadataTableHeader { signature: u64, @@ -298,7 +298,7 @@ impl MetadataTableHeader { } } -#[repr(packed)] +#[repr(C, packed)] #[derive(Default, Debug, Clone, Copy)] pub struct MetadataTableEntry { item_id: Uuid,