summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPascal Rigaux <pixel@mandriva.com>2007-08-06 11:24:14 +0000
committerPascal Rigaux <pixel@mandriva.com>2007-08-06 11:24:14 +0000
commitb5dbe5d514ab7c2031e7a21d05169a363d3b19dc (patch)
tree1b16eab9f4f6969d5cfae732dfc13b487e370e0f
parent1cde57b9356dc8d8aa7cd6e9523e411bbd8d547a (diff)
downloaddrakx-b5dbe5d514ab7c2031e7a21d05169a363d3b19dc.tar
drakx-b5dbe5d514ab7c2031e7a21d05169a363d3b19dc.tar.gz
drakx-b5dbe5d514ab7c2031e7a21d05169a363d3b19dc.tar.bz2
drakx-b5dbe5d514ab7c2031e7a21d05169a363d3b19dc.tar.xz
drakx-b5dbe5d514ab7c2031e7a21d05169a363d3b19dc.zip
- fix range max value >2TB when creating a partition (useful for LVs >2TB)distro/mdv2007.1
nb: >> 11 and << 11 doesn't work on floats which we use to handle >2TB partitions. perl floats are precise enough up until 512TB (backport from trunk)
-rw-r--r--perl-install/NEWS1
-rw-r--r--perl-install/diskdrake/interactive.pm25
-rw-r--r--perl-install/fs/partitioning_wizard.pm20
-rw-r--r--perl-install/install/NEWS1
4 files changed, 29 insertions, 18 deletions
diff --git a/perl-install/NEWS b/perl-install/NEWS
index c6268216f..b6e8f9f2f 100644
--- a/perl-install/NEWS
+++ b/perl-install/NEWS
@@ -1,5 +1,6 @@
- diskdrake
o fix 1.9TB displayed as 1TB
+ o fix range max value >2TB when creating a partition (useful for LVs >2TB)
- fix ext3 formatting with label and progress bar (#30032)
- service_harddrake (blino):
o do not enable fglrx libraries when disabling fglrx...
diff --git a/perl-install/diskdrake/interactive.pm b/perl-install/diskdrake/interactive.pm
index 364c95842..58542a872 100644
--- a/perl-install/diskdrake/interactive.pm
+++ b/perl-install/diskdrake/interactive.pm
@@ -503,7 +503,7 @@ sub Create {
#- one.
my ($primaryOrExtended, $migrate_files);
my $type_name = fs::type::part2type_name($part);
- my $mb_size = $part->{size} >> 11;
+ my $mb_size = to_Mb($part->{size});
my $has_startsector = ($::expert || arch() !~ /i.86/) && !isLVM($hd);
$in->ask_from(N("Create a new partition"), '',
@@ -511,10 +511,10 @@ sub Create {
{ label => N("Create a new partition"), title => 1 },
if_($has_startsector,
{ label => N("Start sector: "), val => \$part->{start}, min => $def_start, max => ($max - min_partition_size($hd)),
- type => 'range', SpinButton => $::expert, changed => sub { $mb_size = min($mb_size, ($max - $part->{start}) >> 11) } },
+ type => 'range', SpinButton => $::expert, changed => sub { $mb_size = min($mb_size, to_Mb($max - $part->{start})) } },
),
- { label => N("Size in MB: "), val => \$mb_size, min => min_partition_size($hd) >> 11, max => $def_size >> 11,
- type => 'range', SpinButton => $::expert, changed => sub { $part->{start} = min($part->{start}, $max - ($mb_size << 11)) } },
+ { label => N("Size in MB: "), val => \$mb_size, min => to_Mb(min_partition_size($hd)), max => to_Mb($def_size),
+ type => 'range', SpinButton => $::expert, changed => sub { $part->{start} = min($part->{start}, $max - $mb_size * 2048) } },
{ label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ],
sort => 0, if_($::expert, gtk => { wrap_width => 4 }) },
{ label => N("Mount point: "), val => \$part->{mntpoint}, list => [ fsedit::suggestions_mntpoint($all_hds), '' ],
@@ -769,8 +769,8 @@ sub Resize {
}
}
- my $mb_size = $part->{size} >> 11;
- my ($gmin, $gmax) = ($min >> 11, $max >> 11);
+ my $mb_size = to_Mb($part->{size});
+ my ($gmin, $gmax) = (to_Mb($min), to_Mb($max));
$in->ask_from(N("Resize"), '', [
{ label => N("Choose the new size"), title => 1 },
{ label => N("New size in MB: "), val => \$mb_size, min => $gmin, max => $gmax, type => 'range', SpinButton => $::expert },
@@ -941,10 +941,10 @@ sub Loopback {
delete $part->{mntpoint}; # we do not want the suggested mntpoint
my $type_name = fs::type::part2type_name($part);
- my $mb_size = $part->{size} >> 11;
+ my $mb_size = to_Mb($part->{size});
$in->ask_from(N("Loopback"), '', [
{ label => N("Loopback file name: "), val => \$part->{loopback_file} },
- { label => N("Size in MB: "), val => \$mb_size, min => $min >> 11, max => $max >> 11, type => 'range', SpinButton => $::expert },
+ { label => N("Size in MB: "), val => \$mb_size, min => to_Mb($min), max => to_Mb($max), type => 'range', SpinButton => $::expert },
{ label => N("Filesystem type: "), val => \$type_name, list => [ fs::type::type_names($::expert) ], not_edit => !$::expert, sort => 0 },
],
complete => sub {
@@ -1227,11 +1227,16 @@ sub warn_if_renumbered {
#- modified to take into account a true bounding with min and max.
sub from_Mb {
my ($mb, $min, $max) = @_;
- $mb <= $min >> 11 and return $min;
- $mb >= $max >> 11 and return $max;
+ $mb <= to_Mb($min) and return $min;
+ $mb >= to_Mb($max) and return $max;
$mb * 2048;
}
+sub to_Mb {
+ my ($size_sector) = @_;
+ to_int($size_sector / 2048);
+}
+
sub format_part_info {
my ($hd, $part) = @_;
diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm
index d833f5b26..a14cae697 100644
--- a/perl-install/fs/partitioning_wizard.pm
+++ b/perl-install/fs/partitioning_wizard.pm
@@ -18,10 +18,14 @@ use partition_table::raw;
#- modified to take into account a true bounding with min and max.
sub from_Mb {
my ($mb, $min, $max) = @_;
- $mb <= $min >> 11 and return $min;
- $mb >= $max >> 11 and return $max;
+ $mb <= to_Mb($min) and return $min;
+ $mb >= to_Mb($max) and return $max;
$mb * 2048;
}
+sub to_Mb {
+ my ($size_sector) = @_;
+ to_int($size_sector / 2048);
+}
sub partition_with_diskdrake {
my ($in, $all_hds, $fstab, $manual_fstab, $partitions, $partitioning_flags, $skip_mtab) = @_;
@@ -102,12 +106,12 @@ sub partitionWizardSolutions {
my $part = $in->ask_from_listf('', N("Which partition do you want to use for Linux4Win?"), \&partition_table::description, \@ok_forloopback) or return;
$max_swap = $min_swap + 1 if $part->{free} - $max_swap < $min_linux;
$in->ask_from('', N("Choose the sizes"), [
- { label => N("Root partition size in MB: "), val => \$s_root, min => $min_linux >> 11, max => min($part->{free} - $max_swap, $max_linux) >> 11, type => 'range' },
- { label => N("Swap partition size in MB: "), val => \$s_swap, min => $min_swap >> 11, max => $max_swap >> 11, type => 'range' },
+ { label => N("Root partition size in MB: "), val => \$s_root, min => to_Mb($min_linux), max => to_Mb(min($part->{free} - $max_swap, $max_linux)), type => 'range' },
+ { label => N("Swap partition size in MB: "), val => \$s_swap, min => to_Mb($min_swap), max => to_Mb($max_swap), type => 'range' },
]) or return;
push @{$part->{loopback}},
- { fs_type => 'ext3', loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => $s_root << 11, loopback_device => $part, notFormatted => 1 },
- { fs_type => 'swap', loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => $s_swap << 11, loopback_device => $part, notFormatted => 1 };
+ { fs_type => 'ext3', loopback_file => '/lnx4win/linuxsys.img', mntpoint => '/', size => $s_root * 2048, loopback_device => $part, notFormatted => 1 },
+ { fs_type => 'swap', loopback_file => '/lnx4win/swapfile', mntpoint => 'swap', size => $s_swap * 2048, loopback_device => $part, notFormatted => 1 };
fsedit::recompute_loopbacks($all_hds);
1;
} ];
@@ -159,9 +163,9 @@ Be careful: this operation is dangerous. If you have not already done so, you fi
When sure, press %s.", N("Next")))) or return;
- my $mb_size = $part->{size} >> 11;
+ my $mb_size = to_Mb($part->{size});
$in->ask_from('', N("Which size do you want to keep for Microsoft Windows® on partition %s?", partition_table::description($part)), [
- { label => N("Size"), val => \$mb_size, min => $min_win >> 11, max => ($part->{size} - $min_linux - $min_swap) >> 11, type => 'range' },
+ { label => N("Size"), val => \$mb_size, min => to_Mb($min_win), max => to_Mb($part->{size} - $min_linux - $min_swap), type => 'range' },
]) or return;
my $oldsize = $part->{size};
diff --git a/perl-install/install/NEWS b/perl-install/install/NEWS
index b68bfda0f..4c235a4b0 100644
--- a/perl-install/install/NEWS
+++ b/perl-install/install/NEWS
@@ -1,6 +1,7 @@
- add /etc/mke2fs.conf in order to format ext3fs with 4k blocks (#27377)
- diskdrake
o fix 1.9TB displayed as 1TB
+ o fix range max value >2TB when creating a partition (useful for LVs >2TB)
- fix detecting usb drives (#13395)
Version 10.4.128 - 3 April 2007, by Pascal "Pixel" Rigaux