[pbs-devel] [PATCH proxmox-backup 1/2] adapt to changed callback signature of 'scandir'

Dominik Csapak d.csapak at proxmox.com
Tue Jun 28 13:13:17 CEST 2022


we now get an Option<FileStat> too

Signed-off-by: Dominik Csapak <d.csapak at 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






More information about the pbs-devel mailing list