From: Dietmar Maurer Date: Wed, 4 Mar 2020 10:46:20 +0000 (+0100) Subject: base plugin: add ctime for all files X-Git-Url: https://git.proxmox.com/?p=pve-storage.git;a=commitdiff_plain;h=ff9c5451a56ee2c7ff2df1dcb44404883effab9a base plugin: add ctime for all files Creation time makes sense for other file types also. Signed-off-by: Dietmar Maurer --- diff --git a/PVE/Storage/Plugin.pm b/PVE/Storage/Plugin.pm index bd4bb8c..85af1c8 100644 --- a/PVE/Storage/Plugin.pm +++ b/PVE/Storage/Plugin.pm @@ -3,6 +3,7 @@ package PVE::Storage::Plugin; use strict; use warnings; +use Fcntl ':mode'; use File::chdir; use File::Path; use File::Basename; @@ -904,7 +905,11 @@ my $get_subdir_files = sub { foreach my $fn (<$path/*>) { - next if -d $fn; + my ($dev,$ino,$mode,$nlink,$uid,$gid,$rdev,$size, + $atime,$mtime,$ctime,$blksize,$blocks) + = stat($fn); + + next if S_ISDIR($mode); my $info; @@ -943,7 +948,8 @@ my $get_subdir_files = sub { }; } - $info->{size} = -s $fn // 0; + $info->{size} = $size; + $info->{ctime} //= $ctime; push @$res, $info; }