backup: use new proxmox::tools::io traits
This replaces all `write_value` calls with `write_le_value` calls! Signed-off-by: Wolfgang Bumiller <w.bumiller@proxmox.com>
This commit is contained in:
parent
dc9775d1b0
commit
5485b579a1
@ -1,8 +1,7 @@
|
||||
use failure::*;
|
||||
use std::convert::TryInto;
|
||||
|
||||
use proxmox::tools::io::ops::ReadExtOps;
|
||||
use crate::tools::write::WriteUtilOps;
|
||||
use proxmox::tools::io::{ReadExt, WriteExt};
|
||||
|
||||
use super::*;
|
||||
|
||||
@ -96,7 +95,9 @@ impl DataBlob {
|
||||
iv: [0u8; 16],
|
||||
tag: [0u8; 16],
|
||||
};
|
||||
raw_data.write_value(&dummy_head)?;
|
||||
unsafe {
|
||||
raw_data.write_le_value(dummy_head)?;
|
||||
}
|
||||
|
||||
let (iv, tag) = config.encrypt_to(data, &mut raw_data)?;
|
||||
|
||||
@ -104,7 +105,9 @@ impl DataBlob {
|
||||
head: DataBlobHeader { magic, crc: [0; 4] }, iv, tag,
|
||||
};
|
||||
|
||||
(&mut raw_data[0..header_len]).write_value(&head)?;
|
||||
unsafe {
|
||||
(&mut raw_data[0..header_len]).write_le_value(head)?;
|
||||
}
|
||||
|
||||
return Ok(DataBlob { raw_data });
|
||||
} else {
|
||||
@ -117,7 +120,9 @@ impl DataBlob {
|
||||
magic: COMPRESSED_BLOB_MAGIC_1_0,
|
||||
crc: [0; 4],
|
||||
};
|
||||
comp_data.write_value(&head)?;
|
||||
unsafe {
|
||||
comp_data.write_le_value(head)?;
|
||||
}
|
||||
|
||||
zstd::stream::copy_encode(data, &mut comp_data, 1)?;
|
||||
|
||||
@ -132,7 +137,9 @@ impl DataBlob {
|
||||
magic: UNCOMPRESSED_BLOB_MAGIC_1_0,
|
||||
crc: [0; 4],
|
||||
};
|
||||
raw_data.write_value(&head)?;
|
||||
unsafe {
|
||||
raw_data.write_le_value(head)?;
|
||||
}
|
||||
raw_data.extend_from_slice(data);
|
||||
|
||||
return Ok(DataBlob { raw_data });
|
||||
|
@ -1,7 +1,6 @@
|
||||
use failure::*;
|
||||
use std::convert::TryInto;
|
||||
use proxmox::tools::io::ops::ReadExtOps;
|
||||
use crate::tools::write::WriteUtilOps;
|
||||
use proxmox::tools::io::{ReadExt, WriteExt};
|
||||
|
||||
use super::*;
|
||||
|
||||
@ -100,7 +99,9 @@ impl DataChunk {
|
||||
iv: [0u8; 16],
|
||||
tag: [0u8; 16],
|
||||
};
|
||||
raw_data.write_value(&dummy_head)?;
|
||||
unsafe {
|
||||
raw_data.write_le_value(dummy_head)?;
|
||||
}
|
||||
|
||||
let (iv, tag) = config.encrypt_to(data, &mut raw_data)?;
|
||||
|
||||
@ -108,7 +109,9 @@ impl DataChunk {
|
||||
head: DataChunkHeader { magic, crc: [0; 4] }, iv, tag,
|
||||
};
|
||||
|
||||
(&mut raw_data[0..header_len]).write_value(&head)?;
|
||||
unsafe {
|
||||
(&mut raw_data[0..header_len]).write_le_value(head)?;
|
||||
}
|
||||
|
||||
return Ok(DataChunk { digest, raw_data });
|
||||
} else {
|
||||
@ -121,7 +124,9 @@ impl DataChunk {
|
||||
magic: COMPRESSED_CHUNK_MAGIC_1_0,
|
||||
crc: [0; 4],
|
||||
};
|
||||
comp_data.write_value(&head)?;
|
||||
unsafe {
|
||||
comp_data.write_le_value(head)?;
|
||||
}
|
||||
|
||||
zstd::stream::copy_encode(data, &mut comp_data, 1)?;
|
||||
|
||||
@ -137,7 +142,9 @@ impl DataChunk {
|
||||
magic: UNCOMPRESSED_CHUNK_MAGIC_1_0,
|
||||
crc: [0; 4],
|
||||
};
|
||||
raw_data.write_value(&head)?;
|
||||
unsafe {
|
||||
raw_data.write_le_value(head)?;
|
||||
}
|
||||
raw_data.extend_from_slice(data);
|
||||
|
||||
let chunk = DataChunk { digest, raw_data };
|
||||
|
Loading…
Reference in New Issue
Block a user