Merge "Merge 24Q4 into AOSP main" into main
diff --git a/android/virtmgr/Android.bp b/android/virtmgr/Android.bp
index 3883c34..ad63995 100644
--- a/android/virtmgr/Android.bp
+++ b/android/virtmgr/Android.bp
@@ -69,7 +69,7 @@
"liblibfdt",
"libfsfdt",
"libhypervisor_props",
- "libzerocopy-0.7.35",
+ "libzerocopy",
"libuuid",
// TODO(b/202115393) stabilize the interface
"packagemanager_aidl-rust",
diff --git a/android/virtmgr/src/aidl.rs b/android/virtmgr/src/aidl.rs
index 79c7d81..15a80a6 100644
--- a/android/virtmgr/src/aidl.rs
+++ b/android/virtmgr/src/aidl.rs
@@ -653,6 +653,14 @@
let (cpus, host_cpu_topology) = match config.cpuTopology {
CpuTopology::MATCH_HOST => (None, true),
CpuTopology::ONE_CPU => (NonZeroU32::new(1), false),
+ CpuTopology::CUSTOM => (
+ NonZeroU32::new(
+ u32::try_from(config.customVcpuCount)
+ .context("bad customVcpuCount")
+ .or_binder_exception(ExceptionCode::ILLEGAL_ARGUMENT)?,
+ ),
+ false,
+ ),
val => {
return Err(anyhow!("Failed to parse CPU topology value {:?}", val))
.with_log()
@@ -1228,6 +1236,9 @@
vm_config.name.clone_from(&config.name);
vm_config.protectedVm = config.protectedVm;
vm_config.cpuTopology = config.cpuTopology;
+ if config.cpuTopology == CpuTopology::CUSTOM {
+ bail!("AppConfig doesn't support CpuTopology::CUSTOM");
+ }
vm_config.hugePages = config.hugePages || vm_payload_config.hugepages;
vm_config.boostUclamp = config.boostUclamp;
diff --git a/android/virtmgr/src/atom.rs b/android/virtmgr/src/atom.rs
index 45b020e..e0fed85 100644
--- a/android/virtmgr/src/atom.rs
+++ b/android/virtmgr/src/atom.rs
@@ -92,6 +92,26 @@
}
}
+fn get_num_vcpus(cpu_topology: CpuTopology, custom_vcpu_count: Option<i32>) -> i32 {
+ match cpu_topology {
+ CpuTopology::ONE_CPU => 1,
+ CpuTopology::MATCH_HOST => {
+ get_num_cpus().and_then(|v| v.try_into().ok()).unwrap_or_else(|| {
+ warn!("Failed to determine the number of CPUs in the host");
+ INVALID_NUM_CPUS
+ })
+ }
+ CpuTopology::CUSTOM => custom_vcpu_count.unwrap_or_else(|| {
+ warn!("AppConfig doesn't support CpuTopology::CUSTOM");
+ INVALID_NUM_CPUS
+ }),
+ _ => {
+ warn!("invalid CpuTopology: {cpu_topology:?}");
+ INVALID_NUM_CPUS
+ }
+ }
+}
+
/// Write the stats of VMCreation to statsd
/// The function creates a separate thread which waits for statsd to start to push atom
pub fn write_vm_creation_stats(
@@ -115,33 +135,24 @@
binder_exception_code = e.exception_code() as i32;
}
}
- let (vm_identifier, config_type, cpu_topology, memory_mib, apexes) = match config {
+
+ let (vm_identifier, config_type, num_cpus, memory_mib, apexes) = match config {
VirtualMachineConfig::AppConfig(config) => (
config.name.clone(),
vm_creation_requested::ConfigType::VirtualMachineAppConfig,
- config.cpuTopology,
+ get_num_vcpus(config.cpuTopology, None),
config.memoryMib,
get_apex_list(config),
),
VirtualMachineConfig::RawConfig(config) => (
config.name.clone(),
vm_creation_requested::ConfigType::VirtualMachineRawConfig,
- config.cpuTopology,
+ get_num_vcpus(config.cpuTopology, Some(config.customVcpuCount)),
config.memoryMib,
String::new(),
),
};
- let num_cpus: i32 = match cpu_topology {
- CpuTopology::MATCH_HOST => {
- get_num_cpus().and_then(|v| v.try_into().ok()).unwrap_or_else(|| {
- warn!("Failed to determine the number of CPUs in the host");
- INVALID_NUM_CPUS
- })
- }
- _ => 1,
- };
-
let atom = AtomVmCreationRequested {
uid: get_calling_uid() as i32,
vmIdentifier: vm_identifier,
diff --git a/android/virtmgr/src/composite.rs b/android/virtmgr/src/composite.rs
index 1219150..cfd65c3 100644
--- a/android/virtmgr/src/composite.rs
+++ b/android/virtmgr/src/composite.rs
@@ -22,9 +22,9 @@
use std::os::unix::fs::FileExt;
use std::os::unix::io::AsRawFd;
use std::path::{Path, PathBuf};
-use zerocopy::AsBytes;
use zerocopy::FromBytes;
-use zerocopy::FromZeroes;
+use zerocopy::FromZeros;
+use zerocopy::IntoBytes;
use uuid::Uuid;
@@ -132,7 +132,7 @@
ImageType::AndroidSparse => {
// Source: system/core/libsparse/sparse_format.h
#[repr(C)]
- #[derive(Clone, Copy, Debug, AsBytes, FromZeroes, FromBytes)]
+ #[derive(Clone, Copy, Debug, IntoBytes, FromBytes)]
struct SparseHeader {
magic: u32,
major_version: u16,
diff --git a/android/virtualizationservice/aidl/android/system/virtualizationservice/CpuTopology.aidl b/android/virtualizationservice/aidl/android/system/virtualizationservice/CpuTopology.aidl
index 8a8e3d0..31a33f4 100644
--- a/android/virtualizationservice/aidl/android/system/virtualizationservice/CpuTopology.aidl
+++ b/android/virtualizationservice/aidl/android/system/virtualizationservice/CpuTopology.aidl
@@ -22,4 +22,6 @@
ONE_CPU = 0,
/** Match physical CPU topology of the host. */
MATCH_HOST = 1,
+ /** Number of vCPUs specified in the config. */
+ CUSTOM = 2,
}
diff --git a/android/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineRawConfig.aidl b/android/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineRawConfig.aidl
index 3393546..d98fdcc 100644
--- a/android/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineRawConfig.aidl
+++ b/android/virtualizationservice/aidl/android/system/virtualizationservice/VirtualMachineRawConfig.aidl
@@ -65,6 +65,9 @@
/** The vCPU topology that will be generated for the VM. Default to 1 vCPU. */
CpuTopology cpuTopology = CpuTopology.ONE_CPU;
+ /** The number of vCPUs. Ignored unless `cpuTopology == CUSTOM`. */
+ int customVcpuCount;
+
/**
* A version or range of versions of the virtual platform that this config is compatible with.
* The format follows SemVer.
diff --git a/android/virtualizationservice/vfio_handler/Android.bp b/android/virtualizationservice/vfio_handler/Android.bp
index fec61f1..3635cf1 100644
--- a/android/virtualizationservice/vfio_handler/Android.bp
+++ b/android/virtualizationservice/vfio_handler/Android.bp
@@ -28,7 +28,7 @@
"liblog_rust",
"libnix",
"librustutils",
- "libzerocopy-0.7.35",
+ "libzerocopy",
],
apex_available: ["com.android.virt"],
}
diff --git a/android/virtualizationservice/vfio_handler/src/aidl.rs b/android/virtualizationservice/vfio_handler/src/aidl.rs
index 3b4d0c5..d6b79e2 100644
--- a/android/virtualizationservice/vfio_handler/src/aidl.rs
+++ b/android/virtualizationservice/vfio_handler/src/aidl.rs
@@ -29,7 +29,6 @@
use rustutils::system_properties;
use zerocopy::{
byteorder::{BigEndian, U32},
- FromZeroes,
FromBytes,
};
@@ -131,7 +130,7 @@
/// The structure of DT table header in dtbo.img.
/// https://source.android.com/docs/core/architecture/dto/partitions
#[repr(C)]
-#[derive(Debug, FromZeroes, FromBytes)]
+#[derive(Debug, FromBytes)]
struct DtTableHeader {
/// DT_TABLE_MAGIC
magic: U32<BigEndian>,
@@ -155,7 +154,7 @@
/// The structure of each DT table entry (v0) in dtbo.img.
/// https://source.android.com/docs/core/architecture/dto/partitions
#[repr(C)]
-#[derive(Debug, FromZeroes, FromBytes)]
+#[derive(Debug, FromBytes)]
struct DtTableEntry {
/// size of each DT
dt_size: U32<BigEndian>,
diff --git a/guest/apkdmverity/Android.bp b/guest/apkdmverity/Android.bp
index 64dde3e..3f45bb4 100644
--- a/guest/apkdmverity/Android.bp
+++ b/guest/apkdmverity/Android.bp
@@ -22,7 +22,6 @@
"libnum_traits",
"libscopeguard",
"libuuid",
- "libzerocopy-0.7.35",
],
proc_macros: ["libnum_derive"],
multilib: {
diff --git a/guest/pvmfw/Android.bp b/guest/pvmfw/Android.bp
index 23755cf..51f7802 100644
--- a/guest/pvmfw/Android.bp
+++ b/guest/pvmfw/Android.bp
@@ -32,7 +32,7 @@
"libuuid_nostd",
"libvirtio_drivers",
"libvmbase",
- "libzerocopy-0.7.35_nostd",
+ "libzerocopy_nostd",
"libzeroize_nostd",
],
}
@@ -77,7 +77,7 @@
"liblibfdt",
"liblog_rust",
"libpvmfw_fdt_template",
- "libzerocopy-0.7.35",
+ "libzerocopy",
],
data: [
":test_pvmfw_devices_vm_dtbo",
@@ -119,7 +119,7 @@
"libdiced_open_dice_nostd",
"libpvmfw_avb_nostd",
"libdiced_sample_inputs_nostd",
- "libzerocopy-0.7.35_nostd",
+ "libzerocopy_nostd",
"libhex",
],
static_libs: ["libopen_dice_clear_memory"],
diff --git a/guest/pvmfw/src/config.rs b/guest/pvmfw/src/config.rs
index 5a3d138..dbfde15 100644
--- a/guest/pvmfw/src/config.rs
+++ b/guest/pvmfw/src/config.rs
@@ -22,11 +22,14 @@
use log::{info, warn};
use static_assertions::const_assert_eq;
use vmbase::util::RangeExt;
-use zerocopy::{FromBytes, FromZeroes};
+use zerocopy::FromBytes;
+use zerocopy::Immutable;
+use zerocopy::KnownLayout;
+use zerocopy::Ref;
/// Configuration data header.
#[repr(C, packed)]
-#[derive(Clone, Copy, Debug, FromZeroes, FromBytes)]
+#[derive(Clone, Copy, Debug, FromBytes, Immutable, KnownLayout)]
struct Header {
/// Magic number; must be `Header::MAGIC`.
magic: u32,
@@ -145,14 +148,14 @@
}
#[repr(packed)]
-#[derive(Clone, Copy, Debug, FromZeroes, FromBytes)]
+#[derive(Clone, Copy, Debug, FromBytes, Immutable, KnownLayout)]
struct HeaderEntry {
offset: u32,
size: u32,
}
#[repr(C, packed)]
-#[derive(Clone, Copy, Debug, Eq, FromZeroes, FromBytes, PartialEq)]
+#[derive(Clone, Copy, Debug, Eq, FromBytes, Immutable, KnownLayout, PartialEq)]
pub struct Version {
minor: u16,
major: u16,
@@ -209,8 +212,8 @@
}
let (header, rest) =
- zerocopy::Ref::<_, Header>::new_from_prefix(bytes).ok_or(Error::HeaderMisaligned)?;
- let header = header.into_ref();
+ Ref::<_, Header>::new_from_prefix(bytes).ok_or(Error::HeaderMisaligned)?;
+ let header = Ref::into_ref(header);
if header.magic != Header::MAGIC {
return Err(Error::InvalidMagic);
diff --git a/guest/pvmfw/src/dice.rs b/guest/pvmfw/src/dice.rs
index 6694881..a72c1fc 100644
--- a/guest/pvmfw/src/dice.rs
+++ b/guest/pvmfw/src/dice.rs
@@ -24,7 +24,9 @@
bcc_handover_main_flow, hash, Config, DiceContext, DiceMode, Hash, InputValues, HIDDEN_SIZE,
};
use pvmfw_avb::{Capability, DebugLevel, Digest, VerifiedBootData};
-use zerocopy::AsBytes;
+use zerocopy::Immutable;
+use zerocopy::IntoBytes;
+use zerocopy::KnownLayout;
// pVM firmware (like other VM components) is expected to populate some fields in DICE
// Configuration Descriptor. See dice_for_avf_guest.cddl
@@ -134,7 +136,7 @@
// descriptor do not).
// Since the hidden input has to be a fixed size, create it as a hash of the values we
// want included.
- #[derive(AsBytes)]
+ #[derive(Immutable, IntoBytes, KnownLayout)]
#[repr(C, packed)]
struct HiddenInput {
rkp_vm_marker: bool,
diff --git a/guest/pvmfw/src/fdt.rs b/guest/pvmfw/src/fdt.rs
index bfbd2e6..4370675 100644
--- a/guest/pvmfw/src/fdt.rs
+++ b/guest/pvmfw/src/fdt.rs
@@ -50,7 +50,7 @@
use vmbase::layout::{crosvm::MEM_START, MAX_VIRT_ADDR};
use vmbase::memory::SIZE_4KB;
use vmbase::util::RangeExt as _;
-use zerocopy::AsBytes as _;
+use zerocopy::IntoBytes as _;
// SAFETY: The template DT is automatically generated through DTC, which should produce valid DTBs.
const FDT_TEMPLATE: &Fdt = unsafe { Fdt::unchecked_from_slice(pvmfw_fdt_template::RAW) };
diff --git a/guest/pvmfw/src/gpt.rs b/guest/pvmfw/src/gpt.rs
index 71eb569..70b3cf8 100644
--- a/guest/pvmfw/src/gpt.rs
+++ b/guest/pvmfw/src/gpt.rs
@@ -26,7 +26,6 @@
use vmbase::util::ceiling_div;
use vmbase::virtio::{pci, HalImpl};
use zerocopy::FromBytes;
-use zerocopy::FromZeroes;
type VirtIOBlk = pci::VirtIOBlk<HalImpl>;
@@ -105,7 +104,7 @@
fn new(mut device: VirtIOBlk) -> Result<Self> {
let mut blk = [0; Self::LBA_SIZE];
device.read_blocks(Header::LBA, &mut blk).map_err(Error::FailedRead)?;
- let header = Header::read_from_prefix(blk.as_slice()).unwrap();
+ let header = Header::read_from_prefix(blk.as_slice()).unwrap().0;
if !header.is_valid() {
return Err(Error::InvalidHeader);
}
@@ -157,7 +156,7 @@
type Lba = u64;
/// Structure as defined in release 2.10 of the UEFI Specification (5.3.2 GPT Header).
-#[derive(FromZeroes, FromBytes)]
+#[derive(FromBytes)]
#[repr(C, packed)]
struct Header {
signature: u64,
diff --git a/guest/pvmfw/src/instance.rs b/guest/pvmfw/src/instance.rs
index 0ef57dc..bb07f74 100644
--- a/guest/pvmfw/src/instance.rs
+++ b/guest/pvmfw/src/instance.rs
@@ -30,9 +30,10 @@
use vmbase::util::ceiling_div;
use vmbase::virtio::pci::{PciTransportIterator, VirtIOBlk};
use vmbase::virtio::HalImpl;
-use zerocopy::AsBytes;
use zerocopy::FromBytes;
-use zerocopy::FromZeroes;
+use zerocopy::Immutable;
+use zerocopy::IntoBytes;
+use zerocopy::KnownLayout;
pub enum Error {
/// Unexpected I/O error while accessing the underlying disk.
@@ -154,7 +155,7 @@
Ok(())
}
-#[derive(FromZeroes, FromBytes)]
+#[derive(Clone, Debug, FromBytes, Immutable, KnownLayout)]
#[repr(C, packed)]
struct Header {
magic: [u8; Header::MAGIC.len()],
@@ -208,7 +209,7 @@
let header_index = indices.next().ok_or(Error::MissingInstanceImageHeader)?;
partition.read_block(header_index, &mut blk).map_err(Error::FailedIo)?;
// The instance.img header is only used for discovery/validation.
- let header = Header::read_from_prefix(blk.as_slice()).unwrap();
+ let header = Header::read_from_prefix(blk.as_slice()).unwrap().0;
if !header.is_valid() {
return Err(Error::InvalidInstanceImageHeader);
}
@@ -216,7 +217,7 @@
while let Some(header_index) = indices.next() {
partition.read_block(header_index, &mut blk).map_err(Error::FailedIo)?;
- let header = EntryHeader::read_from_prefix(blk.as_slice()).unwrap();
+ let header = EntryHeader::read_from_prefix(blk.as_slice()).unwrap().0;
match (header.uuid(), header.payload_size()) {
(uuid, _) if uuid.is_nil() => return Ok(PvmfwEntry::New { header_index }),
(PvmfwEntry::UUID, payload_size) => {
@@ -238,7 +239,7 @@
/// Marks the start of an instance.img entry.
///
/// Note: Virtualization/guest/microdroid_manager/src/instance.rs uses the name "partition".
-#[derive(AsBytes, FromZeroes, FromBytes)]
+#[derive(Clone, Debug, FromBytes, Immutable, IntoBytes, KnownLayout)]
#[repr(C, packed)]
struct EntryHeader {
uuid: u128,
@@ -259,7 +260,7 @@
}
}
-#[derive(AsBytes, FromZeroes, FromBytes)]
+#[derive(Clone, Debug, FromBytes, Immutable, IntoBytes, KnownLayout)]
#[repr(C)]
pub(crate) struct EntryBody {
pub code_hash: Hash,
diff --git a/libs/devicemapper/Android.bp b/libs/devicemapper/Android.bp
index 17727f1..5332469 100644
--- a/libs/devicemapper/Android.bp
+++ b/libs/devicemapper/Android.bp
@@ -16,7 +16,7 @@
"libhex",
"libnix",
"libuuid",
- "libzerocopy-0.7.35",
+ "libzerocopy",
],
multilib: {
lib32: {
diff --git a/libs/devicemapper/src/crypt.rs b/libs/devicemapper/src/crypt.rs
index 3afd374..75417ed 100644
--- a/libs/devicemapper/src/crypt.rs
+++ b/libs/devicemapper/src/crypt.rs
@@ -23,7 +23,7 @@
use std::io::Write;
use std::mem::size_of;
use std::path::Path;
-use zerocopy::AsBytes;
+use zerocopy::IntoBytes;
const SECTOR_SIZE: u64 = 512;
diff --git a/libs/devicemapper/src/lib.rs b/libs/devicemapper/src/lib.rs
index 5656743..a8f3049 100644
--- a/libs/devicemapper/src/lib.rs
+++ b/libs/devicemapper/src/lib.rs
@@ -37,8 +37,9 @@
use std::mem::size_of;
use std::os::unix::io::AsRawFd;
use std::path::{Path, PathBuf};
-use zerocopy::AsBytes;
-use zerocopy::FromZeroes;
+use zerocopy::FromZeros;
+use zerocopy::Immutable;
+use zerocopy::IntoBytes;
/// Exposes DmCryptTarget & related builder
pub mod crypt;
@@ -88,7 +89,7 @@
// `DmTargetSpec` is the header of the data structure for a device-mapper target. When doing the
// ioctl, one of more `DmTargetSpec` (and its body) are appened to the `DmIoctl` struct.
#[repr(C)]
-#[derive(Copy, Clone, AsBytes, FromZeroes)]
+#[derive(Copy, Clone, Immutable, IntoBytes, FromZeros)]
struct DmTargetSpec {
sector_start: u64,
length: u64, // number of 512 sectors
diff --git a/libs/devicemapper/src/loopdevice.rs b/libs/devicemapper/src/loopdevice.rs
index 9dc722b..113a946 100644
--- a/libs/devicemapper/src/loopdevice.rs
+++ b/libs/devicemapper/src/loopdevice.rs
@@ -32,7 +32,7 @@
use std::path::{Path, PathBuf};
use std::thread;
use std::time::{Duration, Instant};
-use zerocopy::FromZeroes;
+use zerocopy::FromZeros;
use crate::loopdevice::sys::*;
@@ -184,7 +184,7 @@
let a_file = a_dir.path().join("test");
let a_size = 4096u64;
create_empty_file(&a_file, a_size);
- let dev = attach(a_file, 0, a_size, /*direct_io*/ true, /*writable*/ false).unwrap();
+ let dev = attach(a_file, 0, a_size, /* direct_io */ true, /* writable */ false).unwrap();
scopeguard::defer! {
detach(&dev).unwrap();
}
@@ -197,7 +197,7 @@
let a_file = a_dir.path().join("test");
let a_size = 4096u64;
create_empty_file(&a_file, a_size);
- let dev = attach(a_file, 0, a_size, /*direct_io*/ false, /*writable*/ false).unwrap();
+ let dev = attach(a_file, 0, a_size, /* direct_io */ false, /* writable */ false).unwrap();
scopeguard::defer! {
detach(&dev).unwrap();
}
@@ -210,7 +210,7 @@
let a_file = a_dir.path().join("test");
let a_size = 4096u64;
create_empty_file(&a_file, a_size);
- let dev = attach(a_file, 0, a_size, /*direct_io*/ true, /*writable*/ true).unwrap();
+ let dev = attach(a_file, 0, a_size, /* direct_io */ true, /* writable */ true).unwrap();
scopeguard::defer! {
detach(&dev).unwrap();
}
diff --git a/libs/devicemapper/src/loopdevice/sys.rs b/libs/devicemapper/src/loopdevice/sys.rs
index ce4ef61..47d2c08 100644
--- a/libs/devicemapper/src/loopdevice/sys.rs
+++ b/libs/devicemapper/src/loopdevice/sys.rs
@@ -15,7 +15,7 @@
*/
use bitflags::bitflags;
-use zerocopy::FromZeroes;
+use zerocopy::FromZeros;
// This UAPI is copied and converted from include/uapi/linux/loop.h Note that this module doesn't
// implement all the features introduced in loop(4). Only the features that are required to support
@@ -28,7 +28,7 @@
pub const LOOP_CLR_FD: libc::c_ulong = 0x4C01;
#[repr(C)]
-#[derive(Copy, Clone, FromZeroes)]
+#[derive(Copy, Clone, FromZeros)]
pub struct loop_config {
pub fd: u32,
pub block_size: u32,
@@ -37,7 +37,7 @@
}
#[repr(C)]
-#[derive(Copy, Clone, FromZeroes)]
+#[derive(Copy, Clone, FromZeros)]
pub struct loop_info64 {
pub lo_device: u64,
pub lo_inode: u64,
@@ -55,7 +55,7 @@
}
#[repr(transparent)]
-#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, FromZeroes)]
+#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, FromZeros)]
pub struct Flag(u32);
bitflags! {
diff --git a/libs/devicemapper/src/sys.rs b/libs/devicemapper/src/sys.rs
index bd1e165..bbf7e45 100644
--- a/libs/devicemapper/src/sys.rs
+++ b/libs/devicemapper/src/sys.rs
@@ -15,8 +15,9 @@
*/
use bitflags::bitflags;
-use zerocopy::AsBytes;
-use zerocopy::FromZeroes;
+use zerocopy::FromZeros;
+use zerocopy::Immutable;
+use zerocopy::IntoBytes;
// UAPI for device mapper can be found at include/uapi/linux/dm-ioctl.h
@@ -45,7 +46,7 @@
}
#[repr(C)]
-#[derive(Copy, Clone, AsBytes, FromZeroes)]
+#[derive(Copy, Clone, Immutable, IntoBytes, FromZeros)]
pub struct DmIoctl {
pub version: [u32; 3],
pub data_size: u32,
@@ -70,7 +71,9 @@
pub const DM_MAX_TYPE_NAME: usize = 16;
#[repr(transparent)]
-#[derive(Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, AsBytes, FromZeroes)]
+#[derive(
+ Copy, Clone, Debug, Eq, Hash, Ord, PartialEq, PartialOrd, Immutable, IntoBytes, FromZeros,
+)]
pub struct Flag(u32);
bitflags! {
diff --git a/libs/devicemapper/src/verity.rs b/libs/devicemapper/src/verity.rs
index eb342a8..09087da 100644
--- a/libs/devicemapper/src/verity.rs
+++ b/libs/devicemapper/src/verity.rs
@@ -22,7 +22,7 @@
use std::io::Write;
use std::mem::size_of;
use std::path::Path;
-use zerocopy::AsBytes;
+use zerocopy::IntoBytes;
use crate::DmTargetSpec;
diff --git a/libs/libfdt/Android.bp b/libs/libfdt/Android.bp
index 1e24ff4..09f288d 100644
--- a/libs/libfdt/Android.bp
+++ b/libs/libfdt/Android.bp
@@ -38,7 +38,7 @@
"libcstr",
"liblibfdt_bindgen",
"libstatic_assertions",
- "libzerocopy-0.7.35_nostd",
+ "libzerocopy_nostd",
],
}
diff --git a/libs/libfdt/src/lib.rs b/libs/libfdt/src/lib.rs
index 5883567..c969749 100644
--- a/libs/libfdt/src/lib.rs
+++ b/libs/libfdt/src/lib.rs
@@ -33,7 +33,7 @@
use core::ops::Range;
use cstr::cstr;
use libfdt::get_slice_at_ptr;
-use zerocopy::AsBytes as _;
+use zerocopy::IntoBytes as _;
use crate::libfdt::{Libfdt, LibfdtMut};
diff --git a/libs/libfdt/src/safe_types.rs b/libs/libfdt/src/safe_types.rs
index 03b5bc2..0e79a42 100644
--- a/libs/libfdt/src/safe_types.rs
+++ b/libs/libfdt/src/safe_types.rs
@@ -21,7 +21,7 @@
use crate::{FdtError, Result};
use zerocopy::byteorder::big_endian;
-use zerocopy::{FromBytes, FromZeroes};
+use zerocopy::FromBytes;
macro_rules! assert_offset_eq {
// TODO(const_feature(assert_eq)): assert_eq!()
@@ -32,7 +32,7 @@
/// Thin wrapper around `libfdt_bindgen::fdt_header` for transparent endianness handling.
#[repr(C)]
-#[derive(Debug, FromZeroes, FromBytes)]
+#[derive(Debug, FromBytes)]
pub struct FdtHeader {
/// magic word FDT_MAGIC
pub magic: big_endian::U32,
diff --git a/libs/libvmbase/Android.bp b/libs/libvmbase/Android.bp
index 7bcdc1d..3088633 100644
--- a/libs/libvmbase/Android.bp
+++ b/libs/libvmbase/Android.bp
@@ -91,7 +91,7 @@
"libtinyvec_nostd",
"libuuid_nostd",
"libvirtio_drivers",
- "libzerocopy-0.7.35_nostd",
+ "libzerocopy_nostd",
"libzeroize_nostd",
],
whole_static_libs: [
diff --git a/libs/libvmbase/src/rand.rs b/libs/libvmbase/src/rand.rs
index b31bd4b..16c7b6a 100644
--- a/libs/libvmbase/src/rand.rs
+++ b/libs/libvmbase/src/rand.rs
@@ -18,7 +18,7 @@
use core::fmt;
use core::mem::size_of;
use smccc::{self, Hvc};
-use zerocopy::AsBytes as _;
+use zerocopy::IntoBytes as _;
type Entropy = [u8; size_of::<u64>() * 3];