]> git.proxmox.com Git - pve-storage.git/commitdiff
base plugin: add ctime for all files
authorDietmar Maurer <dietmar@proxmox.com>
Wed, 4 Mar 2020 10:46:20 +0000 (11:46 +0100)
committerThomas Lamprecht <t.lamprecht@proxmox.com>
Fri, 6 Mar 2020 18:26:45 +0000 (19:26 +0100)
Creation time makes sense for other file types also.

Signed-off-by: Dietmar Maurer <dietmar@proxmox.com>
PVE/Storage/Plugin.pm

index bd4bb8ccd279a0d7e94ea2170b146b61e48542a6..85af1c8ec94c835e73095a1622508f20617ace50 100644 (file)
@@ -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;
     }