Make flush OS cache a reported step (#688882)

As failure of flushing the cache can lead to misidentification of file
systems make it a checked step in the displayed operation details.

Bug #688882 - Improve clearing of file system signatures
This commit is contained in:
Mike Fleetwood 2013-03-02 11:23:06 +00:00 committed by Curtis Gedak
parent b2b51ad424
commit 0b164b168d
1 changed files with 13 additions and 3 deletions

View File

@ -3239,11 +3239,21 @@ bool GParted_Core::erase_filesystem_signatures( const Partition & partition, Ope
// Opening the device and calling ped_device_sync() took 0.15 seconds or less on
// a 5400 RPM laptop hard drive. For now just always call ped_device_sync() as
// it doesn't add much time to the overall operation.
if ( overall_success )
{
OperationDetail & od = operationdetail .get_last_child() ;
od .add_child( OperationDetail( String::ucompose( _("flush operating system cache of %1"),
lp_device ->path ) ) ) ;
bool flush_success = false ;
if ( device_is_open )
{
ped_device_sync( lp_device ) ;
flush_success = ped_device_sync( lp_device ) ;
ped_device_close( lp_device ) ;
}
od .get_last_child() .set_status( flush_success ? STATUS_SUCCES : STATUS_ERROR ) ;
overall_success &= flush_success ;
}
close_device_and_disk( lp_device, lp_disk ) ;
operationdetail .get_last_child() .set_status( overall_success ? STATUS_SUCCES : STATUS_ERROR ) ;