diff options
author | Pascal Terjan <pterjan@mageia.org> | 2012-04-07 09:21:59 +0000 |
---|---|---|
committer | Pascal Terjan <pterjan@mageia.org> | 2012-04-07 09:21:59 +0000 |
commit | dc5dbda245332fd7d50855ff2e427a7a2742b791 (patch) | |
tree | 6eaab3408ac2ef69963a436d9c4242fce7cad2ce | |
parent | 717d41af256d8a19717afc0eab121217c60507ad (diff) | |
download | drakx-dc5dbda245332fd7d50855ff2e427a7a2742b791.tar drakx-dc5dbda245332fd7d50855ff2e427a7a2742b791.tar.gz drakx-dc5dbda245332fd7d50855ff2e427a7a2742b791.tar.bz2 drakx-dc5dbda245332fd7d50855ff2e427a7a2742b791.tar.xz drakx-dc5dbda245332fd7d50855ff2e427a7a2742b791.zip |
Simplify
-rw-r--r-- | perl-install/partition_table/gpt.pm | 32 |
1 files changed, 13 insertions, 19 deletions
diff --git a/perl-install/partition_table/gpt.pm b/perl-install/partition_table/gpt.pm index 24e2f4029..9c4c17e65 100644 --- a/perl-install/partition_table/gpt.pm +++ b/perl-install/partition_table/gpt.pm @@ -10,39 +10,33 @@ use partition_table::raw; use c; my $nb_primary = 128; -#sub use_pt_type { 1 } sub read_one { my ($hd, $_sector) = @_; - my $info; c::get_disk_type($hd->{file}) eq "gpt" or die "not a GPT disk"; - my %parts = map { - my %p; - print $_; - if (/^([^ ]*) ([^ ]*) ([^ ]*) (.*) \((\d*),(\d*),(\d*)\)$/) { + + my @pt; + foreach (c::get_disk_partitions($hd->{file})) { + log::l($_); + if (/^([^ ]*) ([^ ]*) ([^ ]*) (.*) \((\d*),(\d*),(\d*)\)$/) { + my %p; $p{part_number} = $1; $p{real_device} = $2; $p{fs_type} = $3; $p{pt_type} = 0xba; $p{start} = $5; $p{size} = $7; + @pt[$p{part_number}-1] = \%p; } - $p{part_number} => \%p; - } c::get_disk_partitions($hd->{file}); + } - my @pt = map { - my $part_number = $_; - if ($parts{$part_number}) { - $parts{$part_number}; - } else { - my %p; - $p{part_number} = $part_number; - \%p; - } - } (1..$nb_primary); + for (my $part_number = 1; $part_number < $nb_primary; $part_number++) { + next if exists($pt[$part_number-1]); + $pt[$part_number-1] = { part_number => $part_number }; + } - [ @pt ], $info; + \@pt; } sub write { |