From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from firstgate.proxmox.com (firstgate.proxmox.com [212.224.123.68]) by lore.proxmox.com (Postfix) with ESMTPS id D62B71FF15E for ; Tue, 28 Jan 2025 16:09:53 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 400CE10A5B; Tue, 28 Jan 2025 16:09:50 +0100 (CET) From: Christian Ebner To: pbs-devel@lists.proxmox.com Date: Tue, 28 Jan 2025 16:09:07 +0100 Message-Id: <20250128150907.437556-2-c.ebner@proxmox.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250128150907.437556-1-c.ebner@proxmox.com> References: <20250128150907.437556-1-c.ebner@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL 0.036 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% DMARC_MISSING 0.1 Missing DMARC policy KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment RCVD_IN_VALIDITY_CERTIFIED_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_RPBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. RCVD_IN_VALIDITY_SAFE_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to Validity was blocked. See https://knowledge.validity.com/hc/en-us/articles/20961730681243 for more information. SPF_HELO_NONE 0.001 SPF: HELO does not publish an SPF Record SPF_PASS -0.001 SPF: sender matches SPF record T_SCC_BODY_TEXT_LINE -0.01 - URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more information. [commands.rs, backup.rs] Subject: [pbs-devel] [PATCH proxmox-backup-qemu 2/2] commands: rename helper to get archive name from device name 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: , Reply-To: Proxmox Backup Server development discussion Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: pbs-devel-bounces@lists.proxmox.com Sender: "pbs-devel" Rename the helper method to get the archive name from a device name to reduce possible miss-use. The helper adds a `.img.fidx` filename extension uncoditionally before parsing the `BackupArchiveName`. No functional changes intended. Signed-off-by: Christian Ebner --- src/backup.rs | 3 ++- src/commands.rs | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/backup.rs b/src/backup.rs index 32037ce..e8a0528 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -234,7 +234,8 @@ impl BackupTask { pub fn check_incremental(&self, device_name: String, size: u64) -> bool { match self.last_manifest() { Some(ref manifest) => { - let archive_name = if let Ok(archive) = archive_name(&device_name) { + let archive_name = if let Ok(archive) = archive_name_from_device_name(&device_name) + { archive } else { return false; diff --git a/src/commands.rs b/src/commands.rs index 22e7135..565649f 100644 --- a/src/commands.rs +++ b/src/commands.rs @@ -120,7 +120,7 @@ pub(crate) async fn add_config( Ok(0) } -pub(crate) fn archive_name(device_name: &str) -> Result { +pub(crate) fn archive_name_from_device_name(device_name: &str) -> Result { format!("{}.img.fidx", device_name).parse() } @@ -191,7 +191,7 @@ pub(crate) async fn register_image( chunk_size: u64, incremental: bool, ) -> Result { - let archive_name: BackupArchiveName = archive_name(&device_name)?; + let archive_name: BackupArchiveName = archive_name_from_device_name(&device_name)?; let index = match manifest { Some(manifest) => { @@ -328,7 +328,7 @@ pub(crate) async fn close_image( let mut guard = manifest.lock().unwrap(); guard.add_file( - &archive_name(&device_name)?, + &archive_name_from_device_name(&device_name)?, device_size, upload_result.csum, crypt_mode, -- 2.39.5 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel