diff options
Diffstat (limited to 'perl-install/resize_fat/main.pm')
| -rw-r--r-- | perl-install/resize_fat/main.pm | 43 |
1 files changed, 12 insertions, 31 deletions
diff --git a/perl-install/resize_fat/main.pm b/perl-install/resize_fat/main.pm index dc1a65e65..681aec756 100644 --- a/perl-install/resize_fat/main.pm +++ b/perl-install/resize_fat/main.pm @@ -1,31 +1,12 @@ -#!/usr/bin/perl - -# DiskDrake -# Copyright (C) 1999 MandrakeSoft (pixel@linux-mandrake.com) -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2, or (at your option) -# any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. +package resize_fat::main; # This is mainly a perl rewrite of the work of Andrew Clausen (libresize) -package resize_fat::main; # $Id$ - use diagnostics; use strict; use log; -use common qw(:common :system :constant); +use common; use resize_fat::boot_sector; use resize_fat::info_sector; use resize_fat::directory; @@ -39,7 +20,7 @@ use resize_fat::any; #- - reads in the boot sector/partition info., and tries to make some sense of it sub new($$$) { my ($type, $device, $fs_name) = @_; - my $fs = { device => $device, fs_name => $fs_name } ; + my $fs = { device => $device, fs_name => $fs_name }; eval { resize_fat::io::open($fs); @@ -63,7 +44,7 @@ sub DESTROY { #- copy all clusters >= <start_cluster> to a new place on the partition, less #- than <start_cluster>. Only copies files, not directories. -#- (use of buffer needed because the seeks slow like hell the hard drive) +#- (use of buffer needed because the seeks slow like hell the hard disk drive) sub copy_clusters { my ($fs, $cluster) = @_; my @buffer; @@ -89,7 +70,7 @@ sub construct_dir_tree { if ($resize_fat::isFAT32) { #- fat32's root must remain in the first 64k clusters - #- so don't set it as DIRECTORY, it will be specially handled + #- so do not set it as DIRECTORY, it will be specially handled resize_fat::c_rewritten::set_flag($fs->{fat32_root_dir_cluster}, $resize_fat::any::FREE); } @@ -101,7 +82,7 @@ sub construct_dir_tree { resize_fat::directory::remap($fs, resize_fat::io::read_cluster($fs, $cluster))); } - sync(); + MDK::Common::System::sync(); #- until now, only free clusters have been written. it's a null operation if we stop here. #- it means no corruption :) @@ -139,13 +120,13 @@ sub resize { $size >= $min or die "Minimum filesystem size is $min sectors"; $size <= $max or die "Maximum filesystem size is $max sectors"; - log::l("resize_fat: Partition size will be ". ($size * $SECTORSIZE >> 20) ."Mb (well exactly ${size} sectors)"); + log::l("resize_fat: Partition size will be " . (($size * $SECTORSIZE) >> 20) . "Mb (well exactly ${size} sectors)"); my $new_data_size = $size * $SECTORSIZE - $fs->{cluster_offset}; my $new_nb_clusters = divide($new_data_size, $fs->{cluster_size}); my $used_size = used_size($fs); - log::l("resize_fat: Break point for moving files is ". ($used_size * $SECTORSIZE >> 20) ." Mb ($used_size sectors)"); + log::l("resize_fat: Break point for moving files is " . (($used_size * $SECTORSIZE) >> 20) . " Mb ($used_size sectors)"); if ($size < $used_size) { log::l("resize_fat: Allocating new clusters"); resize_fat::fat::allocate_remap($fs, $new_nb_clusters); @@ -165,8 +146,8 @@ sub resize { $fs->{nb_sectors} = $size; $fs->{nb_clusters} = $new_nb_clusters; - $fs->{clusters}{count}->{free} = - $fs->{nb_clusters} - $fs->{clusters}{count}->{used} - $fs->{clusters}->{count}->{bad} - 2; + $fs->{clusters}{count}{free} = + $fs->{nb_clusters} - $fs->{clusters}{count}{used} - $fs->{clusters}{count}{bad} - 2; $fs->{system_id} = 'was here!'; $fs->{small_nb_sectors} = 0; @@ -176,9 +157,9 @@ sub resize { resize_fat::boot_sector::write($fs); - $resize_fat::isFAT32 and eval { resize_fat::info_sector::write($fs) }; #- doesn't matter if this fails - its pretty useless! + $resize_fat::isFAT32 and eval { resize_fat::info_sector::write($fs) }; #- does not matter if this fails - its pretty useless! - sync(); + MDK::Common::System::sync(); close $fs->{fd}; log::l("resize_fat: done"); } |
