all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Christian Ebner <c.ebner@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [PATCH proxmox-backup v3 1/5] datastore: data blob: refactor crypt mode method
Date: Wed, 29 Jul 2026 11:07:33 +0200	[thread overview]
Message-ID: <20260729090737.135385-2-c.ebner@proxmox.com> (raw)
In-Reply-To: <20260729090737.135385-1-c.ebner@proxmox.com>

Improve code style and readability by using a simple match statement
instead of chained if blocks.

No functional changes.

Signed-off-by: Christian Ebner <c.ebner@proxmox.com>
Reviewed-by: Robert Obkircher <r.obkircher@proxmox.com>
---
 pbs-datastore/src/data_blob.rs | 16 +++++-----------
 1 file changed, 5 insertions(+), 11 deletions(-)

diff --git a/pbs-datastore/src/data_blob.rs b/pbs-datastore/src/data_blob.rs
index 298c8f6e9..465bcb280 100644
--- a/pbs-datastore/src/data_blob.rs
+++ b/pbs-datastore/src/data_blob.rs
@@ -167,17 +167,11 @@ impl DataBlob {
 
     /// Get the encryption mode for this blob.
     pub fn crypt_mode(&self) -> Result<CryptMode, Error> {
-        let magic = self.magic();
-
-        Ok(
-            if magic == &UNCOMPRESSED_BLOB_MAGIC_1_0 || magic == &COMPRESSED_BLOB_MAGIC_1_0 {
-                CryptMode::None
-            } else if magic == &ENCR_COMPR_BLOB_MAGIC_1_0 || magic == &ENCRYPTED_BLOB_MAGIC_1_0 {
-                CryptMode::Encrypt
-            } else {
-                bail!("Invalid blob magic number.");
-            },
-        )
+        match *self.magic() {
+            UNCOMPRESSED_BLOB_MAGIC_1_0 | COMPRESSED_BLOB_MAGIC_1_0 => Ok(CryptMode::None),
+            ENCR_COMPR_BLOB_MAGIC_1_0 | ENCRYPTED_BLOB_MAGIC_1_0 => Ok(CryptMode::Encrypt),
+            _ => bail!("Invalid blob magic number."),
+        }
     }
 
     /// Decode blob data
-- 
2.47.3





  reply	other threads:[~2026-07-29  9:08 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-07-29  9:07 [PATCH proxmox-backup v3 0/5] restrict previous manifest reuse checks for push sync jobs Christian Ebner
2026-07-29  9:07 ` Christian Ebner [this message]
2026-07-29  9:07 ` [PATCH proxmox-backup v3 2/5] datastore: data blob: refactor decoding method Christian Ebner
2026-07-29  9:07 ` [PATCH proxmox-backup v3 3/5] client: backup writer: pass no crypt config to manifest blob decoder Christian Ebner
2026-07-29  9:07 ` [PATCH proxmox-backup v3 4/5] client: allow skipping signature check on previous manifest fetching Christian Ebner
2026-07-29  9:07 ` [PATCH proxmox-backup v3 5/5] sync: push: gracefully handle previous manifest signature mismatches Christian Ebner
2026-07-29 13:00 ` applied-series: [PATCH proxmox-backup v3 0/5] restrict previous manifest reuse checks for push sync jobs Fabian Grünbichler

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=20260729090737.135385-2-c.ebner@proxmox.com \
    --to=c.ebner@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal