gparted r963 - in trunk: . include src
- From: gedakc svn gnome org
- To: svn-commits-list gnome org
- Subject: gparted r963 - in trunk: . include src
- Date: Thu, 13 Nov 2008 20:06:19 +0000 (UTC)
Author: gedakc
Date: Thu Nov 13 20:06:18 2008
New Revision: 963
URL: http://svn.gnome.org/viewvc/gparted?rev=963&view=rev
Log:
Improved read label performance with blkid cached results
Modified:
trunk/ChangeLog
trunk/README
trunk/include/FS_Info.h
trunk/src/FS_Info.cc
trunk/src/GParted_Core.cc
Modified: trunk/README
==============================================================================
--- trunk/README (original)
+++ trunk/README Thu Nov 13 20:06:18 2008
@@ -121,4 +121,6 @@
to read linux-swap, reiser4, hfs, and hfs+ file system
volume labels.
* If the blkid command is in the search path, it will be used
- to read file system UUIDs.
+ to read file system UUIDs and labels.
+ blkid is part of the e2fsprogs package.
+
Modified: trunk/include/FS_Info.h
==============================================================================
--- trunk/include/FS_Info.h (original)
+++ trunk/include/FS_Info.h Thu Nov 13 20:06:18 2008
@@ -28,6 +28,7 @@
public:
FS_Info() ;
~FS_Info() ;
+ Glib::ustring get_label( const Glib::ustring & path, bool & found ) ;
Glib::ustring get_uuid( const Glib::ustring & path ) ;
private:
void load_fs_info_cache() ;
Modified: trunk/src/FS_Info.cc
==============================================================================
--- trunk/src/FS_Info.cc (original)
+++ trunk/src/FS_Info.cc Thu Nov 13 20:06:18 2008
@@ -14,7 +14,7 @@
* along with this program; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-
+
#include "../include/FS_Info.h"
namespace GParted
@@ -41,6 +41,24 @@
}
}
+Glib::ustring FS_Info::get_label( const Glib::ustring & path, bool & found )
+{
+ Glib::ustring label = "" ;
+ found = false ;
+
+ //Retrieve the line containing the device path
+ Glib::ustring regexp = "^" + path + ":([^\n]*)$" ;
+ Glib::ustring temp = Utils::regexp_label( fs_info_cache, regexp ) ;
+
+ //Set indicator if LABEL found
+ if ( Utils::regexp_label( temp, "(LABEL=\")") != "" )
+ found = true ;
+
+ //Retrieve LABEL
+ label = Utils::regexp_label( temp, "LABEL=\"([^\"]*)\"" ) ;
+ return label ;
+}
+
Glib::ustring FS_Info::get_uuid( const Glib::ustring & path )
{
//Retrieve the line containing the device path
Modified: trunk/src/GParted_Core.cc
==============================================================================
--- trunk/src/GParted_Core.cc (original)
+++ trunk/src/GParted_Core.cc Thu Nov 13 20:06:18 2008
@@ -736,9 +736,13 @@
}
//Avoid reading additional file system information if there is no path
- //FIXME: Why is there an empty path for the first primary partition, and an empty path for each logical partition?
- if ( partition_temp .get_path() != "" ) {
- read_label( partition_temp ) ;
+ if ( partition_temp .get_path() != "" )
+ {
+ bool label_found = false ;
+ partition_temp .label = fs_info .get_label( partition_temp .get_path(), label_found ) ;
+ if ( ! label_found )
+ read_label( partition_temp ) ;
+
partition_temp .uuid = fs_info .get_uuid( partition_temp .get_path() ) ;
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]