Split mount_info and fstab_info maps into separate Mount_Info module

The GParted_Core::mount_info and GParted_Core::fstab_info maps and the
methods that manipulate them are self-contained.  Therefore move them to
a separate Mount_Info module and reduce the size of the monster
GParted_Core slightly.
This commit is contained in:
Mike Fleetwood 2016-07-13 13:12:22 +01:00 committed by Curtis Gedak
parent 0785c5d7ef
commit 63ec73dfda
9 changed files with 308 additions and 208 deletions

View file

@ -60,9 +60,6 @@ public:
const std::vector<FS> & get_filesystems() const ;
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() ;
Glib::ustring get_thread_status_message() ;
@ -81,16 +78,7 @@ public:
private:
//detectionstuff..
static void init_maps() ;
void set_thread_status_message( Glib::ustring msg ) ;
static void read_mountpoints_from_file( const Glib::ustring & filename, MountMapping & map );
static void add_node_and_mountpoint( MountMapping & map,
Glib::ustring & node,
Glib::ustring & mountpoint ) ;
static void read_mountpoints_from_file_swaps( const Glib::ustring & filename,
MountMapping & map );
static bool have_rootfs_dev( MountMapping & map );
static void read_mountpoints_from_mount_command( MountMapping & map );
static Glib::ustring get_partition_path( PedPartition * lp_partition );
void set_device_serial_number( Device & device );
void set_device_partitions( Device & device, PedDevice* lp_device, PedDisk* lp_disk ) ;

View file

@ -26,6 +26,7 @@ EXTRA_DIST = \
HBoxOperations.h \
LVM2_PV_Info.h \
LUKS_Info.h \
Mount_Info.h \
Operation.h \
OperationChangeUUID.h \
OperationCheck.h \

62
include/Mount_Info.h Normal file
View file

@ -0,0 +1,62 @@
/* Copyright (C) 2016 Mike Fleetwood
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
/* Mount_Info
*
* Cache of mounted file systems from /proc/mounts and cache of
* configured mount points from /etc/fstab.
*/
#ifndef GPARTED_MOUNT_INFO_H
#define GPARTED_MOUNT_INFO_H
#include "../include/BlockSpecial.h"
#include <glibmm/ustring.h>
#include <map>
#include <vector>
namespace GParted
{
class Mount_Info
{
public:
typedef std::map<BlockSpecial, std::vector<Glib::ustring> > MountMapping;
static void load_cache();
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();
static const std::vector<Glib::ustring> & get_mounted_mountpoints( const Glib::ustring & path );
static const std::vector<Glib::ustring> & get_fstab_mountpoints( const Glib::ustring & path );
private:
static void read_mountpoints_from_file( const Glib::ustring & filename, MountMapping & map );
static void add_node_and_mountpoint( MountMapping & map,
Glib::ustring & node,
Glib::ustring & mountpoint );
static void read_mountpoints_from_file_swaps( const Glib::ustring & filename,
MountMapping & map );
static bool have_rootfs_dev( MountMapping & map );
static void read_mountpoints_from_mount_command( MountMapping & map );
static const std::vector<Glib::ustring> & find( const MountMapping & map, const Glib::ustring & path );
};
} //GParted
#endif /* GPARTED_MOUNT_INFO_H */

View file

@ -23,6 +23,7 @@ src/GParted_Core.cc
src/HBoxOperations.cc
src/LVM2_PV_Info.cc
src/LUKS_Info.cc
src/Mount_Info.cc
src/OperationChangeUUID.cc
src/OperationCopy.cc
src/OperationCheck.cc

View file

