summaryrefslogtreecommitdiffstats
path: root/perl-install/fs
diff options
context:
space:
mode:
Diffstat (limited to 'perl-install/fs')
-rw-r--r--perl-install/fs/partitioning_wizard.pm32
-rw-r--r--perl-install/fs/type.pm4
2 files changed, 20 insertions, 16 deletions
diff --git a/perl-install/fs/partitioning_wizard.pm b/perl-install/fs/partitioning_wizard.pm
index d833f5b26..4aff222c7 100644
--- a/perl-install/fs/partitioning_wizard.pm
+++ b/perl-install/fs/partitioning_wizard.pm
@@ -18,9 +18,13 @@ 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 * 2048;
+ $mb <= to_Mb($min) and return $min;
+ $mb >= to_Mb($max) and return $max;
+ MB($mb);
+}
+sub to_Mb {
+ my ($size_sector) = @_;
+ to_int($size_sector / 2048);
}
sub partition_with_diskdrake {
@@ -66,11 +70,11 @@ sub partitionWizardSolutions {
my @wizlog;
my (%solutions);
- my $min_linux = 400 << 11;
- my $max_linux = 2000 << 11;
- my $min_swap = 50 << 11;
- my $max_swap = 300 << 11;
- my $min_freewin = 100 << 11;
+ my $min_linux = MB(400);
+ my $max_linux = MB(2000);
+ my $min_swap = MB(50);
+ my $max_swap = MB(300);
+ my $min_freewin = MB(100);
# each solution is a [ score, text, function ], where the function retunrs true if succeeded
@@ -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/fs/type.pm b/perl-install/fs/type.pm
index 2abb61918..63ef3e475 100644
--- a/perl-install/fs/type.pm
+++ b/perl-install/fs/type.pm
@@ -364,8 +364,8 @@ sub set_isFormatted {
#- do this before modifying $part->{fs_type}
sub check {
my ($fs_type, $_hd, $part) = @_;
- $fs_type eq "jfs" && $part->{size} < 16 << 11 and die N("You can not use JFS for partitions smaller than 16MB");
- $fs_type eq "reiserfs" && $part->{size} < 32 << 11 and die N("You can not use ReiserFS for partitions smaller than 32MB");
+ $fs_type eq "jfs" && $part->{size} < MB(16) and die N("You can not use JFS for partitions smaller than 16MB");
+ $fs_type eq "reiserfs" && $part->{size} < MB(32) and die N("You can not use ReiserFS for partitions smaller than 32MB");
}
sub guessed_by_mount() {