mirror of
https://github.com/cloud-hypervisor/cloud-hypervisor.git
synced 2025-01-21 20:15:21 +00:00
block: Replace use of crc32c crate with crc-any
According to crates.io the crc-any crate is actively maintained which avoids issues with the crc32c crate and the nightly compiler. Fixes: #6168 Signed-off-by: Rob Bradford <rbradford@rivosinc.com>
This commit is contained in:
parent
9b84c6c3f5
commit
d516374c39
31
Cargo.lock
generated
31
Cargo.lock
generated
@ -340,7 +340,7 @@ name = "block"
|
|||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"byteorder",
|
"byteorder",
|
||||||
"crc32c",
|
"crc-any",
|
||||||
"io-uring",
|
"io-uring",
|
||||||
"libc",
|
"libc",
|
||||||
"log",
|
"log",
|
||||||
@ -493,12 +493,12 @@ dependencies = [
|
|||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "crc32c"
|
name = "crc-any"
|
||||||
version = "0.6.4"
|
version = "2.4.4"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "d8f48d60e5b4d2c53d5c2b1d8a58c849a70ae5e5509b08a48d047e3b65714a74"
|
checksum = "c01a5e1f881f6fb6099a7bdf949e946719fd4f1fefa56264890574febf0eb6d0"
|
||||||
dependencies = [
|
dependencies = [
|
||||||
"rustc_version",
|
"debug-helper",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@ -567,6 +567,12 @@ dependencies = [
|
|||||||
"syn 2.0.31",
|
"syn 2.0.31",
|
||||||
]
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "debug-helper"
|
||||||
|
version = "0.3.13"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "f578e8e2c440e7297e008bb5486a3a8a194775224bbc23729b0dbdfaeebf162e"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "derivative"
|
name = "derivative"
|
||||||
version = "2.2.0"
|
version = "2.2.0"
|
||||||
@ -1867,15 +1873,6 @@ version = "1.1.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2"
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "rustc_version"
|
|
||||||
version = "0.4.0"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "bfa0f585226d2e68097d4f95d113b15b83a82e819ab25717ec0590d9584ef366"
|
|
||||||
dependencies = [
|
|
||||||
"semver",
|
|
||||||
]
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "rustix"
|
name = "rustix"
|
||||||
version = "0.37.27"
|
version = "0.37.27"
|
||||||
@ -1924,12 +1921,6 @@ dependencies = [
|
|||||||
"libc",
|
"libc",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
|
||||||
name = "semver"
|
|
||||||
version = "1.0.21"
|
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
|
||||||
checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0"
|
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "serde"
|
name = "serde"
|
||||||
version = "1.0.193"
|
version = "1.0.193"
|
||||||
|
@ -10,7 +10,7 @@ io_uring = ["dep:io-uring"]
|
|||||||
|
|
||||||
[dependencies]
|
[dependencies]
|
||||||
byteorder = "1.4.3"
|
byteorder = "1.4.3"
|
||||||
crc32c = "0.6.4"
|
crc-any = "2.4.4"
|
||||||
io-uring = { version = "0.6.2", optional = true }
|
io-uring = { version = "0.6.2", optional = true }
|
||||||
libc = "0.2.147"
|
libc = "0.2.147"
|
||||||
log = "0.4.20"
|
log = "0.4.20"
|
||||||
|
@ -192,7 +192,9 @@ impl Header {
|
|||||||
};
|
};
|
||||||
|
|
||||||
new_header.get_header_as_buffer(&mut buffer);
|
new_header.get_header_as_buffer(&mut buffer);
|
||||||
new_header.checksum = crc32c::crc32c(&buffer);
|
let mut crc = crc_any::CRC::crc32c();
|
||||||
|
crc.digest(&buffer);
|
||||||
|
new_header.checksum = crc.get_crc() as u32;
|
||||||
new_header.get_header_as_buffer(&mut buffer);
|
new_header.get_header_as_buffer(&mut buffer);
|
||||||
|
|
||||||
f.seek(SeekFrom::Start(start))
|
f.seek(SeekFrom::Start(start))
|
||||||
@ -480,7 +482,10 @@ pub fn calculate_checksum(buffer: &mut [u8], csum_offset: usize) -> Result<u32>
|
|||||||
// Zero the checksum in the buffer
|
// Zero the checksum in the buffer
|
||||||
LittleEndian::write_u32(csum_buf, 0);
|
LittleEndian::write_u32(csum_buf, 0);
|
||||||
// Calculate the checksum on the resulting buffer
|
// Calculate the checksum on the resulting buffer
|
||||||
let new_csum = crc32c::crc32c(buffer);
|
let mut crc = crc_any::CRC::crc32c();
|
||||||
|
crc.digest(&buffer);
|
||||||
|
let new_csum = crc.get_crc() as u32;
|
||||||
|
|
||||||
// Put back the original checksum in the buffer
|
// Put back the original checksum in the buffer
|
||||||
LittleEndian::write_u32(&mut buffer[csum_offset..csum_offset + 4], orig_csum);
|
LittleEndian::write_u32(&mut buffer[csum_offset..csum_offset + 4], orig_csum);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user