From 59e175d9ad63a30e112f25fc98c17cfc98ceb1f5 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Tue, 4 Aug 2009 07:35:29 +0000 Subject: fix size approximations by using ceil --- draklive | 3 ++- lib/MDV/Draklive/Media.pm | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/draklive b/draklive index 6aae36e..93282f5 100755 --- a/draklive +++ b/draklive @@ -31,6 +31,7 @@ use Getopt::Long; use Pod::Usage; use File::Temp; use IO::Handle; #- autoflush +use POSIX; use MDV::Draklive::Utils; use MDV::Draklive::Live; use MDV::Draklive::Progress; @@ -696,7 +697,7 @@ sub get_hd_from_layout { my $geom = get_harddisk_geometry($media); my $required_sectors = fold_left { $::a + $::b } map { $_->{size} } @{$media->{partitions}}; $required_sectors += $geom->{sectors}; # keep one more track - $geom->{cylinders} = int($required_sectors / ($geom->{sectors} * $geom->{heads})); + $geom->{cylinders} = POSIX::ceil($required_sectors / ($geom->{sectors} * $geom->{heads})); my $total_sectors = $geom->{cylinders} * $geom->{heads} * $geom->{sectors}; my $hd = bless { totalsectors => $total_sectors, diff --git a/lib/MDV/Draklive/Media.pm b/lib/MDV/Draklive/Media.pm index 159fab3..bb938ff 100644 --- a/lib/MDV/Draklive/Media.pm +++ b/lib/MDV/Draklive/Media.pm @@ -2,6 +2,7 @@ package MDV::Draklive::Media; use MDK::Common; use MDV::Draklive::Storage; +use POSIX; use common; sub get_initrd_path { @@ -69,7 +70,7 @@ sub supplement_partitions { my $correction = 1.2; my $slash = find { $_->{mntpoint} eq '/' } @{$media->{partitions}}; - $slash->{size} ||= int($total_size * $correction / $common::SECTORSIZE); + $slash->{size} ||= POSIX::ceil($total_size * $correction / $common::SECTORSIZE); } 1; -- cgit v1.2.1