Stop requesting partition paths of free space and metadata
In GParted_Core::set_device_partitions() the partition path is being queried from libparted. However this is done before the switch statement on the type of the partition, so is called for all libparted partition objects including PED_PARTITION_FREESPACE and PED_PARTITION_METADATA ones. As libparted numbers these partition objects as -1, it returns paths like "/dev/sda-1". Additionally when using GParted, with it's default DMRaid handling, on a dmraid started array this results in paths like "/dev/mapper/isw_ecccdhhiga_MyArray-1" being passed to is_dmraid_device() and make_path_dmraid_compatible(). Fortunately make_path_dmraid_compatible() does nothing and returns the same name. Call chain looks like: GParted_Core::set_device_partitions() get_partition_path(lp_partition) // where: // lp_partition->disk->dev->path = "/dev/mapper/isw_ecccdhhiga_MyArray" // lp_partition->type == PED_PARTITION_FREESPACE | // PED_PARTITION_METADATA // ->num == -1 ped_partition_get_path(lp_partition) return "/dev/mapper/isw_ecccdhhiga_MyArray-1" dmraid.is_dmraid_supported() dmraid.is_dmraid_device("/dev/mapper/isw_ecccdhhiga_MyArray-1") return true dmraid.make_path_dmraid_compatible("/dev/mapper/isw_ecccdhhiga_MyArray-1") return "/dev/mapper/isw_ecccdhhiga_MyArray-1" Fix by moving the get_partition_path() call inside the switch statement so that it is only called for PED_PARTITION_NORMAL, PED_PARTITION_LOGICAL and PED_PARTITION_EXTENDED partition types. Relevant commits: *53c49349f7
Simplify logic in set_device_partitions method *81986c0990
Ensure partition path name is compatible with dmraid (#622217)
This commit is contained in:
parent
fa682d372a
commit
047a2481bb
|
@ -817,9 +817,7 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
|||
bool partition_is_busy = false ;
|
||||
FSType filesystem;
|
||||
std::vector<Glib::ustring> detect_messages;
|
||||
|
||||
//Retrieve partition path
|
||||
Glib::ustring partition_path = get_partition_path( lp_partition );
|
||||
Glib::ustring partition_path;
|
||||
|
||||
// NOTE: lp_partition->type bit field
|
||||
// lp_partition->type is a bit field using enumerated names for each bit.
|
||||
|
@ -840,6 +838,8 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
|||
case PED_PARTITION_NORMAL:
|
||||
case PED_PARTITION_LOGICAL:
|
||||
filesystem = detect_filesystem( lp_device, lp_partition, detect_messages );
|
||||
partition_path = get_partition_path(lp_partition);
|
||||
|
||||
#ifndef USE_LIBPARTED_DMRAID
|
||||
//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"
|
||||
|
@ -886,6 +886,8 @@ void GParted_Core::set_device_partitions( Device & device, PedDevice* lp_device,
|
|||
break ;
|
||||
|
||||
case PED_PARTITION_EXTENDED:
|
||||
partition_path = get_partition_path(lp_partition);
|
||||
|
||||
partition_temp = new Partition();
|
||||
partition_temp->Set( device.get_path(),
|
||||
partition_path,
|
||||
|
|
Loading…
Reference in New Issue