diff options
author | Olivier Blin <oblin@mandriva.com> | 2009-08-03 13:40:23 +0000 |
---|---|---|
committer | Olivier Blin <oblin@mandriva.com> | 2009-08-03 13:40:23 +0000 |
commit | e1b4c144e966808bfa3f2985082029c2fdbd2e70 (patch) | |
tree | 9fe33cb323d48c7c4e2615c73507148520826217 | |
parent | 4687dacbcb54b8592f3a8114c9faa167b9ceb55f (diff) | |
download | draklive-e1b4c144e966808bfa3f2985082029c2fdbd2e70.tar draklive-e1b4c144e966808bfa3f2985082029c2fdbd2e70.tar.gz draklive-e1b4c144e966808bfa3f2985082029c2fdbd2e70.tar.bz2 draklive-e1b4c144e966808bfa3f2985082029c2fdbd2e70.tar.xz draklive-e1b4c144e966808bfa3f2985082029c2fdbd2e70.zip |
extract get_hd_from_layout
-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); |