Skip to content

Commit

Permalink
chore: upgrade zerocopy to 0.8
Browse files Browse the repository at this point in the history
Migration guide for breaking changes between 0.7 and 0.8:
google/zerocopy#1680

Signed-off-by: Patrick Roy <[email protected]>
  • Loading branch information
roypat committed Oct 9, 2024
1 parent a8974e8 commit 6d2bf72
Show file tree
Hide file tree
Showing 7 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/acpi-tables/src/dsdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
use std::mem::size_of;

use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
use zerocopy::AsBytes;
use zerocopy::IntoBytes;

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

Expand Down
4 changes: 2 additions & 2 deletions src/acpi-tables/src/fadt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

use vm_memory::{Bytes, GuestAddress, GuestMemory};
use zerocopy::little_endian::{U16, U32, U64};
use zerocopy::AsBytes;
use zerocopy::{Immutable, IntoBytes};

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

Expand Down Expand Up @@ -42,7 +42,7 @@ pub const FADT_F_HW_REDUCED_ACPI: u8 = 20;
/// More information about this table can be found in the ACPI specification:
/// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#fixed-acpi-description-table-fadt
#[repr(packed)]
#[derive(Debug, Copy, Clone, Default, AsBytes)]
#[derive(Debug, Copy, Clone, Default, IntoBytes, Immutable)]
pub struct Fadt {
header: SdtHeader,
firmware_control: U32,
Expand Down
6 changes: 3 additions & 3 deletions src/acpi-tables/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ pub use madt::Madt;
pub use rsdp::Rsdp;
pub use xsdt::Xsdt;
use zerocopy::little_endian::{U32, U64};
use zerocopy::AsBytes;
use zerocopy::{Immutable, IntoBytes};

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

/// ACPI type representing memory addresses
#[repr(packed)]
#[derive(AsBytes, Clone, Copy, Debug, Default)]
#[derive(IntoBytes, Immutable, Clone, Copy, Debug, Default)]
pub struct GenericAddressStructure {
pub address_space_id: u8,
pub register_bit_width: u8,
Expand Down Expand Up @@ -79,7 +79,7 @@ impl GenericAddressStructure {

/// Header included in all System Descriptor Tables
#[repr(packed)]
#[derive(Clone, Debug, Copy, Default, AsBytes)]
#[derive(Clone, Debug, Copy, Default, IntoBytes, Immutable)]
pub struct SdtHeader {
pub signature: [u8; 4],
pub length: U32,
Expand Down
8 changes: 4 additions & 4 deletions src/acpi-tables/src/madt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ use std::mem::size_of;

use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
use zerocopy::little_endian::U32;
use zerocopy::AsBytes;
use zerocopy::{Immutable, IntoBytes};

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

Expand All @@ -18,7 +18,7 @@ const MADT_CPU_ENABLE_FLAG: u32 = 0;
// everything with an underscore prefix
#[allow(dead_code)]
#[repr(packed)]
#[derive(Copy, Clone, Debug, Default, AsBytes)]
#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)]
pub struct LocalAPIC {
r#type: u8,
length: u8,
Expand All @@ -44,7 +44,7 @@ impl LocalAPIC {
// everything with an underscore prefix
#[allow(dead_code)]
#[repr(packed)]
#[derive(Copy, Clone, Debug, Default, AsBytes)]
#[derive(Copy, Clone, Debug, Default, IntoBytes, Immutable)]
pub struct IoAPIC {
r#type: u8,
length: u8,
Expand Down Expand Up @@ -72,7 +72,7 @@ impl IoAPIC {
// everything with an underscore prefix
#[allow(dead_code)]
#[repr(packed)]
#[derive(Debug, AsBytes)]
#[derive(Debug, IntoBytes, Immutable)]
struct MadtHeader {
sdt: SdtHeader,
base_address: U32,
Expand Down
4 changes: 2 additions & 2 deletions src/acpi-tables/src/rsdp.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

use vm_memory::{Bytes, GuestAddress, GuestMemory};
use zerocopy::little_endian::{U32, U64};
use zerocopy::AsBytes;
use zerocopy::{Immutable, IntoBytes};

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

Expand All @@ -22,7 +22,7 @@ use crate::{checksum, Result, Sdt};
/// More information about this structure can be found in the ACPI specification:
/// https://uefi.org/specs/ACPI/6.5/05_ACPI_Software_Programming_Model.html#root-system-description-pointer-rsdp
#[repr(packed)]
#[derive(Clone, Copy, Debug, Default, AsBytes)]
#[derive(Clone, Copy, Debug, Default, IntoBytes, Immutable)]
pub struct Rsdp {
signature: [u8; 8],
checksum: u8,
Expand Down
2 changes: 1 addition & 1 deletion src/acpi-tables/src/xsdt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
use std::mem::size_of;

use vm_memory::{Address, Bytes, GuestAddress, GuestMemory};
use zerocopy::AsBytes;
use zerocopy::IntoBytes;

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

Expand Down
2 changes: 1 addition & 1 deletion src/vmm/src/acpi/x86_64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use acpi_tables::fadt::{
use acpi_tables::madt::{IoAPIC, LocalAPIC};
use acpi_tables::Fadt;
use vm_memory::GuestAddress;
use zerocopy::AsBytes;
use zerocopy::IntoBytes;

use crate::arch::x86_64::layout;
use crate::device_manager::legacy::PortIODeviceManager;
Expand Down

0 comments on commit 6d2bf72

Please sign in to comment.