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 4458B1FF398 for ; Mon, 27 May 2024 15:07:10 +0200 (CEST) Received: from firstgate.proxmox.com (localhost [127.0.0.1]) by firstgate.proxmox.com (Proxmox) with ESMTP id 386DF295F; Mon, 27 May 2024 15:07:33 +0200 (CEST) From: Filip Schauer To: pbs-devel@lists.proxmox.com Date: Mon, 27 May 2024 15:07:14 +0200 Message-Id: <20240527130715.189131-2-f.schauer@proxmox.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240527130715.189131-1-f.schauer@proxmox.com> References: <20240527130715.189131-1-f.schauer@proxmox.com> MIME-Version: 1.0 X-SPAM-LEVEL: Spam detection results: 0 AWL -0.060 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 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] [PATCH backup-qemu 1/2] add support for notes 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" Allow adding a comment/notes to a new backup. Signed-off-by: Filip Schauer --- src/backup.rs | 6 +++++- src/lib.rs | 9 +++++++++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/backup.rs b/src/backup.rs index bbe4f00..b7d383a 100644 --- a/src/backup.rs +++ b/src/backup.rs @@ -73,7 +73,11 @@ impl BackupTask { let (abort, _) = tokio::sync::broadcast::channel(16); - let manifest = Arc::new(Mutex::new(BackupManifest::new(setup.backup_dir.clone()))); + let mut manifest = BackupManifest::new(setup.backup_dir.clone()); + if let Some(notes) = &setup.notes { + manifest.unprotected["notes"] = serde_json::Value::String(notes.clone()); + } + let manifest = Arc::new(Mutex::new(manifest)); let registry = Arc::new(Mutex::new(Registry::::new())); let known_chunks = Arc::new(Mutex::new(HashSet::new())); diff --git a/src/lib.rs b/src/lib.rs index 9067fc5..034b7ab 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -140,6 +140,7 @@ pub(crate) struct BackupSetup { pub key_password: Option, pub master_keyfile: Option, pub fingerprint: Option, + pub notes: Option, } // helper class to implement synchrounous interface @@ -212,6 +213,7 @@ pub extern "C" fn proxmox_backup_new( compress: bool, encrypt: bool, fingerprint: *const c_char, + notes: *const c_char, error: *mut *mut c_char, ) -> *mut ProxmoxBackupHandle { proxmox_backup_new_ns( @@ -227,6 +229,7 @@ pub extern "C" fn proxmox_backup_new( compress, encrypt, fingerprint, + notes, error, ) } @@ -251,6 +254,7 @@ pub extern "C" fn proxmox_backup_new_ns( compress: bool, encrypt: bool, fingerprint: *const c_char, + notes: *const c_char, error: *mut *mut c_char, ) -> *mut ProxmoxBackupHandle { let task: Result<_, Error> = try_block!({ @@ -277,6 +281,8 @@ pub extern "C" fn proxmox_backup_new_ns( return Err(format_err!("can't use master keyfile without keyfile")); } + let notes = tools::utf8_c_string(notes)?; + let crypt_mode = if keyfile.is_some() { if encrypt { CryptMode::Encrypt @@ -304,6 +310,7 @@ pub extern "C" fn proxmox_backup_new_ns( key_password, master_keyfile, fingerprint, + notes, }; BackupTask::new(setup, compress, crypt_mode) @@ -816,6 +823,7 @@ pub extern "C" fn proxmox_restore_new( key_password, master_keyfile: None, fingerprint, + notes: None, }; RestoreTask::new(setup) @@ -876,6 +884,7 @@ pub extern "C" fn proxmox_restore_new_ns( key_password, master_keyfile: None, fingerprint, + notes: None, }; RestoreTask::new(setup) -- 2.39.2 _______________________________________________ pbs-devel mailing list pbs-devel@lists.proxmox.com https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel