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

Fabian Grünbichler f.gruenbichler at proxmox.com
Tue Jun 28 13:47:47 CEST 2022


On June 28, 2022 1:13 pm, Dominik Csapak wrote:
> we now get an Option<FileStat> too

but don't use it *anywhere* - so why introduce a breaking change in 
proxmox_sys for it? is there some other place where we use it?

> 
> 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
> 
> 
> 
> _______________________________________________
> pbs-devel mailing list
> pbs-devel at lists.proxmox.com
> https://lists.proxmox.com/cgi-bin/mailman/listinfo/pbs-devel
> 
> 
> 





More information about the pbs-devel mailing list