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/NEWS | 2 ++ perl-install/detect_devices.pm | 4 ++-- perl-install/fsedit.pm | 1 - perl-install/install/NEWS | 1 + perl-install/partition_table.pm | 12 +++++++++--- 5 files changed, 14 insertions(+), 6 deletions(-) diff --git a/perl-install/NEWS b/perl-install/NEWS index 3e4c70054..4e467652a 100644 --- a/perl-install/NEWS +++ b/perl-install/NEWS @@ -3,10 +3,12 @@ - diskdrake: o fix resizing/formatting ntfs (broken because of ntfs-3g switch in previous release) + o fix partition device name for some dmraid (missing "p", cf #38363) o do not timeout after 10 minutes when resizing NTFS partition - detect_devices: o provide sysfs device path on Firewire and PCMCIA bus (to be able to fix #33950 in drakx-net) + Version 10.9 - 5 March 2008 - adapt to new kernel-2.6.25's sysfs layout (Eric Pielbug, #38235) diff --git a/perl-install/detect_devices.pm b/perl-install/detect_devices.pm index 1f048672d..9cd990c68 100644 --- a/perl-install/detect_devices.pm +++ b/perl-install/detect_devices.pm @@ -344,7 +344,7 @@ sub getDAC960() { #- /dev/rd/c0d0: RAID-7, Online, 17928192 blocks, Write Thru0123456790123456789012 foreach (syslog()) { my ($device, $info) = m|/dev/(rd/.*?): (.*?),| or next; - $idi{$device} = { info => $info, media_type => 'hd', device => $device, prefix => $device . 'p', bus => 'dac960' }; + $idi{$device} = { info => $info, media_type => 'hd', device => $device, bus => 'dac960' }; } values %idi; } @@ -353,7 +353,7 @@ sub getATARAID() { my %l; foreach (syslog()) { my ($device) = m|^\s*(ataraid/d\d+):| or next; - $l{$device} = { info => 'ATARAID block device', media_type => 'hd', device => $device, prefix => $device . 'p', bus => 'ataraid' }; + $l{$device} = { info => 'ATARAID block device', media_type => 'hd', device => $device, bus => 'ataraid' }; log::l("ATARAID: $device"); } values %l; diff --git a/perl-install/fsedit.pm b/perl-install/fsedit.pm index 5c82a2429..2e8f05b2c 100644 --- a/perl-install/fsedit.pm +++ b/perl-install/fsedit.pm @@ -143,7 +143,6 @@ sub get_hds { foreach my $hd (@drives) { $hd->{file} = devices::make($hd->{device}); - $hd->{prefix} ||= $hd->{device}; } @drives = partition_table::raw::get_geometries(@drives); diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS index dad4ee007..fdc0eac4c 100644 --- a/perl-install/install/NEWS +++ b/perl-install/install/NEWS @@ -4,6 +4,7 @@ - do not load i810fb, rely on vesa xorg drive instead (it may help #37772) - restore correct configuration of nfs/hd media in urpmi.cfg (regression introduced in 10.8) +- fix partition device name for some dmraid (missing "p", cf #38363) - do not timeout after 10 minutes when resizing NTFS partition Version 10.8 - 4 March 2008 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