diff options
author | Olivier Blin <oblin@mandriva.com> | 2009-07-31 14:18:04 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2009-07-31 14:18:04 +0000 |
commit | f9969878e05fedc1f12378ddf033185658867f74 (patch) | |
tree | f03cf4c8f87ac677bf109d7c9ee8222b182937d4 | |
parent | 1746f1a3f6f0ae8781325452566d003e53c9a762 (diff) | |
download | draklive-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-x | draklive | 9 |
1 files changed, 4 insertions, 5 deletions
@@ -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}, |