Skip to content

Commit 6d2bf72

Browse files
committed
chore: upgrade zerocopy to 0.8
Migration guide for breaking changes between 0.7 and 0.8: google/zerocopy#1680 Signed-off-by: Patrick Roy <[email protected]>
1 parent a8974e8 commit 6d2bf72

File tree

7 files changed

+14
-14
lines changed

7 files changed

+14
-14
lines changed

src/acpi-tables/src/dsdt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
use std::mem::size_of;
55

66
use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
7-
use zerocopy::AsBytes;
7+
use zerocopy::IntoBytes;
88

99
use crate::{checksum, AcpiError, Result, Sdt, SdtHeader};
1010

src/acpi-tables/src/fadt.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
use vm_memory::{Bytes, GuestAddress, GuestMemory};
77
use zerocopy::little_endian::{U16, U32, U64};
8-
use zerocopy::AsBytes;
8+
use zerocopy::{Immutable, IntoBytes};
99

1010
use crate::{checksum, GenericAddressStructure, Result, Sdt, SdtHeader};
1111

@@ -42,7 +42,7 @@ pub const FADT_F_HW_REDUCED_ACPI: u8 = 20;
4242
/// More information about this table can be found in the ACPI specification:
4343
/// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
4444
#[repr(packed)]
45-
#[derive(Debug, Copy, Clone, Default, AsBytes)]
45+
#[derive(Debug, Copy, Clone, Default, IntoBytes, Immutable)]
4646
pub struct Fadt {
4747
header: SdtHeader,
4848
firmware_control: U32,

src/acpi-tables/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ pub use madt::Madt;
2020
pub use rsdp::Rsdp;
2121
pub use xsdt::Xsdt;
2222
use zerocopy::little_endian::{U32, U64};
23-
use zerocopy::AsBytes;
23+
use zerocopy::{Immutable, IntoBytes};
2424

2525
// This is the creator ID that we will embed in ACPI tables that are created using this crate.
2626
const FC_ACPI_CREATOR_ID: [u8; 4] = *b"FCAT";
@@ -50,7 +50,7 @@ pub type Result<T> = std::result::Result<T, AcpiError>;
5050

5151
/// ACPI type representing memory addresses
5252
#[repr(packed)]
53-
#[derive(AsBytes, Clone, Copy, Debug, Default)]
53+
#[derive(IntoBytes, Immutable, Clone, Copy, Debug, Default)]
5454
pub struct GenericAddressStructure {
5555
pub address_space_id: u8,
5656
pub register_bit_width: u8,
@@ -79,7 +79,7 @@ impl GenericAddressStructure {
7979

8080
/// Header included in all System Descriptor Tables
8181
#[repr(packed)]
82-
#[derive(Clone, Debug, Copy, Default, AsBytes)]
82+
#[derive(Clone, Debug, Copy, Default, IntoBytes, Immutable)]
8383
pub struct SdtHeader {
8484
pub signature: [u8; 4],
8585
pub length: U32,

src/acpi-tables/src/madt.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use std::mem::size_of;
77

88
use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
99
use zerocopy::little_endian::U32;
10-
use zerocopy::AsBytes;
10+
use zerocopy::{Immutable, IntoBytes};
1111

1212
use crate::{checksum, AcpiError, Result, Sdt, SdtHeader};
1313

@@ -18,7 +18,7 @@ const MADT_CPU_ENABLE_FLAG: u32 = 0;
1818
// everything with an underscore prefix
1919
#[allow(dead_code)]
2020
#[repr(packed)]
21-
#[derive(Copy, Clone, Debug, Default, AsBytes)]
21+
#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)]
2222
pub struct LocalAPIC {
2323
r#type: u8,
2424
length: u8,
@@ -44,7 +44,7 @@ impl LocalAPIC {
4444
// everything with an underscore prefix
4545
#[allow(dead_code)]
4646
#[repr(packed)]
47-
#[derive(Copy, Clone, Debug, Default, AsBytes)]
47+
#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)]
4848
pub struct IoAPIC {
4949
r#type: u8,
5050
length: u8,
@@ -72,7 +72,7 @@ impl IoAPIC {
7272
// everything with an underscore prefix
7373
#[allow(dead_code)]
7474
#[repr(packed)]
75-
#[derive(Debug, AsBytes)]
75+
#[derive(Debug, IntoBytes, Immutable)]
7676
struct MadtHeader {
7777
sdt: SdtHeader,
7878
base_address: U32,

src/acpi-tables/src/rsdp.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66

77
use vm_memory::{Bytes, GuestAddress, GuestMemory};
88
use zerocopy::little_endian::{U32, U64};
9-
use zerocopy::AsBytes;
9+
use zerocopy::{Immutable, IntoBytes};
1010

1111
use crate::{checksum, Result, Sdt};
1212

@@ -22,7 +22,7 @@ use crate::{checksum, Result, Sdt};
2222
/// More information about this structure can be found in the ACPI specification:
2323
/// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#root-system-description-pointer-rsdp
2424
#[repr(packed)]
25-
#[derive(Clone, Copy, Debug, Default, AsBytes)]
25+
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
2626
pub struct Rsdp {
2727
signature: [u8; 8],
2828
checksum: u8,

src/acpi-tables/src/xsdt.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
use std::mem::size_of;
77

88
use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
9-
use zerocopy::AsBytes;
9+
use zerocopy::IntoBytes;
1010

1111
use crate::{checksum, AcpiError, Result, Sdt, SdtHeader};
1212

src/vmm/src/acpi/x86_64.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use acpi_tables::fadt::{
1010
use acpi_tables::madt::{IoAPIC, LocalAPIC};
1111
use acpi_tables::Fadt;
1212
use vm_memory::GuestAddress;
13-
use zerocopy::AsBytes;
13+
use zerocopy::IntoBytes;
1414

1515
use crate::arch::x86_64::layout;
1616
use crate::device_manager::legacy::PortIODeviceManager;

0 commit comments

Comments
 (0)