all lists on lists.proxmox.com
 help / color / mirror / Atom feed
From: Dominik Csapak <d.csapak@proxmox.com>
To: pbs-devel@lists.proxmox.com
Subject: [pbs-devel] [PATCH proxmox-backup 1/2] adapt to changed callback signature of 'scandir'
Date: Tue, 28 Jun 2022 13:13:17 +0200	[thread overview]
Message-ID: <20220628111318.2648586-3-d.csapak@proxmox.com> (raw)
In-Reply-To: <20220628111318.2648586-1-d.csapak@proxmox.com>

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





  parent reply	other threads:[~2022-06-28 11:13 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-28 11:13 [pbs-devel] [PATCH proxmox/proxmox-backup] fix #2915: stat when necessary Dominik Csapak
2022-06-28 11:13 ` [pbs-devel] [PATCH proxmox 1/1] partially fix #2915: proxmox-sys: scandir: stat if file_type is unknown Dominik Csapak
2022-06-28 11:45   ` Wolfgang Bumiller
2022-06-28 11:13 ` Dominik Csapak [this message]
2022-06-28 11:47   ` [pbs-devel] [PATCH proxmox-backup 1/2] adapt to changed callback signature of 'scandir' Fabian Grünbichler
2022-06-28 11:13 ` [pbs-devel] [PATCH proxmox-backup 2/2] partially fix #2915: 'stat' in case ReadDirEntry does not contain type Dominik Csapak
2022-06-28 11:47   ` Fabian Grünbichler
2022-06-28 11:49   ` Wolfgang Bumiller
2022-06-28 11:52     ` Wolfgang Bumiller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220628111318.2648586-3-d.csapak@proxmox.com \
    --to=d.csapak@proxmox.com \
    --cc=pbs-devel@lists.proxmox.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.
Service provided by Proxmox Server Solutions GmbH | Privacy | Legal