diff options
Diffstat (limited to 'perl-install/loopback.pm')
-rw-r--r-- | perl-install/loopback.pm | 15 |
1 files changed, 3 insertions, 12 deletions
diff --git a/perl-install/loopback.pm b/perl-install/loopback.pm index da89f1e5e..1a90e1091 100644 --- a/perl-install/loopback.pm +++ b/perl-install/loopback.pm @@ -99,18 +99,9 @@ sub inspect { sub getFree { my ($dir, $part) = @_; - my ($freespace); - - if ($dir) { - my $buf = ' ' x 20000; - syscall_('statfs', $dir, $buf) or return; - my (undef, $blocksize, $size, undef, $free, undef) = unpack "L2L4", $buf; - $_ *= $blocksize / 512 foreach $free; - - $freespace = $free; - } else { - $freespace = $part->{size}; - } + my $freespace = $dir ? + 2 * (common::df($dir))[1] : #- df in KiB + $part->{size}; $freespace - sum map { $_->{size} } @{$part->{loopback} || []}; } |