summaryrefslogtreecommitdiffstats
path: root/perl-install/partition_table
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-09-18 10:37:15 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-09-18 10:37:15 +0000
commitfff307ac3e81281d98fa33c078264cbb7812f237 (patch)
treee4482697d105584deae6cb390712d722db30fb8a /perl-install/partition_table
parente31295b058b23831d5ceced25adc058df97704d3 (diff)
downloaddrakx-backup-do-not-use-fff307ac3e81281d98fa33c078264cbb7812f237.tar
drakx-backup-do-not-use-fff307ac3e81281d98fa33c078264cbb7812f237.tar.gz
drakx-backup-do-not-use-fff307ac3e81281d98fa33c078264cbb7812f237.tar.bz2
drakx-backup-do-not-use-fff307ac3e81281d98fa33c078264cbb7812f237.tar.xz
drakx-backup-do-not-use-fff307ac3e81281d98fa33c078264cbb7812f237.zip
create pt_info_to_primary() out of partition_table::read_one()
Diffstat (limited to 'perl-install/partition_table')
-rw-r--r--perl-install/partition_table/raw.pm14
1 files changed, 14 insertions, 0 deletions
diff --git a/perl-install/partition_table/raw.pm b/perl-install/partition_table/raw.pm
index d1549239d..e2fd7e949 100644
--- a/perl-install/partition_table/raw.pm
+++ b/perl-install/partition_table/raw.pm
@@ -6,6 +6,7 @@ use strict;
use common;
use devices;
use detect_devices;
+use fs::type;
use log;
use c;
@@ -235,6 +236,19 @@ sub zero_MBR_and_dirty {
zero_MBR($hd);
}
+sub pt_info_to_primary {
+ my ($hd, $pt, $info) = @_;
+
+ my @extended = $hd->hasExtended ? grep { isExtended($_) } @$pt : ();
+ my @normal = grep { $_->{size} && !isEmpty($_) && !isExtended($_) } @$pt;
+ my $nb_special_empty = int(grep { $_->{size} && isEmpty($_) } @$pt);
+
+ @extended > 1 and die "more than one extended partition";
+
+ put_in_hash($_, partition_table::hd2minimal_part($hd)) foreach @normal, @extended;
+ { raw => $pt, extended => $extended[0], normal => \@normal, info => $info, nb_special_empty => $nb_special_empty };
+}
+
#- ugly stuff needed mainly for Western Digital IDE drives
#- try writing what we've just read, yells if it fails
#- testing on last sector of head #0 (unused in 99% cases)