support partitions with multiple mountpoints (see also #330327)
* include/GParted_Core.h, include/Partition.h, src/Dialog_Partition_Info.cc, src/GParted_Core.cc, src/Partition.cc, src/TreeView_Detail.cc, src/Win_GParted.cc: support partitions with multiple mountpoints (see also #330327)
This commit is contained in:
parent
a4a5914d15
commit
d7a16d3c2f
11
ChangeLog
11
ChangeLog
|
@ -1,3 +1,14 @@
|
|||
2006-02-15 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* include/GParted_Core.h,
|
||||
include/Partition.h,
|
||||
src/Dialog_Partition_Info.cc,
|
||||
src/GParted_Core.cc,
|
||||
src/Partition.cc,
|
||||
src/TreeView_Detail.cc,
|
||||
src/Win_GParted.cc: support partitions with multiple mountpoints
|
||||
(see also #330327)
|
||||
|
||||
2006-02-15 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||
|
||||
* wrap mount/umount/swapon/swapoff instead of implementing it
|
||||
|
|
|
@ -99,21 +99,22 @@ private:
|
|||
|
||||
bool open_device( const Glib::ustring & device_path ) ;
|
||||
bool open_device_and_disk( const Glib::ustring & device_path, bool strict = true ) ;
|
||||
void close_device_and_disk( ) ;
|
||||
bool commit( ) ;
|
||||
void close_device_and_disk() ;
|
||||
bool commit() ;
|
||||
|
||||
std::vector<FS> FILESYSTEMS ;
|
||||
FileSystem * p_filesystem ;
|
||||
std::vector <PedPartitionFlag> flags;
|
||||
std::vector<PedPartitionFlag> flags;
|
||||
Glib::ustring temp ;
|
||||
Partition partition_temp ;
|
||||
FS fs ;
|
||||
std::vector<Glib::ustring> device_paths ;
|
||||
bool probe_devices ;
|
||||
|
||||
std::map<Glib::ustring, Glib::ustring> mount_info ;
|
||||
std::map<Glib::ustring, Glib::ustring> short_paths ;
|
||||
std::map<Glib::ustring, Glib::ustring>::iterator iter ;
|
||||
std::map< Glib::ustring, std::vector<Glib::ustring> > mount_info ;
|
||||
std::map< Glib::ustring, Glib::ustring > short_paths ;
|
||||
std::map< Glib::ustring, Glib::ustring >::iterator iter ;
|
||||
std::map< Glib::ustring, std::vector<Glib::ustring> >::iterator iter_mp ;
|
||||
|
||||
PedDevice *lp_device ;
|
||||
PedDisk *lp_disk ;
|
||||
|
|
|
@ -94,7 +94,7 @@ public:
|
|||
bool busy;
|
||||
Glib::ustring error;
|
||||
Glib::ustring flags;
|
||||
Glib::ustring mountpoint ;
|
||||
std::vector<Glib::ustring> mountpoints ;
|
||||
|
||||
std::vector<Partition> logicals ;
|
||||
|
||||
|
|
|
@ -183,14 +183,15 @@ void Dialog_Partition_Info::Display_Info( )
|
|||
//status
|
||||
Glib::ustring str_temp ;
|
||||
table ->attach( * Utils::mk_label( "<b>" + (Glib::ustring) _( "Status:" ) + "</b>" ), 0,1, top, bottom, Gtk::FILL) ;
|
||||
if ( partition.busy )
|
||||
if ( partition .busy )
|
||||
{
|
||||
if ( partition .type == GParted::TYPE_EXTENDED )
|
||||
str_temp = _("Busy (At least one logical partition is mounted)" ) ;
|
||||
else if ( partition .filesystem == FS_LINUX_SWAP )
|
||||
str_temp = _("Active") ;
|
||||
else if ( ! partition .mountpoint .empty() )
|
||||
str_temp = String::ucompose( _("Mounted on %1"), partition .mountpoint ) ;
|
||||
else if ( partition .mountpoints .size() )
|
||||
str_temp = String::ucompose( _("Mounted on %1"),
|
||||
Glib::build_path( ", ", partition .mountpoints ) ) ;
|
||||
else
|
||||
str_temp = _("Unable to find mountpoint") ;
|
||||
}
|
||||
|
|
|
@ -195,7 +195,7 @@ void GParted_Core::init_maps()
|
|||
if ( index < line .length() )
|
||||
line .replace( index, 4, " " ) ;
|
||||
|
||||
mount_info[ node ] = line ;
|
||||
mount_info[ node ] .push_back( line ) ;
|
||||
}
|
||||
|
||||
proc_mounts .close() ;
|
||||
|
@ -211,7 +211,7 @@ void GParted_Core::init_maps()
|
|||
sscanf( line .c_str(), "%255s %255s", node, mountpoint ) == 2 &&
|
||||
static_cast<Glib::ustring>( mountpoint ) == "/" )
|
||||
{
|
||||
mount_info[ node ] = "/" ;
|
||||
mount_info[ node ] .push_back( "/" ) ;
|
||||
break ;
|
||||
}
|
||||
|
||||
|
@ -377,11 +377,11 @@ void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
|
|||
{
|
||||
if ( partitions[ t ] .type == GParted::TYPE_PRIMARY || partitions[ t ] .type == GParted::TYPE_LOGICAL )
|
||||
{
|
||||
iter = mount_info .find( partitions[ t ] .partition );
|
||||
if ( iter != mount_info .end() )
|
||||
iter_mp = mount_info .find( partitions[ t ] .partition );
|
||||
if ( iter_mp != mount_info .end() )
|
||||
{
|
||||
partitions[ t ] .mountpoint = iter ->second ;
|
||||
mount_info .erase( iter ) ;
|
||||
partitions[ t ] .mountpoints = iter_mp ->second ;
|
||||
mount_info .erase( iter_mp ) ;
|
||||
}
|
||||
}
|
||||
else if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
||||
|
@ -433,7 +433,7 @@ void GParted_Core::set_used_sectors( std::vector<Partition> & partitions )
|
|||
{
|
||||
if ( partitions[ t ] .busy )
|
||||
{
|
||||
if ( statvfs( partitions[ t ] .mountpoint .c_str(), &sfs ) == 0 )
|
||||
if ( statvfs( partitions[ t ] .mountpoints .back() .c_str(), &sfs ) == 0 )
|
||||
partitions[ t ] .Set_Unused( sfs .f_bfree * (sfs .f_bsize / 512) ) ;
|
||||
}
|
||||
else
|
||||
|
|
|
@ -27,7 +27,7 @@ Partition::Partition()
|
|||
|
||||
void Partition::Reset()
|
||||
{
|
||||
partition = realpath = error = flags = mountpoint = "" ;
|
||||
partition = realpath = error = flags = "" ;
|
||||
status = GParted::STAT_REAL ;
|
||||
type = GParted::TYPE_UNALLOCATED ;
|
||||
filesystem = GParted::FS_UNALLOCATED ;
|
||||
|
@ -35,6 +35,7 @@ void Partition::Reset()
|
|||
color .set( "black" ) ;
|
||||
inside_extended = busy = strict = false ;
|
||||
logicals .clear() ;
|
||||
mountpoints .clear() ;
|
||||
}
|
||||
|
||||
void Partition::Set( const Glib::ustring & device_path,
|
||||
|
|
|
@ -91,12 +91,12 @@ void TreeView_Detail::load_partitions( const std::vector<Partition> & partitions
|
|||
childrow = *( treestore_detail ->append( row.children() ) );
|
||||
create_row( childrow, partitions[ i ] .logicals[ t ] );
|
||||
|
||||
if ( ! partitions[ i ] .logicals[ t ] .mountpoint .empty() )
|
||||
if ( partitions[ i ] .logicals[ t ] .mountpoints .size() )
|
||||
mount_info = true ;
|
||||
}
|
||||
}
|
||||
|
||||
if ( ! partitions[ i ] .mountpoint .empty() )
|
||||
if ( partitions[ i ] .mountpoints .size() )
|
||||
mount_info = true ;
|
||||
}
|
||||
|
||||
|
@ -161,8 +161,9 @@ void TreeView_Detail::create_row( const Gtk::TreeRow & treerow, const Partition
|
|||
Utils::Get_Filesystem_String( partition .filesystem ) ;
|
||||
|
||||
//mountpoint
|
||||
treerow[ treeview_detail_columns .mountpoint ] = partition .mountpoint ;
|
||||
|
||||
treerow[ treeview_detail_columns .mountpoint ] =
|
||||
Glib::build_path( ", ", partition .mountpoints ) ;
|
||||
|
||||
//size
|
||||
treerow[ treeview_detail_columns .size ] = Utils::format_size( partition .get_length() ) ;
|
||||
|
||||
|
|
|
@ -1346,15 +1346,16 @@ void Win_GParted::activate_format( GParted::FILESYSTEM new_fs )
|
|||
|
||||
void Win_GParted::thread_unmount_partition( bool * succes, Glib::ustring * error )
|
||||
{
|
||||
//FIXME: umount all targets of this device.. the aim is to get it free..
|
||||
*succes = ! Utils::execute_command( "umount " + selected_partition .partition, str_temp, *error ) ;
|
||||
*succes = true ;
|
||||
for ( unsigned int t = 0 ; t < selected_partition .mountpoints .size() && *succes ; t++ )
|
||||
*succes = ! Utils::execute_command( "umount -v " + selected_partition .mountpoints[ t ], str_temp, *error ) ;
|
||||
|
||||
pulse = false ;
|
||||
}
|
||||
|
||||
void Win_GParted::activate_unmount()
|
||||
{
|
||||
bool succes = false ;
|
||||
bool succes ;
|
||||
Glib::ustring error ;
|
||||
|
||||
pulse = true ;
|
||||
|
@ -1383,9 +1384,9 @@ void Win_GParted::activate_unmount()
|
|||
void Win_GParted::thread_toggle_swap( bool * succes, Glib::ustring * error )
|
||||
{
|
||||
if ( selected_partition .busy )
|
||||
*succes = ! Utils::execute_command( "swapoff " + selected_partition .partition, str_temp, *error ) ;
|
||||
*succes = ! Utils::execute_command( "swapoff -v " + selected_partition .partition, str_temp, *error ) ;
|
||||
else
|
||||
*succes = ! Utils::execute_command( "swapon " + selected_partition .partition, str_temp, *error ) ;
|
||||
*succes = ! Utils::execute_command( "swapon -v " + selected_partition .partition, str_temp, *error ) ;
|
||||
|
||||
pulse = false ;
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue