Exemplo n.º 1
0
void DeleteOperation::checkAdjustLogicalNumbers(Partition& p, bool undo)
{
    // If the deleted partition is a logical one, we need to adjust the numbers of the
    // other logical partitions in the extended one, if there are any, because the OS
    // will do that, too: Logicals must be numbered without gaps, i.e., a numbering like
    // sda5, sda6, sda8 (after sda7 is deleted) will become sda5, sda6, sda7
    Partition* parentPartition = dynamic_cast<Partition*>(p.parent());
    if (parentPartition && parentPartition->roles().has(PartitionRole::Extended))
        parentPartition->adjustLogicalNumbers(undo ? -1 : p.number(), undo ? p.number() : -1);
}
Exemplo n.º 2
0
void
DeletePartitionJob::updatePreview()
{
    m_partition->parent()->remove( m_partition );
    m_device->partitionTable()->updateUnallocated( *m_device );

    // Copied from PM DeleteOperation::checkAdjustLogicalNumbers():
    //
    // If the deleted partition is a logical one, we need to adjust the numbers
    // of the other logical partitions in the extended one, if there are any,
    // because the OS will do that, too: Logicals must be numbered without gaps,
    // i.e., a numbering like sda5, sda6, sda8 (after sda7 is deleted) will
    // become sda5, sda6, sda7
    Partition* parentPartition = dynamic_cast< Partition* >( m_partition->parent() );
    if ( parentPartition && parentPartition->roles().has( PartitionRole::Extended ) )
        parentPartition->adjustLogicalNumbers( m_partition->number(), -1 );
}