[gparted] Make flush OS cache a reported step (#688882)



commit 0b164b168d28b63fb8dc6fcee4e16b1b6b2552c4
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date:   Sat Mar 2 11:23:06 2013 +0000

    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

 src/GParted_Core.cc |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index a3c145f..6e1c758 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -3239,10 +3239,20 @@ 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 ( device_is_open )
+       if ( overall_success )
        {
-               ped_device_sync( lp_device ) ;
-               ped_device_close( lp_device ) ;
+               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 )
+               {
+                       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 ) ;
 


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]