[gparted] Add symbolic constants SETTLE_DEVICE_*_MAX_WAIT_SECONDS
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Add symbolic constants SETTLE_DEVICE_*_MAX_WAIT_SECONDS
- Date: Mon, 18 Apr 2016 20:26:27 +0000 (UTC)
commit 94979a3805b36e630a7f0e58343d282f3360fd2a
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Mon Apr 18 07:39:03 2016 +0100
Add symbolic constants SETTLE_DEVICE_*_MAX_WAIT_SECONDS
Make the code a little more self documenting by adding the symbolic
constants:
SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS
SETTLE_DEVICE_PROBE_MAX_WAIT_SECONDS
which highlight that settle_device() is called in two different
contexts, device probe and apply operations, with two different timeout
values.
src/GParted_Core.cc | 13 ++++++++-----
1 files changed, 8 insertions(+), 5 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index 2abc7df..ed43fa3 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -66,6 +66,9 @@ std::vector<Glib::ustring> libparted_messages ; //see ped_exception_handler()
namespace GParted
{
+const std::time_t SETTLE_DEVICE_PROBE_MAX_WAIT_SECONDS = 1;
+const std::time_t SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS = 10;
+
//mount_info - Associative array mapping currently mounted devices to
// one or more mount points. E.g.
// mount_info["/dev/sda1"] -> ["/boot"]
@@ -201,7 +204,7 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
set_thread_status_message( String::ucompose ( _("Scanning %1"),
dmraid_devices[k] ) ) ;
#ifndef USE_LIBPARTED_DMRAID
dmraid .create_dev_map_entries( dmraid_devices[k] ) ;
- settle_device( 1 ) ;
+ settle_device( SETTLE_DEVICE_PROBE_MAX_WAIT_SECONDS );
#endif
ped_device_get( dmraid_devices[k] .c_str() ) ;
}
@@ -250,7 +253,7 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
dmraid .is_dmraid_device( device_paths[t] ) )
{
dmraid .create_dev_map_entries( dmraid .get_dmraid_name( device_paths [t] ) )
;
- settle_device( 1 );
+ settle_device( SETTLE_DEVICE_PROBE_MAX_WAIT_SECONDS );
}
#endif
@@ -326,7 +329,7 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
if ( temp_device .highest_busy )
{
- temp_device .readonly = ! commit_to_os( lp_disk, 1 ) ;
+ temp_device.readonly = ! commit_to_os( lp_disk,
SETTLE_DEVICE_PROBE_MAX_WAIT_SECONDS );
//Clear libparted messages. Typically these are:
// The kernel was unable to re-read the partition table...
libparted_messages .clear() ;
@@ -3525,7 +3528,7 @@ bool GParted_Core::calibrate_partition( Partition & partition, OperationDetail &
// remove and re-add all the partition specific /dev/ entries. Wait for
// this to complete to avoid FS specific commands failing because they
// happen to run just when the needed /dev/PTN entry doesn't exist.
- settle_device( 10 );
+ settle_device( SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS );
operationdetail.get_last_child().set_status( success ? STATUS_SUCCES : STATUS_ERROR );
return success;
@@ -4129,7 +4132,7 @@ bool GParted_Core::commit( PedDisk* lp_disk )
{
bool succes = ped_disk_commit_to_dev( lp_disk ) ;
- succes = commit_to_os( lp_disk, 10 ) && succes ;
+ succes = commit_to_os( lp_disk, SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS ) && succes;
return succes ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]