all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: "Fabian Grünbichler" <f.gruenbichler@proxmox.com>
To: pve-devel@lists.proxmox.com
Subject: [pve-devel] [PATCH proxmox-backup-qemu v2 2/3] add archive_name helper
Date: Fri, 24 Jul 2020 11:53:34 +0200	[thread overview]
Message-ID: <20200724095335.2869192-3-f.gruenbichler@proxmox.com> (raw)
In-Reply-To: <20200724095335.2869192-1-f.gruenbichler@proxmox.com>

since we're about to introduce a third duplicate of this line..

Signed-off-by: Fabian Grünbichler <f.gruenbichler@proxmox.com>
---
 src/commands.rs | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/src/commands.rs b/src/commands.rs
index dd00ca9..e2584ab 100644
--- a/src/commands.rs
+++ b/src/commands.rs
@@ -78,16 +78,18 @@ pub(crate) async fn add_config(
     Ok(0)
 }
 
+fn archive_name(device_name: &str) -> String {
+    format!("{}.img.fidx", device_name)
+}
+
 pub(crate) fn check_last_incremental_csum(
     manifest: Arc<BackupManifest>,
     device_name: &str,
     device_size: u64,
 ) -> bool {
 
-    let archive_name = format!("{}.img.fidx", device_name);
-
     match PREVIOUS_CSUMS.lock().unwrap().get(device_name) {
-        Some(csum) => manifest.verify_file(&archive_name, &csum, device_size).is_ok(),
+        Some(csum) => manifest.verify_file(&archive_name(device_name), &csum, device_size).is_ok(),
         None => false,
     }
 }
@@ -105,7 +107,7 @@ pub(crate) async fn register_image(
     incremental: bool,
 ) -> Result<c_int, Error> {
 
-    let archive_name = format!("{}.img.fidx", device_name);
+    let archive_name = archive_name(&device_name);
 
     let index = match manifest {
         Some(manifest) => {
-- 
2.20.1





  parent reply	other threads:[~2020-07-24  9:54 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-24  9:53 [pve-devel] [PATCH proxmox-backup-qemu v2 0/3] fix #2866: invalidate bitmap on crypt_mode change Fabian Grünbichler
2020-07-24  9:53 ` [pve-devel] [PATCH proxmox-backup-qemu v2 1/3] refactor incremental checks Fabian Grünbichler
2020-07-24  9:53 ` Fabian Grünbichler [this message]
2020-07-24  9:53 ` [pve-devel] [PATCH proxmox-backup-qemu v2 3/3] fix #2866: invalidate bitmap on crypt_mode change Fabian Grünbichler
2020-08-13  7:35 ` [pve-devel] applied: [PATCH proxmox-backup-qemu v2 0/3] " Wolfgang Bumiller

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=20200724095335.2869192-3-f.gruenbichler@proxmox.com \
    --to=f.gruenbichler@proxmox.com \
    --cc=pve-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