Improved read label performance with blkid cached results
svn path=/trunk/; revision=963
This commit is contained in:
parent
67dd9f2c10
commit
5b8c16ba60
|
@ -1,3 +1,11 @@
|
|||
2008-11-13 Curtis Gedak <gedakc@gmail.com>
|
||||
|
||||
* include/FS_Info.h,
|
||||
src/FS_Info.cc,
|
||||
src/GParted_Core.cc,
|
||||
README: Improved read label performance with blkid cached results.
|
||||
- When possible use blkid cached results to determine volume label.
|
||||
|
||||
2008-11-12 Curtis Gedak <gedakc@gmail.com>
|
||||
|
||||
* README: Updated directories and dependencies.
|
||||
|
|
4
README
4
README
|
@ -121,4 +121,6 @@ Optional packages include:
|
|||
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.
|
||||
|
||||
|
|
|
@ -28,6 +28,7 @@ class FS_Info
|
|||
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() ;
|
||||
|
|
|
@ -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 @@ void FS_Info::load_fs_info_cache()
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
|
@ -736,9 +736,13 @@ void GParted_Core::set_device_partitions( Device & device )
|
|||
}
|
||||
|
||||
//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() ) ;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue