[gparted] Remember result of searching the PATH for udevadm and udevsettle cmds
- From: Curtis Gedak <gedakc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gparted] Remember result of searching the PATH for udevadm and udevsettle cmds
- Date: Wed, 1 Jul 2015 20:37:06 +0000 (UTC)
commit 038209a9cf0f08915d2c30271a1e5e3ac8198a84
Author: Mike Fleetwood <mike fleetwood googlemail com>
Date: Tue Jun 30 18:48:39 2015 +0100
Remember result of searching the PATH for udevadm and udevsettle cmds
GParted was also searching the PATH for the availability of the udevadm
and udevsettle commands for every device with a busy partition during a
refresh and for every applied operation effecting a partition table. As
with hdparm previously this was wasteful.
Again, remember the result of searching the PATH at startup and refresh
when clicking on the [Rescan For Supported Actions] button in the File
System Support dialog.
src/GParted_Core.cc | 8 ++++++--
1 files changed, 6 insertions(+), 2 deletions(-)
---
diff --git a/src/GParted_Core.cc b/src/GParted_Core.cc
index a1c0456..e0ba987 100644
--- a/src/GParted_Core.cc
+++ b/src/GParted_Core.cc
@@ -75,6 +75,8 @@ namespace GParted
static std::map< Glib::ustring, std::vector<Glib::ustring> > mount_info ;
static std::map< Glib::ustring, std::vector<Glib::ustring> > fstab_info ;
+static bool udevadm_found = false;
+static bool udevsettle_found = false;
static bool hdparm_found = false;
GParted_Core::GParted_Core()
@@ -105,6 +107,8 @@ GParted_Core::GParted_Core()
void GParted_Core::find_supported_core()
{
+ udevadm_found = ! Glib::find_program_in_path( "udevadm" ).empty();
+ udevsettle_found = ! Glib::find_program_in_path( "udevsettle" ).empty();
hdparm_found = ! Glib::find_program_in_path( "hdparm" ).empty();
}
@@ -3967,9 +3971,9 @@ bool GParted_Core::commit_to_os( PedDisk* lp_disk, std::time_t timeout )
void GParted_Core::settle_device( std::time_t timeout )
{
- if ( ! Glib::find_program_in_path( "udevsettle" ) .empty() )
+ if ( udevsettle_found )
Utils::execute_command( "udevsettle --timeout=" + Utils::num_to_str( timeout ) ) ;
- else if ( ! Glib::find_program_in_path( "udevadm" ) .empty() )
+ else if ( udevadm_found )
Utils::execute_command( "udevadm settle --timeout=" + Utils::num_to_str( timeout ) ) ;
else
sleep( timeout ) ;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]