From 5c2dacabb3f62574c0d936a118b688de8a5a1f6d Mon Sep 17 00:00:00 2001 From: Pascal Rigaux Date: Thu, 6 Mar 2008 12:51:19 +0000 Subject: - fix partition device name for some dmraid (missing "p", cf #38363) simplifying code, since using "p" to separate device name from partition number when device name ends with a digit is standard in the kernel $hd->{prefix} is no more always created. Only used in same special cases --- perl-install/partition_table.pm | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) (limited to 'perl-install/partition_table.pm') diff --git a/perl-install/partition_table.pm b/perl-install/partition_table.pm index dd4a295f0..6890b466d 100644 --- a/perl-install/partition_table.pm +++ b/perl-install/partition_table.pm @@ -80,7 +80,13 @@ sub verifyPrimary { sub compute_device_name { my ($part, $hd) = @_; - $part->{device} = $hd->{prefix} . $part->{part_number}; + $part->{device} = _compute_device_name($hd, $part->{part_number}); +} + +sub _compute_device_name { + my ($hd, $nb) = @_; + my $prefix = $hd->{prefix} || $hd->{device} . ($hd->{device} =~ /\d$/ ? 'p' : ''); + $prefix . $nb; } sub assign_device_numbers { @@ -98,7 +104,7 @@ sub assign_device_numbers { #- now loop through them, assigning partition numbers - reserve one for the holes foreach (@{$hd->{primary}{normal}}) { if ($_->{start} > $start) { - log::l("PPC: found a hole on $hd->{prefix} before $_->{start}, skipping device..."); + log::l("PPC: found a hole on $hd->{device} before $_->{start}, skipping device..."); $i++; } $_->{part_number} = $i; @@ -113,7 +119,7 @@ sub assign_device_numbers { $i++; } foreach (map { $_->{normal} } @{$hd->{extended} || []}) { - my $dev = $hd->{prefix} . $i; + my $dev = _compute_device_name($hd, $i); my $renumbered = $_->{device} && $dev ne $_->{device}; if ($renumbered) { require fs::mount; -- cgit v1.2.1