an initial solution for the automount problem. I still need to add
* include/GParted_Core.h, src/GParted_Core.cc: an initial solution for the automount problem. I still need to add something to prevent just created partitions from getting mounted. (see #324220 for more info)
This commit is contained in:
parent
e933473cfa
commit
26da768ee0
|
@ -1,3 +1,10 @@
|
||||||
|
2006-04-02 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
|
* include/GParted_Core.h,
|
||||||
|
src/GParted_Core.cc: an initial solution for the automount problem.
|
||||||
|
I still need to add something to prevent just created partitions from
|
||||||
|
getting mounted. (see #324220 for more info)
|
||||||
|
|
||||||
2006-04-02 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
2006-04-02 Bart Hakvoort <hakvoort@cvs.gnome.org>
|
||||||
|
|
||||||
* include/Dialog_Filesystems.h,
|
* include/Dialog_Filesystems.h,
|
||||||
|
|
|
@ -66,6 +66,7 @@ private:
|
||||||
GParted::FILESYSTEM get_filesystem() ;
|
GParted::FILESYSTEM get_filesystem() ;
|
||||||
bool check_device_path( const Glib::ustring & device_path ) ;
|
bool check_device_path( const Glib::ustring & device_path ) ;
|
||||||
void set_device_partitions( Device & device ) ;
|
void set_device_partitions( Device & device ) ;
|
||||||
|
void disable_automount( const std::vector<Partition> & partitions ) ;
|
||||||
void read_mountpoints_from_file( const Glib::ustring & filename,
|
void read_mountpoints_from_file( const Glib::ustring & filename,
|
||||||
std::map< Glib::ustring, std::vector<Glib::ustring> > & map ) ;
|
std::map< Glib::ustring, std::vector<Glib::ustring> > & map ) ;
|
||||||
void init_maps() ;
|
void init_maps() ;
|
||||||
|
@ -118,6 +119,8 @@ private:
|
||||||
std::map< Glib::ustring, Glib::ustring >::iterator iter ;
|
std::map< Glib::ustring, Glib::ustring >::iterator iter ;
|
||||||
std::map< Glib::ustring, std::vector<Glib::ustring> >::iterator iter_mp ;
|
std::map< Glib::ustring, std::vector<Glib::ustring> >::iterator iter_mp ;
|
||||||
|
|
||||||
|
std::vector<Glib::ustring> pmount_locked_partitions ;
|
||||||
|
|
||||||
PedDevice *lp_device ;
|
PedDevice *lp_device ;
|
||||||
PedDisk *lp_disk ;
|
PedDisk *lp_disk ;
|
||||||
PedPartition *lp_partition ;
|
PedPartition *lp_partition ;
|
||||||
|
|
|
@ -185,6 +185,10 @@ void GParted_Core::get_devices( std::vector<Device> & devices )
|
||||||
temp_device .max_prims = ped_disk_get_max_primary_partition_count( lp_disk ) ;
|
temp_device .max_prims = ped_disk_get_max_primary_partition_count( lp_disk ) ;
|
||||||
|
|
||||||
set_device_partitions( temp_device ) ;
|
set_device_partitions( temp_device ) ;
|
||||||
|
|
||||||
|
if ( ! Glib::find_program_in_path( "pmount" ) .empty() )
|
||||||
|
disable_automount( temp_device .partitions ) ;
|
||||||
|
|
||||||
set_mountpoints( temp_device .partitions ) ;
|
set_mountpoints( temp_device .partitions ) ;
|
||||||
set_used_sectors( temp_device .partitions ) ;
|
set_used_sectors( temp_device .partitions ) ;
|
||||||
|
|
||||||
|
@ -433,6 +437,24 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
insert_unallocated( device .get_path(), device .partitions, 0, device .length -1, false ) ;
|
insert_unallocated( device .get_path(), device .partitions, 0, device .length -1, false ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void GParted_Core::disable_automount( const std::vector<Partition> & partitions )
|
||||||
|
{
|
||||||
|
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
|
||||||
|
{
|
||||||
|
if ( partitions[ t ] .type == GParted::TYPE_EXTENDED )
|
||||||
|
disable_automount( partitions[ t ] .logicals ) ;
|
||||||
|
|
||||||
|
if ( std::find( pmount_locked_partitions .begin(),
|
||||||
|
pmount_locked_partitions .end(),
|
||||||
|
partitions[ t ] .get_path() ) == pmount_locked_partitions .end() )
|
||||||
|
{
|
||||||
|
Utils::execute_command( "pmount --lock " + partitions[ t ] .get_path() + " " + Utils::num_to_str( getpid() ) ) ;
|
||||||
|
|
||||||
|
pmount_locked_partitions .push_back( partitions[ t ] .get_path() ) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
|
void GParted_Core::set_mountpoints( std::vector<Partition> & partitions )
|
||||||
{
|
{
|
||||||
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
|
for ( unsigned int t = 0 ; t < partitions .size() ; t++ )
|
||||||
|
@ -1347,6 +1369,9 @@ GParted_Core::~GParted_Core()
|
||||||
{
|
{
|
||||||
if ( p_filesystem )
|
if ( p_filesystem )
|
||||||
delete p_filesystem ;
|
delete p_filesystem ;
|
||||||
|
|
||||||
|
for ( unsigned int t = 0 ; t < pmount_locked_partitions .size() ; t++ )
|
||||||
|
Utils::execute_command( "pmount --unlock " + pmount_locked_partitions[ t ] + " " + Utils::num_to_str( getpid() ) ) ;
|
||||||
}
|
}
|
||||||
|
|
||||||
} //GParted
|
} //GParted
|
||||||
|
|
Loading…
Reference in New Issue