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 <alex.lyn@antgroup.com>
This commit is contained in:
Alex Lyn
2026-05-19 16:52:05 +08:00
parent 79cf2aed66
commit 499fefd972

View File

@@ -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<String>,
/// 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.