finalized the order of operations when performing a move.

* src/GParted_Core.cc: finalized the order of operations when
  performing a move.
This commit is contained in:
Bart Hakvoort 2006-06-20 20:17:32 +00:00
parent 126658e3dc
commit 90e1af5bfe
2 changed files with 20 additions and 11 deletions

View File

@ -1,3 +1,8 @@
2006-06-20 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: finalized the order of operations when
performing a move.
2006-06-18 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-06-18 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/GParted_Core.cc: use new copy_block() in copy_filesystem() * src/GParted_Core.cc: use new copy_block() in copy_filesystem()

View File

@ -1031,21 +1031,22 @@ bool GParted_Core::move( const Device & device,
Partition & partition_new, Partition & partition_new,
std::vector<OperationDetails> & operation_details ) std::vector<OperationDetails> & operation_details )
{ {
//FIXME: look very carefully at this function and see where things (like checking and fsmaximizing) are
//missing. //missing.
if ( partition_new .get_length() > partition_old .get_length() ) if ( partition_new .get_length() > partition_old .get_length() )
{ {
//first do the move //first do the move
Partition temp = partition_new ; Partition temp = partition_new ;
temp .sector_end = partition_new .sector_start + partition_old .get_length() ; temp .sector_end = partition_new .sector_start + partition_old .get_length() ;
if ( move_filesystem( partition_old, temp, operation_details ) ) if ( check_repair( partition_old, operation_details ) &&
move_filesystem( partition_old, temp, operation_details ) )
{ {
//now move the partition //now move the partition
if ( resize_move_partition( partition_old, if ( check_repair( temp, operation_details ) &&
temp, resize_move_partition( partition_old,
false, temp,
operation_details, false,
temp .get_length() ) ) operation_details,
temp .get_length() ) )
{ {
//now the partition and the filesystem are moved, we can grow it.. //now the partition and the filesystem are moved, we can grow it..
partition_new .sector_start = temp .sector_start ; partition_new .sector_start = temp .sector_start ;
@ -1069,18 +1070,21 @@ bool GParted_Core::move( const Device & device,
partition_new, partition_new,
false, false,
operation_details, operation_details,
partition_new .get_length() ) ; partition_new .get_length() ) &&
check_repair( partition_new, operation_details ) ;
} }
return false ; return false ;
} }
else else
return move_filesystem( partition_old, partition_new, operation_details ) && return check_repair( partition_old, operation_details ) &&
move_filesystem( partition_old, partition_new, operation_details ) &&
resize_move_partition( partition_old, resize_move_partition( partition_old,
partition_new, partition_new,
false, false,
operation_details, operation_details,
partition_new .get_length() ) ; partition_new .get_length() ) &&
check_repair( partition_new, operation_details ) ;
} }
bool GParted_Core::move_filesystem( const Partition & partition_old, bool GParted_Core::move_filesystem( const Partition & partition_old,
@ -1132,7 +1136,7 @@ bool GParted_Core::move_filesystem( const Partition & partition_old,
} }
//we don't need disk anymore.. //we don't need disk anymore..
close_disk() ; close_disk() ;
//FIXME: only move is startsectors are different from each other...
//do the move.. //do the move..
Sector blocksize = 32 ;//FIXME: write an algorithm to determine the optimal blocksize Sector blocksize = 32 ;//FIXME: write an algorithm to determine the optimal blocksize
Glib::ustring error_message ; Glib::ustring error_message ;