Simplify logic in set_device_partitions method
Also clean up some white space
This commit is contained in:
parent
4349e7cd5d
commit
53c49349f7
|
@ -874,12 +874,15 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
partition_temp .Reset() ;
|
partition_temp .Reset() ;
|
||||||
bool partition_is_busy = false ;
|
bool partition_is_busy = false ;
|
||||||
|
|
||||||
|
//Retrieve partition path
|
||||||
|
lp_path = ped_partition_get_path( lp_partition ) ;
|
||||||
|
Glib::ustring partition_path = lp_path ;
|
||||||
|
free( lp_path ) ;
|
||||||
|
|
||||||
switch ( lp_partition ->type )
|
switch ( lp_partition ->type )
|
||||||
{
|
{
|
||||||
case PED_PARTITION_NORMAL:
|
case PED_PARTITION_NORMAL:
|
||||||
case PED_PARTITION_LOGICAL:
|
case PED_PARTITION_LOGICAL:
|
||||||
lp_path = ped_partition_get_path( lp_partition ) ;
|
|
||||||
|
|
||||||
//Handle dmraid devices differently because the minor number might not
|
//Handle dmraid devices differently because the minor number might not
|
||||||
// match the last number of the partition filename as shown by "ls -l /dev/mapper"
|
// match the last number of the partition filename as shown by "ls -l /dev/mapper"
|
||||||
// This mismatch causes incorrect identification of busy partitions in ped_partition_is_busy().
|
// This mismatch causes incorrect identification of busy partitions in ped_partition_is_busy().
|
||||||
|
@ -898,7 +901,7 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
||||||
|
|
||||||
partition_temp .Set( device .get_path(),
|
partition_temp .Set( device .get_path(),
|
||||||
lp_path,
|
partition_path,
|
||||||
lp_partition ->num,
|
lp_partition ->num,
|
||||||
lp_partition ->type == 0 ? GParted::TYPE_PRIMARY : GParted::TYPE_LOGICAL,
|
lp_partition ->type == 0 ? GParted::TYPE_PRIMARY : GParted::TYPE_LOGICAL,
|
||||||
get_filesystem(),
|
get_filesystem(),
|
||||||
|
@ -907,7 +910,6 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
device .sector_size,
|
device .sector_size,
|
||||||
lp_partition ->type,
|
lp_partition ->type,
|
||||||
partition_is_busy ) ;
|
partition_is_busy ) ;
|
||||||
free( lp_path ) ;
|
|
||||||
|
|
||||||
partition_temp .add_paths( get_alternate_paths( partition_temp .get_path() ) ) ;
|
partition_temp .add_paths( get_alternate_paths( partition_temp .get_path() ) ) ;
|
||||||
set_flags( partition_temp ) ;
|
set_flags( partition_temp ) ;
|
||||||
|
@ -918,8 +920,6 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
break ;
|
break ;
|
||||||
|
|
||||||
case PED_PARTITION_EXTENDED:
|
case PED_PARTITION_EXTENDED:
|
||||||
lp_path = ped_partition_get_path( lp_partition ) ;
|
|
||||||
|
|
||||||
//Handle dmraid devices differently because the minor number might not
|
//Handle dmraid devices differently because the minor number might not
|
||||||
// match the last number of the partition filename as shown by "ls -l /dev/mapper"
|
// match the last number of the partition filename as shown by "ls -l /dev/mapper"
|
||||||
// This mismatch causes incorrect identification of busy partitions in ped_partition_is_busy().
|
// This mismatch causes incorrect identification of busy partitions in ped_partition_is_busy().
|
||||||
|
@ -941,7 +941,7 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
partition_is_busy = ped_partition_is_busy( lp_partition ) ;
|
||||||
|
|
||||||
partition_temp .Set( device .get_path(),
|
partition_temp .Set( device .get_path(),
|
||||||
lp_path,
|
partition_path,
|
||||||
lp_partition ->num,
|
lp_partition ->num,
|
||||||
GParted::TYPE_EXTENDED,
|
GParted::TYPE_EXTENDED,
|
||||||
GParted::FS_EXTENDED,
|
GParted::FS_EXTENDED,
|
||||||
|
@ -950,7 +950,6 @@ void GParted_Core::set_device_partitions( Device & device )
|
||||||
device .sector_size,
|
device .sector_size,
|
||||||
false,
|
false,
|
||||||
partition_is_busy ) ;
|
partition_is_busy ) ;
|
||||||
free( lp_path ) ;
|
|
||||||
|
|
||||||
partition_temp .add_paths( get_alternate_paths( partition_temp .get_path() ) ) ;
|
partition_temp .add_paths( get_alternate_paths( partition_temp .get_path() ) ) ;
|
||||||
set_flags( partition_temp ) ;
|
set_flags( partition_temp ) ;
|
||||||
|
|
Loading…
Reference in New Issue