fixed some issues with combi move+shrink on fat* and hfs* filesystems.

* include/GParted_Core.h,
  src/GParted_Core.cc: fixed some issues with combi move+shrink on
  fat* and hfs* filesystems.
  Also call wait_for_node() from commit() if 'node' was provided.
This commit is contained in:
Bart Hakvoort 2006-08-20 11:47:17 +00:00
parent 1234b248d5
commit 649f26be9f
3 changed files with 29 additions and 34 deletions

View File

@ -1,6 +1,13 @@
2006-08-20 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-08-20 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/Dialog_Partition_Resize_Move.cc: due to some restrictions it as * include/GParted_Core.h,
src/GParted_Core.cc: fixed some issues with combi move+shrink on
fat* and hfs* filesystems.
Also call wait_for_node() from commit() if 'node' was provided.
2006-08-20 Bart Hakvoort <hakvoort@cvs.gnome.org>
* src/Dialog_Partition_Resize_Move.cc: due to some restrictions it was
no longer possible to shrink swap filesystems. fixed. no longer possible to shrink swap filesystems. fixed.
2006-08-20 Bart Hakvoort <hakvoort@cvs.gnome.org> 2006-08-20 Bart Hakvoort <hakvoort@cvs.gnome.org>

View File

@ -162,7 +162,7 @@ private:
bool open_device_and_disk( const Glib::ustring & device_path, bool strict = true ) ; bool open_device_and_disk( const Glib::ustring & device_path, bool strict = true ) ;
void close_disk() ; void close_disk() ;
void close_device_and_disk() ; void close_device_and_disk() ;
bool commit() ; bool commit( const Glib::ustring & node = "" ) ;
static PedExceptionOption ped_exception_handler( PedException * e ) ; static PedExceptionOption ped_exception_handler( PedException * e ) ;

View File

@ -972,7 +972,7 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
{ {
if ( min_size > 0 ) if ( min_size > 0 )
constraint ->min_size = min_size ; constraint ->min_size = min_size ;
if ( ped_disk_add_partition( lp_disk, lp_partition, constraint ) && commit() ) if ( ped_disk_add_partition( lp_disk, lp_partition, constraint ) && commit() )
{ {
//we have to free the result of ped_partition_get_path().. //we have to free the result of ped_partition_get_path()..
@ -1002,25 +1002,16 @@ bool GParted_Core::create_partition( Partition & new_partition, OperationDetail
close_device_and_disk() ; close_device_and_disk() ;
} }
if ( new_partition .partition_number > 0 && if ( new_partition .partition_number > 0 &&
( erase_filesystem_signatures( new_partition ) &&
new_partition .type == GParted::TYPE_EXTENDED || ( new_partition .type == GParted::TYPE_EXTENDED || wait_for_node( new_partition .get_path() ) ) )
(
wait_for_node( new_partition .get_path() ) &&
erase_filesystem_signatures( new_partition )
)
)
)
{ {
operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ; operationdetail .get_last_child() .set_status( STATUS_SUCCES ) ;
return true ; return true ;
} }
else else
{ {
operationdetail .get_last_child() .set_status( STATUS_ERROR ) ; operationdetail .get_last_child() .set_status( STATUS_ERROR ) ;
return false ; return false ;
} }
} }
@ -1071,7 +1062,6 @@ bool GParted_Core::Delete( const Partition & partition, OperationDetail & operat
lp_partition = ped_disk_get_partition_by_sector( lp_disk, partition .get_sector() ) ; lp_partition = ped_disk_get_partition_by_sector( lp_disk, partition .get_sector() ) ;
return_value = ped_disk_delete_partition( lp_disk, lp_partition ) && commit() ; return_value = ped_disk_delete_partition( lp_disk, lp_partition ) && commit() ;
sleep( 1 ) ; //give the kernel some time to reread the partitiontable
close_device_and_disk() ; close_device_and_disk() ;
} }
@ -1223,8 +1213,9 @@ bool GParted_Core::resize_move_filesystem_using_libparted( const Partition & par
partition_new .sector_start, partition_new .sector_start,
partition_new .get_length() ) ; partition_new .get_length() ) ;
if ( lp_geom ) if ( lp_geom )
return_value = ped_file_system_resize( fs, lp_geom, NULL ) && commit() ; return_value = ped_file_system_resize( fs, lp_geom, NULL ) &&
commit( partition_new .get_path() ) ;
ped_file_system_close( fs ); ped_file_system_close( fs );
} }
} }
@ -1386,7 +1377,8 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
new_start = lp_partition ->geom .start ; new_start = lp_partition ->geom .start ;
new_end = lp_partition ->geom .end ; new_end = lp_partition ->geom .end ;
return_value = commit() ; return_value = commit( partition_new .type == TYPE_EXTENDED ?
"" : partition_new .get_path() ) ;
} }
ped_constraint_destroy( constraint ); ped_constraint_destroy( constraint );
@ -1409,18 +1401,9 @@ bool GParted_Core::resize_move_partition( const Partition & partition_old,
FONT_ITALIC ) ) ; FONT_ITALIC ) ) ;
} }
if ( partition_old .type == GParted::TYPE_EXTENDED ) operationdetail .get_last_child() .set_status( return_value ? STATUS_SUCCES : STATUS_ERROR ) ;
{
operationdetail .get_last_child() .set_status( return_value ? STATUS_SUCCES : STATUS_ERROR ) ; return return_value ;
return return_value ;
}
else
{
return_value &= wait_for_node( partition_new .get_path() ) ;
operationdetail .get_last_child() .set_status( return_value ? STATUS_SUCCES : STATUS_ERROR ) ;
return return_value ;
}
} }
bool GParted_Core::resize_filesystem( const Partition & partition_old, bool GParted_Core::resize_filesystem( const Partition & partition_old,
@ -1624,7 +1607,9 @@ bool GParted_Core::set_partition_type( const Partition & partition, OperationDet
{ {
lp_partition = ped_disk_get_partition_by_sector( lp_disk, partition .get_sector() ) ; lp_partition = ped_disk_get_partition_by_sector( lp_disk, partition .get_sector() ) ;
if ( lp_partition && ped_partition_set_system( lp_partition, fs_type ) && commit() ) if ( lp_partition &&
ped_partition_set_system( lp_partition, fs_type ) &&
commit( partition .get_path() ) )
{ {
operationdetail .get_last_child() .add_child( operationdetail .get_last_child() .add_child(
OperationDetail( String::ucompose( _("new partitiontype: %1"), OperationDetail( String::ucompose( _("new partitiontype: %1"),
@ -1632,7 +1617,7 @@ bool GParted_Core::set_partition_type( const Partition & partition, OperationDet
STATUS_NONE, STATUS_NONE,
FONT_ITALIC ) ) ; FONT_ITALIC ) ) ;
return_value = wait_for_node( partition .get_path() ) ; return_value = true ;
} }
} }
@ -2100,12 +2085,15 @@ void GParted_Core::close_device_and_disk()
lp_device = NULL ; lp_device = NULL ;
} }
bool GParted_Core::commit() bool GParted_Core::commit( const Glib::ustring & node )
{ {
bool return_value = ped_disk_commit_to_dev( lp_disk ) ; bool return_value = ped_disk_commit_to_dev( lp_disk ) ;
ped_disk_commit_to_os( lp_disk ) ; ped_disk_commit_to_os( lp_disk ) ;
if ( ! node .empty() && return_value )
return_value = wait_for_node( node ) ;
return return_value ; return return_value ;
} }