summaryrefslogtreecommitdiffstats
path: root/perl-install/resize_fat/any.pm
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-02-09 13:33:42 +0000
committerFrancois Pons <fpons@mandriva.com>2000-02-09 13:33:42 +0000
commit97acae38970adddb6f753cfce325532b94e2bd12 (patch)
tree625ea577e2a5a89345d854361f07b68601d4667a /perl-install/resize_fat/any.pm
parent8bc8305d2977416baaf3dbaa37a4dae4a911ea2f (diff)
downloaddrakx-97acae38970adddb6f753cfce325532b94e2bd12.tar
drakx-97acae38970adddb6f753cfce325532b94e2bd12.tar.gz
drakx-97acae38970adddb6f753cfce325532b94e2bd12.tar.bz2
drakx-97acae38970adddb6f753cfce325532b94e2bd12.tar.xz
drakx-97acae38970adddb6f753cfce325532b94e2bd12.zip
*** empty log message ***
Diffstat (limited to 'perl-install/resize_fat/any.pm')
-rw-r--r--perl-install/resize_fat/any.pm25
1 files changed, 16 insertions, 9 deletions
diff --git a/perl-install/resize_fat/any.pm b/perl-install/resize_fat/any.pm
index 47f15558b..63f154008 100644
--- a/perl-install/resize_fat/any.pm
+++ b/perl-install/resize_fat/any.pm
@@ -38,7 +38,7 @@ sub last_used($) {
#- count in negative so absolute value count back to 2.
foreach (-($fs->{nb_clusters}+1)..-2) { return -$_ if resize_fat::c_rewritten::flag(-$_) }
- return 2;
+ die "any: empty FAT table";
}
#- patch to get the function last_unmoveable that return the last unmoveable cluster of a fs.
sub last_unmoveable($) {
@@ -46,7 +46,7 @@ sub last_unmoveable($) {
#- count in negative so absolute value count back to 2.
foreach (-($fs->{nb_clusters}+1)..-2) { return -$_ if 0x8 & resize_fat::c_rewritten::flag(-$_) }
- return 2;
+ die "any: empty FAT table";
}
#- calculates the minimum size of a partition, in physical sectors
@@ -58,10 +58,18 @@ sub min_size($) {
#- It's done on purpose since we're moving all directories. So at the worse
#- moment, 2 directories are there, but that way nothing wrong can happen :)
my $min_cluster_count = max(2 + $count->{used} + $count->{bad} + $count->{dirs}, min_cluster_count($fs));
- $min_cluster_count = max($min_cluster_count, 2 + last_unmoveable($fs));
+ $min_cluster_count = max($min_cluster_count, last_unmoveable($fs));
+
+ my $size = $min_cluster_count * divide($fs->{cluster_size}, $SECTORSIZE) +
+ divide($fs->{cluster_offset}, $SECTORSIZE) +
+ 64*1024*1024 / $SECTORSIZE; #- help with such more sectors (ie 64Mb).
+
+ #- help zindozs again with 512Mb+ at least else partition is ignored.
+ if ($resize_fat::isFAT32) {
+ $size = max($size, 524*1024*1024 / $SECTORSIZE);
+ }
+ $size;
- $min_cluster_count * divide($fs->{cluster_size}, $SECTORSIZE) +
- divide($fs->{cluster_offset}, $SECTORSIZE);
}
#- calculates the maximum size of a partition, in physical sectors
sub max_size($) {
@@ -76,7 +84,7 @@ sub max_size($) {
sub used_size($) {
my ($fs) = @_;
- my $used_cluster_count = max(2 + last_used($fs), min_cluster_count($fs));
+ my $used_cluster_count = max(last_used($fs), min_cluster_count($fs));
$used_cluster_count * divide($fs->{cluster_size}, $SECTORSIZE) +
divide($fs->{cluster_offset}, $SECTORSIZE);
@@ -103,10 +111,9 @@ sub flag_clusters {
$nb_dirs += $nb if $type == $DIRECTORY;
0;
};
- resize_fat::c_rewritten::allocate_fat_flag($fs->{nb_clusters} + 2);
- #- patch to reset contents of memory allocated by allocate_fat_flag
- foreach (0..$fs->{nb_clusters} + 1) { resize_fat::c_rewritten::set_flag($_, 0) }
+ #- this must call allocate_fat_flag that zeroes the buffer allocated.
+ resize_fat::c_rewritten::allocate_fat_flag($fs->{nb_clusters} + 2);
resize_fat::directory::traverse_all($fs, $f);
$fs->{clusters}{count}{dirs} = $nb_dirs;