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 A4F1E6B2FD for ; Fri, 18 Mar 2022 15:07:20 +0100 (CET) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id A07B41E837 for ; Fri, 18 Mar 2022 15:07:20 +0100 (CET) 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 AD04F1E819 for ; Fri, 18 Mar 2022 15:07:19 +0100 (CET) Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1]) by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 847E846F0A for ; Fri, 18 Mar 2022 15:07:19 +0100 (CET) From: Stefan Sterz To: pbs-devel@lists.proxmox.com Date: Fri, 18 Mar 2022 15:06:53 +0100 Message-Id: <20220318140655.170656-4-s.sterz@proxmox.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20220318140655.170656-1-s.sterz@proxmox.com> References: <20220318140655.170656-1-s.sterz@proxmox.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-SPAM-LEVEL: Spam detection results: 0 AWL -0.000 Adjusted score from AWL reputation of From: address BAYES_00 -1.9 Bayes spam probability is 0 to 1% KAM_DMARC_STATUS 0.01 Test Rule for DKIM or SPF Failure with Strict Alignment 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 - Subject: [pbs-devel] [RFC PATCH 3/5] fix #3935: datastore/config: add a constant for the locking directory 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: Fri, 18 Mar 2022 14:07:20 -0000 adds a constant to make switching the datastore lock directory location easier Signed-off-by: Stefan Sterz --- pbs-datastore/src/datastore.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/pbs-datastore/src/datastore.rs b/pbs-datastore/src/datastore.rs index c1304d1a..11bd578d 100644 --- a/pbs-datastore/src/datastore.rs +++ b/pbs-datastore/src/datastore.rs @@ -39,6 +39,8 @@ lazy_static! { static ref DATASTORE_MAP: Mutex>> = Mutex::new(HashMap::new()); } +pub const DATASTORE_LOCKS_DIR: &str = "/run/proxmox-backup/locks"; + /// checks if auth_id is owner, or, if owner is a token, if /// auth_id is the user of the token pub fn check_backup_owner( @@ -807,7 +809,8 @@ impl DataStore { backup_dir: &BackupDir, ) -> Result { let mut path = format!( - "/run/proxmox-backup/locks/{}/{}/{}", + "{}/{}/{}/{}", + DATASTORE_LOCKS_DIR, self.name(), backup_dir.group().backup_type(), backup_dir.group().backup_id(), @@ -949,7 +952,7 @@ impl DataStore { } fn snapshot_lock_path(&self, backup_dir: &BackupDir) -> Result { - let path = Path::new("/run/proxmox-backup/locks") + let path = Path::new(DATASTORE_LOCKS_DIR) .join(self.name()) .join(backup_dir.relative_path()); @@ -959,7 +962,7 @@ impl DataStore { } fn group_lock_path(&self, group: &BackupGroup) -> Result { - let path = Path::new("/run/proxmox-backup/locks") + let path = Path::new(DATASTORE_LOCKS_DIR) .join(self.name()) .join(group.group_path()); -- 2.30.2