@ -22,6 +22,7 @@
#include "../include/FS_Info.h"
#include "../include/LVM2_PV_Info.h"
#include "../include/LUKS_Info.h"
#include "../include/Mount_Info.h"
#include "../include/Operation.h"
#include "../include/OperationCopy.h"
#include "../include/Partition.h"
@ -54,11 +55,9 @@
#include <cstring>
#include <sys/types.h>
#include <sys/stat.h>
#include <limits.h>
#include <stdlib.h>
#include <unistd.h>
#include <dirent.h>
#include <mntent.h>
#include <gtkmm/messagedialog.h>
#include <gtkmm/main.h>
@ -70,19 +69,6 @@ namespace GParted
const std::time_t SETTLE_DEVICE_PROBE_MAX_WAIT_SECONDS = 1;
const std::time_t SETTLE_DEVICE_APPLY_MAX_WAIT_SECONDS = 10;
// Associative array mapping currently mounted devices to one or more mount points.
// E.g.
// mount_info[BlockSpecial("/dev/sda1")] -> ["/boot"]
// mount_info[BlockSpecial("/dev/sda2")] -> [""] (swap)
// mount_info[BlockSpecial("/dev/sda3")] -> ["/"]
static GParted_Core::MountMapping mount_info;
// Associative array mapping configured devices to one or more mount points read from
// /etc/fstab. E.g.
// fstab_info[BlockSpecial("/dev/sda1")] -> ["/boot"]
// fstab_info[BlockSpecial("/dev/sda3")] -> ["/"]
static GParted_Core::MountMapping fstab_info;
static bool udevadm_found = false;
static bool udevsettle_found = false;
static bool hdparm_found = false;
@ -177,9 +163,8 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
btrfs::clear_cache(); // Cache incrementally loaded if and when needed
SWRaid_Info::load_cache();
LUKS_Info::clear_cache(); // Cache automatically loaded if and when needed
Mount_Info::load_cache();
init_maps() ;
//only probe if no devices were specified as arguments..
if ( probe_devices )
{
@ -400,7 +385,6 @@ void GParted_Core::set_devices_thread( std::vector<Device> * pdevices )
//clear leftover information...
//NOTE that we cannot clear mountinfo since it might be needed in get_all_mountpoints()
set_thread_status_message("") ;
fstab_info .clear() ;
g_idle_add( (GSourceFunc)_mainquit, NULL );
}
@ -971,30 +955,6 @@ std::vector<Glib::ustring> GParted_Core::get_disklabeltypes()
return disklabeltypes ;
}
//Return whether the device path, such as /dev/sda3, is mounted or not
bool GParted_Core::is_dev_mounted( const Glib::ustring & path )
{
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()
{
MountMapping::iterator iter_mp;
std::vector<Glib::ustring> mountpoints ;
for ( iter_mp = mount_info .begin() ; iter_mp != mount_info .end() ; ++iter_mp )
mountpoints .insert( mountpoints .end(), iter_mp ->second .begin(), iter_mp ->second .end() ) ;
return mountpoints ;
}
std::map<Glib::ustring, bool> GParted_Core::get_available_flags( const Partition & partition )
{
std::map<Glib::ustring, bool> flag_info ;
@ -1030,147 +990,6 @@ Glib::ustring GParted_Core::get_libparted_version()
//private functions...
void GParted_Core::init_maps()
{
mount_info .clear() ;
fstab_info .clear() ;
read_mountpoints_from_file( "/proc/mounts", mount_info ) ;
read_mountpoints_from_file_swaps( "/proc/swaps", mount_info ) ;
if ( ! have_rootfs_dev( mount_info ) )
//Old distributions only contain 'rootfs' and '/dev/root' device names for
// the / (root) file system in /proc/mounts with '/dev/root' being a
// block device rather than a symlink to the true device. This prevents
// identification, and therefore busy detection, of the device containing
// the / (root) file system. Used to read /etc/mtab to get the root file
// system device name, but this contains an out of date device name after
// the mounting device has been dynamically removed from a multi-device
// btrfs, thus identifying the wrong device as busy. Instead fall back
// to reading mounted file systems from the output of the mount command,
// but only when required.
read_mountpoints_from_mount_command( mount_info ) ;
read_mountpoints_from_file( "/etc/fstab", fstab_info ) ;
//sort the mount points and remove duplicates.. (no need to do this for fstab_info)
MountMapping::iterator iter_mp;
for ( iter_mp = mount_info .begin() ; iter_mp != mount_info .end() ; ++iter_mp )
{
std::sort( iter_mp ->second .begin(), iter_mp ->second .end() ) ;
iter_mp ->second .erase(
std::unique( iter_mp ->second .begin(), iter_mp ->second .end() ),
iter_mp ->second .end() ) ;
}
}
void GParted_Core::read_mountpoints_from_file( const Glib::ustring & filename, MountMapping & map )
{
FILE* fp = setmntent( filename .c_str(), "r" ) ;
if ( fp == NULL )
return ;
struct mntent* p = NULL ;
while ( (p = getmntent(fp)) != NULL )
{
Glib::ustring node = p->mnt_fsname ;
Glib::ustring mountpoint = p->mnt_dir ;
Glib::ustring uuid = Utils::regexp_label( node, "^UUID=(.*)" ) ;
if ( ! uuid .empty() )
node = FS_Info::get_path_by_uuid( uuid );
Glib::ustring label = Utils::regexp_label( node, "^LABEL=(.*)" ) ;
if ( ! label .empty() )
node = FS_Info::get_path_by_label( label );
if ( ! node .empty() )
add_node_and_mountpoint( map, node, mountpoint ) ;
}
endmntent( fp ) ;
}
void GParted_Core::add_node_and_mountpoint( MountMapping & map,
Glib::ustring & node,
Glib::ustring & mountpoint )
{
//Only add node path(s) if mount point exists
if ( file_test( mountpoint, Glib::FILE_TEST_EXISTS ) )
{
map[BlockSpecial( node )].push_back( mountpoint );
//If node is a symbolic link (e.g., /dev/root)
// then find real path and add entry too
if ( file_test( node, Glib::FILE_TEST_IS_SYMLINK ) )
{
char * rpath = realpath( node.c_str(), NULL );
if ( rpath != NULL )
{
map[BlockSpecial( rpath )].push_back( mountpoint );
free( rpath );
}
}
}
}
void GParted_Core::read_mountpoints_from_file_swaps( const Glib::ustring & filename,
MountMapping & map )
{
std::string line ;
std::string node ;
std::ifstream file( filename .c_str() ) ;
if ( file )
{
while ( getline( file, line ) )
{
node = Utils::regexp_label( line, "^(/[^ ]+)" ) ;
if ( node .size() > 0 )
map[BlockSpecial( node )].push_back( "" /* no mountpoint for swap */ );
}
file .close() ;
}
}
//Return true only if the map contains a device name for the / (root) file system other
// than 'rootfs' and '/dev/root'
bool GParted_Core::have_rootfs_dev( MountMapping & map )
{
MountMapping::iterator iter_mp;
for ( iter_mp = mount_info .begin() ; iter_mp != mount_info .end() ; iter_mp ++ )
{
if ( ! iter_mp ->second .empty() && iter_mp ->second[ 0 ] == "/" )
{
if ( iter_mp->first.m_name != "rootfs" && iter_mp->first.m_name != "/dev/root" )
return true ;
}
}
return false ;
}
void GParted_Core::read_mountpoints_from_mount_command( MountMapping & map )
{
Glib::ustring output ;
Glib::ustring error ;
if ( ! Utils::execute_command( "mount", output, error, true ) )
{
std::vector<Glib::ustring> lines ;
Utils::split( output, lines, "\n") ;
for ( unsigned int i = 0 ; i < lines .size() ; i ++ )
{
//Process line like "/dev/sda3 on / type ext4 (rw)"
Glib::ustring node = Utils::regexp_label( lines[ i ], "^([^[:blank:]]+) on " ) ;
Glib::ustring mountpoint = Utils::regexp_label( lines[ i ], "^[^[:blank:]]+ on ([^[:blank:]]+) " ) ;
if ( ! node .empty() )
add_node_and_mountpoint( map, node, mountpoint ) ;
}
}
}
Glib::ustring GParted_Core::get_partition_path( PedPartition * lp_partition )
{
char * lp_path; //we have to free the result of ped_partition_get_path()
@ -1873,10 +1692,7 @@ void GParted_Core::set_mountpoints( Partition & partition )
}
else // Not busy file system
{
MountMapping::iterator iter_mp;
iter_mp = fstab_info.find( BlockSpecial( partition.get_path() ) );
if ( iter_mp != fstab_info.end() )
partition.add_mountpoints( iter_mp->second );
partition.add_mountpoints( Mount_Info::get_fstab_mountpoints( partition.get_path() ) );
}
}
}
@ -1889,10 +1705,10 @@ bool GParted_Core::set_mountpoints_helper( Partition & partition, const Glib::us
else
search_path = path ;
MountMapping::iterator iter_mp = mount_info.find( BlockSpecial( search_path ) );
if ( iter_mp != mount_info .end() )
const std::vector<Glib::ustring> & mountpoints = Mount_Info::get_mounted_mountpoints( search_path );
if ( mountpoints.size() )
{
partition .add_mountpoints( iter_mp ->second ) ;
partition.add_mountpoints( mountpoints );
return true ;
}
@ -1911,7 +1727,7 @@ bool GParted_Core::is_busy( FILESYSTEM fstype, const Glib::ustring & path )
{
case FS::GPARTED:
//Search GParted internal mounted partitions map
busy = is_dev_mounted( path ) ;
busy = Mount_Info::is_dev_mounted( path );
break ;
case FS::EXTERNAL:
@ -1929,7 +1745,7 @@ bool GParted_Core::is_busy( FILESYSTEM fstype, const Glib::ustring & path )
{
//Still search GParted internal mounted partitions map in case an
// unknown file system is mounted
busy = is_dev_mounted( path ) ;
busy = Mount_Info::is_dev_mounted( path );
//Custom checks for recognised but other not-supported file system types
busy |= ( fstype == FS_LINUX_SWRAID && SWRaid_Info::is_member_active( path ) );

View file

@ -37,6 +37,7 @@ gpartedbin_SOURCES = \
HBoxOperations.cc \
LVM2_PV_Info.cc \
LUKS_Info.cc \
Mount_Info.cc \
Operation.cc \
OperationChangeUUID.cc \
OperationCheck.cc \

228
src/Mount_Info.cc Normal file
View file

@ -0,0 +1,228 @@
/* Copyright (C) 2016 Mike Fleetwood
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, see <http://www.gnu.org/licenses/>.
*/
#include "../include/Mount_Info.h"
#include "../include/FS_Info.h"
#include "../include/Utils.h"
#include <glibmm/ustring.h>
#include <stdio.h>
#include <limits.h>
#include <stdlib.h>
#include <mntent.h>
#include <string>
#include <fstream>
namespace GParted
{
// Associative array mapping currently mounted devices to one or more mount points.
// E.g.
// mount_info[BlockSpecial("/dev/sda1")] -> ["/boot"]
// mount_info[BlockSpecial("/dev/sda2")] -> [""] (swap)
// mount_info[BlockSpecial("/dev/sda3")] -> ["/"]
static Mount_Info::MountMapping mount_info;
// Associative array mapping configured devices to one or more mount points read from
// /etc/fstab. E.g.
// fstab_info[BlockSpecial("/dev/sda1")] -> ["/boot"]
// fstab_info[BlockSpecial("/dev/sda3")] -> ["/"]
static Mount_Info::MountMapping fstab_info;
void Mount_Info::load_cache()
{
mount_info.clear();
fstab_info.clear();
read_mountpoints_from_file( "/proc/mounts", mount_info );
read_mountpoints_from_file_swaps( "/proc/swaps", mount_info );
if ( ! have_rootfs_dev( mount_info ) )
// Old distributions only contain 'rootfs' and '/dev/root' device names
// for the / (root) file system in /proc/mounts with '/dev/root' being a
// block device rather than a symlink to the true device. This prevents
// identification, and therefore busy detection, of the device containing
// the / (root) file system. Used to read /etc/mtab to get the root file
// system device name, but this contains an out of date device name after
// the mounting device has been dynamically removed from a multi-device
// btrfs, thus identifying the wrong device as busy. Instead fall back
// to reading mounted file systems from the output of the mount command,
// but only when required.
read_mountpoints_from_mount_command( mount_info );
read_mountpoints_from_file( "/etc/fstab", fstab_info );
// Sort the mount points and remove duplicates ... (no need to do this for fstab_info)
MountMapping::iterator iter_mp;
for ( iter_mp = mount_info.begin() ; iter_mp != mount_info.end() ; ++ iter_mp )
{
std::sort( iter_mp->second.begin(), iter_mp->second.end() );
iter_mp->second.erase(
std::unique( iter_mp->second.begin(), iter_mp->second.end() ),
iter_mp->second.end() );
}
}
// Return whether the device path, such as /dev/sda3, is mounted or not
bool Mount_Info::is_dev_mounted( const Glib::ustring & path )
{
return is_dev_mounted( BlockSpecial( path ) );
}
// Return whether the BlockSpecial object, such as {"/dev/sda3", 8, 3}, is mounted or not
bool Mount_Info::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> Mount_Info::get_all_mountpoints()
{
MountMapping::const_iterator iter_mp;
std::vector<Glib::ustring> mountpoints;
for ( iter_mp = mount_info.begin() ; iter_mp != mount_info.end() ; ++ iter_mp )
mountpoints.insert( mountpoints.end(), iter_mp->second.begin(), iter_mp->second.end() );
return mountpoints;
}
const std::vector<Glib::ustring> & Mount_Info::get_mounted_mountpoints( const Glib::ustring & path )
{
return find( mount_info, path );
}
const std::vector<Glib::ustring> & Mount_Info::get_fstab_mountpoints( const Glib::ustring & path )
{
return find( fstab_info, path );
}
// Private methods
void Mount_Info::read_mountpoints_from_file( const Glib::ustring & filename, MountMapping & map )
{
FILE* fp = setmntent( filename .c_str(), "r" );
if ( fp == NULL )
return;
struct mntent* p = NULL;
while ( ( p = getmntent( fp ) ) != NULL )
{
Glib::ustring node = p->mnt_fsname;
Glib::ustring mountpoint = p->mnt_dir;
Glib::ustring uuid = Utils::regexp_label( node, "^UUID=(.*)" );
if ( ! uuid.empty() )
node = FS_Info::get_path_by_uuid( uuid );
Glib::ustring label = Utils::regexp_label( node, "^LABEL=(.*)" );
if ( ! label.empty() )
node = FS_Info::get_path_by_label( label );
if ( ! node.empty() )
add_node_and_mountpoint( map, node, mountpoint );
}
endmntent( fp );
}
void Mount_Info::add_node_and_mountpoint( MountMapping & map,
Glib::ustring & node,
Glib::ustring & mountpoint )
{
// Only add node path(s) if mount point exists
if ( file_test( mountpoint, Glib::FILE_TEST_EXISTS ) )
{
map[BlockSpecial( node )].push_back( mountpoint );
// If node is a symbolic link (e.g., /dev/root)
// then find real path and add entry too
if ( file_test( node, Glib::FILE_TEST_IS_SYMLINK ) )
{
char * rpath = realpath( node.c_str(), NULL );
if ( rpath != NULL )
{
map[BlockSpecial( rpath )].push_back( mountpoint );
free( rpath );
}
}
}
}
void Mount_Info::read_mountpoints_from_file_swaps( const Glib::ustring & filename, MountMapping & map )
{
std::string line;
std::string node;
std::ifstream file( filename.c_str() );
if ( file )
{
while ( getline( file, line ) )
{
node = Utils::regexp_label( line, "^(/[^ ]+)" );
if ( node.size() > 0 )
map[BlockSpecial( node )].push_back( "" /* no mountpoint for swap */ );
}
file.close();
}
}
// Return true only if the map contains a device name for the / (root) file system other
// than 'rootfs' and '/dev/root'.
bool Mount_Info::have_rootfs_dev( MountMapping & map )
{
MountMapping::const_iterator iter_mp;
for ( iter_mp = mount_info.begin() ; iter_mp != mount_info.end() ; iter_mp ++ )
{
if ( ! iter_mp->second.empty() && iter_mp->second[0] == "/" )
{
if ( iter_mp->first.m_name != "rootfs" && iter_mp->first.m_name != "/dev/root" )
return true;
}
}
return false;
}
void Mount_Info::read_mountpoints_from_mount_command( MountMapping & map )
{
Glib::ustring output;
Glib::ustring error;
if ( ! Utils::execute_command( "mount", output, error, true ) )
{
std::vector<Glib::ustring> lines;
Utils::split( output, lines, "\n");
for ( unsigned int i = 0 ; i < lines .size() ; i ++ )
{
// Process line like "/dev/sda3 on / type ext4 (rw)"
Glib::ustring node = Utils::regexp_label( lines[ i ], "^([^[:blank:]]+) on " );
Glib::ustring mountpoint = Utils::regexp_label( lines[ i ], "^[^[:blank:]]+ on ([^[:blank:]]+) " );
if ( ! node.empty() )
add_node_and_mountpoint( map, node, mountpoint );
}
}
}
const std::vector<Glib::ustring> & Mount_Info::find( const MountMapping & map, const Glib::ustring & path )
{
MountMapping::const_iterator iter_mp = map.find( BlockSpecial( path ) );
if ( iter_mp != map.end() )
return iter_mp->second;
static std::vector<Glib::ustring> empty;
return empty;
}
} //GParted

View file

@ -27,6 +27,7 @@
#include "../include/Dialog_FileSystem_Label.h"
#include "../include/Dialog_Partition_Name.h"
#include "../include/DialogManageFlags.h"
#include "../include/Mount_Info.h"
#include "../include/OperationCopy.h"
#include "../include/OperationCheck.h"
#include "../include/OperationCreate.h"
@ -2209,7 +2210,9 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
void Win_GParted::unmount_partition( bool * succes, Glib::ustring * error )
{
std::vector<Glib::ustring> errors, failed_mountpoints, mountpoints = GParted_Core::get_all_mountpoints() ;
std::vector<Glib::ustring> errors;
std::vector<Glib::ustring> failed_mountpoints;
std::vector<Glib::ustring> mountpoints = Mount_Info::get_all_mountpoints();
Glib::ustring dummy ;
*succes = true ;

View file

@ -18,7 +18,7 @@
#include "../include/btrfs.h"
#include "../include/BlockSpecial.h"
#include "../include/GParted_Core.h"
#include "../include/Mount_Info.h"
#include "../include/Partition.h"
#include <ctype.h>
@ -456,13 +456,13 @@ Glib::ustring btrfs::get_mount_device( const Glib::ustring & path )
// Use fallback busy detection method which can only determine if the
// mounting device is mounted or not, not any of the other members of a
// multi-device btrfs file system.
if ( GParted_Core::is_dev_mounted( path ) )
if ( Mount_Info::is_dev_mounted( path ) )
return path ;
return "" ;
}
for ( unsigned int i = 0 ; i < btrfs_dev .members .size() ; i ++ )
if ( GParted_Core::is_dev_mounted( btrfs_dev.members[i] ) )
if ( Mount_Info::is_dev_mounted( btrfs_dev.members[i] ) )
return btrfs_dev.members[i].m_name;
return "" ;
}