From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <d.csapak@proxmox.com>
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 4D47B7863C
 for <pbs-devel@lists.proxmox.com>; Tue, 28 Jun 2022 13:13:20 +0200 (CEST)
Received: from firstgate.proxmox.com (localhost [127.0.0.1])
 by firstgate.proxmox.com (Proxmox) with ESMTP id 3C131A41A
 for <pbs-devel@lists.proxmox.com>; Tue, 28 Jun 2022 13:13:20 +0200 (CEST)
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 4580EA407
 for <pbs-devel@lists.proxmox.com>; Tue, 28 Jun 2022 13:13:19 +0200 (CEST)
Received: from proxmox-new.maurer-it.com (localhost.localdomain [127.0.0.1])
 by proxmox-new.maurer-it.com (Proxmox) with ESMTP id 117D840518
 for <pbs-devel@lists.proxmox.com>; Tue, 28 Jun 2022 13:13:19 +0200 (CEST)
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Date: Tue, 28 Jun 2022 13:13:17 +0200
Message-Id: <20220628111318.2648586-3-d.csapak@proxmox.com>
X-Mailer: git-send-email 2.30.2
In-Reply-To: <20220628111318.2648586-1-d.csapak@proxmox.com>
References: <20220628111318.2648586-1-d.csapak@proxmox.com>
MIME-Version: 1.0
Content-Transfer-Encoding: 8bit
X-SPAM-LEVEL: Spam detection results:  0
 AWL 0.100 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 -
 URIBL_BLOCKED 0.001 ADMINISTRATOR NOTICE: The query to URIBL was blocked. See
 http://wiki.apache.org/spamassassin/DnsBlocklists#dnsbl-block for more
 information. [zfs.rs]
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] adapt to changed callback
 signature of 'scandir'
X-BeenThere: pbs-devel@lists.proxmox.com
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: Proxmox Backup Server development discussion
 <pbs-devel.lists.proxmox.com>
List-Unsubscribe: <https://lists.proxmox.com/cgi-bin/mailman/options/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=unsubscribe>
List-Archive: <http://lists.proxmox.com/pipermail/pbs-devel/>
List-Post: <mailto:pbs-devel@lists.proxmox.com>
List-Help: <mailto:pbs-devel-request@lists.proxmox.com?subject=help>
List-Subscribe: <https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel>, 
 <mailto:pbs-devel-request@lists.proxmox.com?subject=subscribe>
X-List-Received-Date: Tue, 28 Jun 2022 11:13:20 -0000

we now get an Option<FileStat> too

Signed-off-by: Dominik Csapak <d.csapak@proxmox.com>
---
 pbs-datastore/src/backup_info.rs | 23 ++++++++++++++---------
 src/tools/disks/zfs.rs           |  2 +-
 2 files changed, 15 insertions(+), 10 deletions(-)

diff --git a/pbs-datastore/src/backup_info.rs b/pbs-datastore/src/backup_info.rs
index 10320a35..21fe4602 100644
--- a/pbs-datastore/src/backup_info.rs
+++ b/pbs-datastore/src/backup_info.rs
@@ -87,7 +87,7 @@ impl BackupGroup {
             libc::AT_FDCWD,
             &path,
             &BACKUP_DATE_REGEX,
-            |l2_fd, backup_time, file_type| {
+            |l2_fd, backup_time, file_type, _stat| {
                 if file_type != nix::dir::Type::Directory {
                     return Ok(());
                 }
@@ -127,7 +127,7 @@ impl BackupGroup {
             libc::AT_FDCWD,
             &path,
             &BACKUP_DATE_REGEX,
-            |l2_fd, backup_time, file_type| {
+            |l2_fd, backup_time, file_type, _stat| {
                 if file_type != nix::dir::Type::Directory {
                     return Ok(());
                 }
@@ -635,13 +635,18 @@ fn list_backup_files<P: ?Sized + nix::NixPath>(
 ) -> Result<Vec<String>, Error> {
     let mut files = vec![];
 
-    proxmox_sys::fs::scandir(dirfd, path, &BACKUP_FILE_REGEX, |_, filename, file_type| {
-        if file_type != nix::dir::Type::File {
-            return Ok(());
-        }
-        files.push(filename.to_owned());
-        Ok(())
-    })?;
+    proxmox_sys::fs::scandir(
+        dirfd,
+        path,
+        &BACKUP_FILE_REGEX,
+        |_, filename, file_type, _stat| {
+            if file_type != nix::dir::Type::File {
+                return Ok(());
+            }
+            files.push(filename.to_owned());
+            Ok(())
+        },
+    )?;
 
     Ok(files)
 }
diff --git a/src/tools/disks/zfs.rs b/src/tools/disks/zfs.rs
index 30a6cc0c..5f09c2cf 100644
--- a/src/tools/disks/zfs.rs
+++ b/src/tools/disks/zfs.rs
@@ -178,7 +178,7 @@ pub(crate) fn update_zfs_objset_map(pool: &str) -> Result<(), Error> {
         libc::AT_FDCWD,
         &path,
         &OBJSET_REGEX,
-        |_l2_fd, filename, _type| {
+        |_l2_fd, filename, _type, _stat| {
             let (name, _) = parse_objset_stat(pool, filename)?;
             map.insert(name, (pool.to_string(), filename.to_string()));
             Ok(())
-- 
2.30.2