rust: Upgrade zerocopy dependency to 0.8.X

This enables some const constructors, Dataful Enums,
Dynamically Sized Types and much more.

v0.8 introduces breaking changes including, but not limited to:
  - Rename AsBytes to IntoBytes
  - Fine-grain (derive) Traits that need to be implemented on top.
  - Rename FromZeroes to FromZeros
for which this patch takes care of as well.

Also a direct FromZeros derive is no longer necessary. As it is touched
anyways, remove it where appropriate.

See: https://github.com/google/zerocopy/discussions/1680

Signed-off-by: Steffen Eiden <seiden@linux.ibm.com>
Signed-off-by: Jan Höppner <hoeppner@linux.ibm.com>
This commit is contained in:
Steffen Eiden
2025-04-28 10:04:03 +02:00
committed by Jan Höppner
parent f7bba3a687
commit 8929d21948
24 changed files with 182 additions and 109 deletions
+2 -3
View File
@@ -9,7 +9,6 @@ use std::ops::Index;
use std::result::Result;
use zerocopy::FromBytes;
use zerocopy::FromZeroes;
use crate::msa::InstructionKind;
use crate::msa::QueryAuthInfo;
@@ -33,7 +32,7 @@ pub const QAI_PARAM_SIZE_IN_BYTES: usize = 256;
/// Query authentication information format identifier
const FORMAT_0: u8 = 0;
#[derive(FromBytes, FromZeroes)]
#[derive(FromBytes)]
#[repr(C)]
struct QaiFmt0 {
res00: [u8; 6],
@@ -175,7 +174,7 @@ pub fn check_sysfs() -> bool {
/// -----------------------------------------------------------------
fn parse_qai_format_0(qai: &mut QueryAuthInfo, param: &[u8]) {
// parse param to temporary struct to ease further conversion
let tmp = QaiFmt0::read_from_prefix(param).expect("programming error");
let (tmp, _) = QaiFmt0::read_from_prefix(param).expect("programming error");
// parse from temporary struct
qai.hash_len = tmp.hash_length;