From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH bullseye proxmox-backup 1/2] update to zstd 0.6
Date: Wed, 2 Jun 2021 12:14:37 +0200 [thread overview]
Message-ID: <20210602101438.1145922-2-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20210602101438.1145922-1-f.gruenbichler@proxmox.com>
compatible with libzstd from bullseye.
Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
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<R: Read> {
+enum BlobReaderState<'reader, R: Read> {
Uncompressed { expected_crc: u32, csum_reader: ChecksumReader<R> },
- Compressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<BufReader<ChecksumReader<R>>> },
+ Compressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<'reader, BufReader<ChecksumReader<R>>> },
Encrypted { expected_crc: u32, decrypt_reader: CryptReader<BufReader<ChecksumReader<R>>> },
- EncryptedCompressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<BufReader<CryptReader<BufReader<ChecksumReader<R>>>>> },
+ EncryptedCompressed { expected_crc: u32, decompr: zstd::stream::read::Decoder<'reader, BufReader<CryptReader<BufReader<ChecksumReader<R>>>>> },
}
/// Read data blobs
-pub struct DataBlobReader<R: Read> {
- state: BlobReaderState<R>,
+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<R: Read> Sync for DataBlobReader<R> {}
+unsafe impl<R: Read> Sync for DataBlobReader<'_, R> {}
-impl <R: Read> DataBlobReader<R> {
+impl <R: Read> DataBlobReader<'_, R> {
pub fn new(mut reader: R, config: Option<Arc<CryptConfig>>) -> Result<Self, Error> {
@@ -104,7 +104,7 @@ impl <R: Read> DataBlobReader<R> {
}
}
-impl <R: Read> Read for DataBlobReader<R> {
+impl <R: Read> Read for DataBlobReader<'_, R> {
fn read(&mut self, buf: &mut [u8]) -> Result<usize, std::io::Error> {
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<W: Write> {
+enum BlobWriterState<'writer, W: Write> {
Uncompressed { csum_writer: ChecksumWriter<W> },
- Compressed { compr: zstd::stream::write::Encoder<ChecksumWriter<W>> },
+ Compressed { compr: zstd::stream::write::Encoder<'writer, ChecksumWriter<W>> },
Encrypted { crypt_writer: CryptWriter<ChecksumWriter<W>> },
- EncryptedCompressed { compr: zstd::stream::write::Encoder<CryptWriter<ChecksumWriter<W>>> },
+ EncryptedCompressed { compr: zstd::stream::write::Encoder<'writer, CryptWriter<ChecksumWriter<W>>> },
}
/// Data blob writer
-pub struct DataBlobWriter<W: Write> {
- state: BlobWriterState<W>,
+pub struct DataBlobWriter<'writer, W: Write> {
+ state: BlobWriterState<'writer, W>,
}
-impl <W: Write + Seek> DataBlobWriter<W> {
+impl <W: Write + Seek> DataBlobWriter<'_, W> {
pub fn new_uncompressed(mut writer: W) -> Result<Self, Error> {
writer.seek(SeekFrom::Start(0))?;
@@ -133,7 +133,7 @@ impl <W: Write + Seek> DataBlobWriter<W> {
}
}
-impl <W: Write + Seek> Write for DataBlobWriter<W> {
+impl <W: Write + Seek> Write for DataBlobWriter<'_, W> {
fn write(&mut self, buf: &[u8]) -> Result<usize, std::io::Error> {
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<DataBlobReader<File>, Error> {
+ ) -> Result<DataBlobReader<'_, File>, Error> {
let mut tmpfile = std::fs::OpenOptions::new()
.write(true)
--
2.30.2
next prev parent reply other threads:[~2021-06-02 10:15 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-02 10:14 [pbs-devel] [PATCH proxmox-backup 0/2] bullseye compat Fabian Grünbichler
2021-06-02 10:14 ` Fabian Grünbichler [this message]
2021-06-02 10:14 ` [pbs-devel] [PATCH bullseye proxmox-backup 2/2] d/control: set R-R-R to run binary d/rules targets as root Fabian Grünbichler
2021-06-14 11:03 ` [pbs-devel] applied: [PATCH proxmox-backup 0/2] bullseye compat Dietmar Maurer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20210602101438.1145922-2-f.gruenbichler@proxmox.com \
--to=f.gruenbichler@proxmox.com \
--cc=pbs-devel@lists.proxmox.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox