switch from `data_model::DataInit` to `zerocopy`
No behavior change intended.
The `DataInit` trait has been deleted in favor of the `zerocopy` crate,
which doesn't require any unsafe code to use.
Bug: 269356487
Test: m
Change-Id: Ie1ee815ca1beb06b336cb060a651b75c3b02e1c0
diff --git a/libs/devicemapper/src/crypt.rs b/libs/devicemapper/src/crypt.rs
index 8281b34..36c45c7 100644
--- a/libs/devicemapper/src/crypt.rs
+++ b/libs/devicemapper/src/crypt.rs
@@ -20,10 +20,10 @@
use crate::DmTargetSpec;
use anyhow::{ensure, Context, Result};
-use data_model::DataInit;
use std::io::Write;
use std::mem::size_of;
use std::path::Path;
+use zerocopy::AsBytes;
const SECTOR_SIZE: u64 = 512;
@@ -174,7 +174,7 @@
header.next = aligned_size as u32;
let mut buf = Vec::with_capacity(aligned_size);
- buf.write_all(header.as_slice())?;
+ buf.write_all(header.as_bytes())?;
buf.write_all(body.as_bytes())?;
buf.write_all(vec![0; padding].as_slice())?;