mirror of
https://github.com/parchlinux/calamares.git
synced 2025-06-29 10:25:36 -04:00
[partition] Coding style
This commit is contained in:
parent
b41e4624c9
commit
010526ee2a
9 changed files with 33 additions and 33 deletions
|
@ -165,13 +165,13 @@ PartitionLayout::execute( Device* dev,
|
|||
{
|
||||
QList< Partition* > partList;
|
||||
// Map each partition entry to its requested size (0 when calculated later)
|
||||
QMap< const PartitionLayout::PartitionEntry *, qint64 > partSizeMap;
|
||||
QMap< const PartitionLayout::PartitionEntry*, qint64 > partSizeMap;
|
||||
qint64 minSize, maxSize, end;
|
||||
qint64 totalSize = lastSector - firstSector + 1;
|
||||
qint64 availableSize = totalSize;
|
||||
|
||||
// Let's check if we have enough space for each partSize
|
||||
for( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
{
|
||||
qint64 size = -1;
|
||||
// Calculate partition size
|
||||
|
@ -179,7 +179,7 @@ PartitionLayout::execute( Device* dev,
|
|||
if ( part.partSize.isValid() )
|
||||
{
|
||||
// We need to ignore the percent-defined
|
||||
if ( part.partSize.unit() != CalamaresUtils::Partition::SizeUnit::Percent)
|
||||
if ( part.partSize.unit() != CalamaresUtils::Partition::SizeUnit::Percent )
|
||||
{
|
||||
size = part.partSize.toSectors( totalSize, dev->logicalSize() );
|
||||
}
|
||||
|
@ -201,15 +201,15 @@ PartitionLayout::execute( Device* dev,
|
|||
continue;
|
||||
}
|
||||
|
||||
partSizeMap.insert (&part, size);
|
||||
partSizeMap.insert( &part, size );
|
||||
availableSize -= size;
|
||||
}
|
||||
|
||||
// Use partMinSize and see if we can do better afterward.
|
||||
if (availableSize < 0)
|
||||
if ( availableSize < 0 )
|
||||
{
|
||||
availableSize = totalSize;
|
||||
for( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
{
|
||||
qint64 size;
|
||||
|
||||
|
@ -219,7 +219,7 @@ PartitionLayout::execute( Device* dev,
|
|||
}
|
||||
else if ( part.partSize.isValid() )
|
||||
{
|
||||
if ( part.partSize.unit() != CalamaresUtils::Partition::SizeUnit::Percent)
|
||||
if ( part.partSize.unit() != CalamaresUtils::Partition::SizeUnit::Percent )
|
||||
{
|
||||
size = part.partSize.toSectors( totalSize, dev->logicalSize() );
|
||||
}
|
||||
|
@ -233,23 +233,23 @@ PartitionLayout::execute( Device* dev,
|
|||
size = 0;
|
||||
}
|
||||
|
||||
partSizeMap.insert (&part, size);
|
||||
partSizeMap.insert( &part, size );
|
||||
availableSize -= size;
|
||||
}
|
||||
}
|
||||
|
||||
// Assign size for percentage-defined partitions
|
||||
for( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
{
|
||||
if ( part.partSize.unit() == CalamaresUtils::Partition::SizeUnit::Percent)
|
||||
if ( part.partSize.unit() == CalamaresUtils::Partition::SizeUnit::Percent )
|
||||
{
|
||||
qint64 size = partSizeMap.value (&part);
|
||||
qint64 size = partSizeMap.value( &part );
|
||||
size = part.partSize.toSectors( availableSize + size, dev->logicalSize() );
|
||||
partSizeMap.insert (&part, size);
|
||||
partSizeMap.insert( &part, size );
|
||||
if ( part.partMinSize.isValid() )
|
||||
{
|
||||
qint64 minSize = part.partMinSize.toSectors( totalSize, dev->logicalSize() );
|
||||
if (minSize > size)
|
||||
if ( minSize > size )
|
||||
{
|
||||
size = minSize;
|
||||
}
|
||||
|
@ -257,7 +257,7 @@ PartitionLayout::execute( Device* dev,
|
|||
if ( part.partMaxSize.isValid() )
|
||||
{
|
||||
qint64 maxSize = part.partMaxSize.toSectors( totalSize, dev->logicalSize() );
|
||||
if (maxSize < size)
|
||||
if ( maxSize < size )
|
||||
{
|
||||
size = maxSize;
|
||||
}
|
||||
|
@ -270,9 +270,9 @@ PartitionLayout::execute( Device* dev,
|
|||
// TODO: Refine partition sizes to make sure there is room for every partition
|
||||
// Use a default (200-500M ?) minimum size for partition without minSize
|
||||
|
||||
for( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
for ( const PartitionLayout::PartitionEntry& part : m_partLayout )
|
||||
{
|
||||
qint64 size = partSizeMap.value (&part);
|
||||
qint64 size = partSizeMap.value( &part );
|
||||
Partition* currentPartition = nullptr;
|
||||
|
||||
// Adjust partition size based on user-defined boundaries and available space
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue