diff options
-rwxr-xr-x | draklive | 19 |
1 files changed, 11 insertions, 8 deletions
@@ -691,24 +691,27 @@ sub get_harddisk_geometry { }; } -sub allocate_master { - my ($live, $media, $dest) = @_; - +sub get_hd_from_layout { + my ($media, $dest) = @_; 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})); my $total_sectors = $geom->{cylinders} * $geom->{heads} * $geom->{sectors}; - - mkdir_p(dirname($dest)); - MDV::Draklive::Utils::device_allocate_file($dest, $total_sectors * $common::SECTORSIZE); - my $hd = bless { totalsectors => $total_sectors, geom => $geom, file => $dest, }, 'partition_table::dos'; +} + +sub allocate_master { + my ($live, $media, $dest) = @_; + + my $hd = get_hd_from_layout($media, $dest); + + mkdir_p(dirname($dest)); + MDV::Draklive::Utils::device_allocate_file($dest, $hd->{totalsectors} * $common::SECTORSIZE); partition_table::raw::zero_MBR($hd); |