Overload is_dev_mounted() function (#767842)
Small optimisation which avoids constructing an extra BlockSpecial object when determining if a btrfs member is mounted. Rather than extracting the name from the BlockSpecial object in btrfs::get_mount_device() and re-constructing another BlockSpecial object from that name in GParted_Core::is_dev_mounted(), pass the BlockSpecial object directly. Bug 767842 - File system usage missing when tools report alternate block device names
This commit is contained in:
parent
abee66484f
commit
e4a8530b14
|
@ -61,6 +61,7 @@ public:
|
|||
const FS & get_fs( GParted::FILESYSTEM filesystem ) const ;
|
||||
static std::vector<Glib::ustring> get_disklabeltypes() ;
|
||||
static bool is_dev_mounted( const Glib::ustring & path ) ;
|
||||
static bool is_dev_mounted( const BlockSpecial & bs );
|
||||
static std::vector<Glib::ustring> get_all_mountpoints() ;
|
||||
std::map<Glib::ustring, bool> get_available_flags( const Partition & partition ) ;
|
||||
Glib::ustring get_libparted_version() ;
|
||||
|
|
|
@ -970,8 +970,14 @@ std::vector<Glib::ustring> GParted_Core::get_disklabeltypes()
|
|||
//Return whether the device path, such as /dev/sda3, is mounted or not
|
||||
bool GParted_Core::is_dev_mounted( const Glib::ustring & path )
|
||||
{
|
||||
MountMapping::iterator iter_mp = mount_info.find( BlockSpecial( path ) );
|
||||
return iter_mp != mount_info .end() ;
|
||||
return is_dev_mounted( BlockSpecial( path ) );
|
||||
}
|
||||
|
||||
// Return whether the BlockSpecial object, such as {"/dev/sda3", 8, 3}, is mounted or not
|
||||
bool GParted_Core::is_dev_mounted( const BlockSpecial & bs )
|
||||
{
|
||||
MountMapping::const_iterator iter_mp = mount_info.find( bs );
|
||||
return iter_mp != mount_info.end();
|
||||
}
|
||||
|
||||
std::vector<Glib::ustring> GParted_Core::get_all_mountpoints()
|
||||
|
|
|
@ -462,7 +462,7 @@ Glib::ustring btrfs::get_mount_device( const Glib::ustring & path )
|
|||
}
|
||||
|
||||
for ( unsigned int i = 0 ; i < btrfs_dev .members .size() ; i ++ )
|
||||
if ( GParted_Core::is_dev_mounted( btrfs_dev.members[i].m_name ) )
|
||||
if ( GParted_Core::is_dev_mounted( btrfs_dev.members[i] ) )
|
||||
return btrfs_dev.members[i].m_name;
|
||||
return "" ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue