From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by lists.proxmox.com (Postfix) with ESMTPS id 2A6E874890 for ; Wed, 2 Jun 2021 12:15:19 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 1DF829C5A for ; Wed, 2 Jun 2021 12:14:49 +0200 (CEST) Received: from proxmox-new.maurer-it.com (proxmox-new.maurer-it.com [94.136.29.106]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by firstgate.proxmox.com (Proxmox) with ESMTPS id 6C0709C4E for ; Wed, 2 Jun 2021 12:14:48 +0200 (CEST) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 450DE466BE for ; Wed, 2 Jun 2021 12:14:48 +0200 (CEST) From: =?UTF-8?q?Fabian=20Gr=C3=BCnbichler?= To: pbs-devel@lists.proxmox.com Date: Wed, 2 Jun 2021 12:14:37 +0200 Message-Id: <20210602101438.1145922-2-f.gruenbichler@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210602101438.1145922-1-f.gruenbichler@proxmox.com> References: <20210602101438.1145922-1-f.gruenbichler@proxmox.com> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.236 Adjusted score from AWL reputation of From: address KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment KAM_NUMSUBJECT 0.5 Subject ends in numbers excluding current years SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record Subject: [pbs-devel] [PATCH bullseye proxmox-backup 1/2] update to zstd 0.6 X-BeenThere: pbs-devel@lists.proxmox.com X-Mailman-Version: 2.1.29 Precedence: list List-Id: Proxmox Backup Server development discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Jun 2021 10:15:19 -0000 compatible with libzstd from bullseye. Signed-off-by: Fabian Grünbichler --- d/control is autogenerated, so if conflicts arise there just ignore that hunk.. Cargo.toml | 2 +- debian/control | 4 ++-- src/backup/data_blob_reader.rs | 16 ++++++++-------- src/backup/data_blob_writer.rs | 14 +++++++------- src/client/backup_reader.rs | 2 +- 5 files changed, 19 insertions(+), 19 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 93681698..976f18bc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -78,7 +78,7 @@ url = "2.1" walkdir = "2" webauthn-rs = "0.2.5" xdg = "2.2" -zstd = { version = "0.4", features = [ "bindgen" ] } +zstd = { version = "0.6", features = [ "bindgen" ] } nom = "5.1" crossbeam-channel = "0.5" diff --git a/debian/control b/debian/control index 5bf595b4..baa2d13f 100644 --- a/debian/control +++ b/debian/control @@ -81,8 +81,8 @@ Build-Depends: debhelper (>= 11), librust-walkdir-2+default-dev, librust-webauthn-rs-0.2+default-dev (>= 0.2.5-~~), librust-xdg-2+default-dev (>= 2.2-~~), - librust-zstd-0.4+bindgen-dev, - librust-zstd-0.4+default-dev, + librust-zstd-0.6+bindgen-dev, + librust-zstd-0.6+default-dev, libacl1-dev, libfuse3-dev, libsystemd-dev, diff --git a/src/backup/data_blob_reader.rs b/src/backup/data_blob_reader.rs index fe3a35c4..11a4613e 100644 --- a/src/backup/data_blob_reader.rs +++ b/src/backup/data_blob_reader.rs @@ -5,23 +5,23 @@ use proxmox::tools::io::ReadExt; use super::*; -enum BlobReaderState { +enum BlobReaderState<'reader, R: Read> { Uncompressed { expected_crc: u32, csum_reader: ChecksumReader }, - Compressed { expected_crc: u32, decompr: zstd::stream::read::Decoder>> }, + Compressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<'reader, BufReader>> }, Encrypted { expected_crc: u32, decrypt_reader: CryptReader>> }, - EncryptedCompressed { expected_crc: u32, decompr: zstd::stream::read::Decoder>>>> }, + EncryptedCompressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<'reader, BufReader>>>> }, } /// Read data blobs -pub struct DataBlobReader { - state: BlobReaderState, +pub struct DataBlobReader<'reader, R: Read> { + state: BlobReaderState<'reader, R>, } // zstd_safe::DCtx is not sync but we are, since // the only public interface is on mutable reference -unsafe impl Sync for DataBlobReader {} +unsafe impl Sync for DataBlobReader<'_, R> {} -impl DataBlobReader { +impl DataBlobReader<'_, R> { pub fn new(mut reader: R, config: Option>) -> Result { @@ -104,7 +104,7 @@ impl DataBlobReader { } } -impl Read for DataBlobReader { +impl Read for DataBlobReader<'_, R> { fn read(&mut self, buf: &mut [u8]) -> Result { match &mut self.state { diff --git a/src/backup/data_blob_writer.rs b/src/backup/data_blob_writer.rs index 10b2813a..82bd14c6 100644 --- a/src/backup/data_blob_writer.rs +++ b/src/backup/data_blob_writer.rs @@ -5,19 +5,19 @@ use proxmox::tools::io::WriteExt; use super::*; -enum BlobWriterState { +enum BlobWriterState<'writer, W: Write> { Uncompressed { csum_writer: ChecksumWriter }, - Compressed { compr: zstd::stream::write::Encoder> }, + Compressed { compr: zstd::stream::write::Encoder<'writer, ChecksumWriter> }, Encrypted { crypt_writer: CryptWriter> }, - EncryptedCompressed { compr: zstd::stream::write::Encoder>> }, + EncryptedCompressed { compr: zstd::stream::write::Encoder<'writer, CryptWriter>> }, } /// Data blob writer -pub struct DataBlobWriter { - state: BlobWriterState, +pub struct DataBlobWriter<'writer, W: Write> { + state: BlobWriterState<'writer, W>, } -impl DataBlobWriter { +impl DataBlobWriter<'_, W> { pub fn new_uncompressed(mut writer: W) -> Result { writer.seek(SeekFrom::Start(0))?; @@ -133,7 +133,7 @@ impl DataBlobWriter { } } -impl Write for DataBlobWriter { +impl Write for DataBlobWriter<'_, W> { fn write(&mut self, buf: &[u8]) -> Result { match self.state { diff --git a/src/client/backup_reader.rs b/src/client/backup_reader.rs index 92200f9e..7f24cb9b 100644 --- a/src/client/backup_reader.rs +++ b/src/client/backup_reader.rs @@ -148,7 +148,7 @@ impl BackupReader { &self, manifest: &BackupManifest, name: &str, - ) -> Result, Error> { + ) -> Result, Error> { let mut tmpfile = std::fs::OpenOptions::new() .write(true) -- 2.30.2