From 499fefd9725fc2d598240fd98cf152d694017bc4 Mon Sep 17 00:00:00 2001 From: Alex Lyn Date: Tue, 19 May 2026 16:52:05 +0800 Subject: [PATCH] kata-types: Extend DmVerityInfo with salt, hash_type, no_superblock fields Add fields to DmVerityInfo needed for dm-verity device creation: (1) salt: Optional salt value for the hash computation (2) hash_type: dm-verity version (3) no_superblock: whether to skip the superblock at hash offset Uses serde defaults for backward compatibility with existing serialized data that lacks these fields. Signed-off-by: Alex Lyn --- src/libs/kata-types/src/mount.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/libs/kata-types/src/mount.rs b/src/libs/kata-types/src/mount.rs index 6ca1d1ccb4..b62774ff81 100644 --- a/src/libs/kata-types/src/mount.rs +++ b/src/libs/kata-types/src/mount.rs @@ -193,6 +193,27 @@ pub struct DmVerityInfo { pub hashsize: u64, /// Offset of hash area/superblock on hash_device. pub offset: u64, + /// Salt value for dm-verity (256-bit hex string, optional). + #[serde(default, skip_serializing_if = "Option::is_none")] + pub salt: Option, + /// Hash type for dm-verity (0 or 1). + /// Type 0: original format without padding + /// Type 1: current format with padding + #[serde(default = "default_hash_type")] + pub hash_type: u32, + /// Whether to skip superblock at hash offset. + /// true: no superblock, hash tree starts at offset + /// false: superblock exists at offset, hash tree after superblock + #[serde(default = "default_no_superblock")] + pub no_superblock: bool, +} + +fn default_hash_type() -> u32 { + 1 +} + +fn default_no_superblock() -> bool { + false } /// Information about directly assigned volume.