summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorOlivier Blin <oblin@mandriva.com>2009-07-31 14:18:04 +0000
committerOlivier Blin <oblin@mandriva.com>2009-07-31 14:18:04 +0000
commitf9969878e05fedc1f12378ddf033185658867f74 (patch)
treef03cf4c8f87ac677bf109d7c9ee8222b182937d4
parent1746f1a3f6f0ae8781325452566d003e53c9a762 (diff)
downloaddraklive-f9969878e05fedc1f12378ddf033185658867f74.tar
draklive-f9969878e05fedc1f12378ddf033185658867f74.tar.gz
draklive-f9969878e05fedc1f12378ddf033185658867f74.tar.bz2
draklive-f9969878e05fedc1f12378ddf033185658867f74.tar.xz
draklive-f9969878e05fedc1f12378ddf033185658867f74.zip
simplify by using size in sectors
-rwxr-xr-xdraklive9
1 files changed, 4 insertions, 5 deletions
diff --git a/draklive b/draklive
index 2e5f774..be0c629 100755
--- a/draklive
+++ b/draklive
@@ -684,13 +684,12 @@ sub allocate_master {
heads => 16,
sectors => 63, # sectors per track
};
- my $track_size = $common::SECTORSIZE * $geom->{sectors};
- my $cylinder_size = $track_size * $geom->{heads};
- my $disk_size = $track_size + fold_left { $::a + $::b } map { $_->{size} * $common::SECTORSIZE } @{$live->{media}{partitions}};
- $geom->{cylinders} = int($disk_size / $cylinder_size);
+ my $disk_sectors = fold_left { $::a->{size} + $::b->{size} } @{$live->{media}{partitions}};
+ $disk_sectors += $geom->{sectors}; # keep one more track
+ $geom->{cylinders} = int($disk_sectors / ($geom->{sectors} * $geom->{heads}));
- MDV::Draklive::Utils::device_allocate_file($dest, $disk_size);
+ MDV::Draklive::Utils::device_allocate_file($dest, $disk_sectors * $common::SECTORSIZE);
my $hd = bless {
totalsectors => $geom->{cylinders} * $geom->{heads} * $geom->{sectors},