From 2df285effd10d942d5376451d8c7ba59b0b2b646 Mon Sep 17 00:00:00 2001 From: Wei Liu Date: Tue, 24 Dec 2024 21:30:47 +0000 Subject: [PATCH] block: vhdx: use calculate_checksum in Header::update_header It doesn't make sense to open code the same calculation when there is already a helper function. Signed-off-by: Wei Liu --- block/src/vhdx/vhdx_header.rs | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/block/src/vhdx/vhdx_header.rs b/block/src/vhdx/vhdx_header.rs index efbab3390..edb1c652a 100644 --- a/block/src/vhdx/vhdx_header.rs +++ b/block/src/vhdx/vhdx_header.rs @@ -192,9 +192,7 @@ impl Header { }; new_header.get_header_as_buffer(&mut buffer); - let mut crc = crc_any::CRC::crc32c(); - crc.digest(&buffer); - new_header.checksum = crc.get_crc() as u32; + new_header.checksum = calculate_checksum(&mut buffer, size_of::()); new_header.get_header_as_buffer(&mut buffer); f.seek(SeekFrom::Start(start))