partition: rename API to emphasize recommended and strict-minimum

This commit is contained in:
Adriaan de Groot 2023-11-07 23:30:56 +01:00
parent bc45f57b48
commit 45529ebdc1
5 changed files with 16 additions and 17 deletions

View File

@ -291,10 +291,10 @@ fillGSConfigurationEFI( Calamares::GlobalStorage* gs, const QVariantMap& configu
// Assign long long int to long unsigned int to prevent compilation warning // Assign long long int to long unsigned int to prevent compilation warning
auto byte_part_size = part_size.toBytes(); auto byte_part_size = part_size.toBytes();
if ( byte_part_size != PartUtils::efiFilesystemMinimumSize() ) if ( byte_part_size != PartUtils::efiFilesystemRecommendedSize() )
{ {
cWarning() << "EFI partition size" << sizeString << "has been adjusted to" cWarning() << "EFI partition size" << sizeString << "has been adjusted to"
<< PartUtils::efiFilesystemMinimumSize() << "bytes"; << PartUtils::efiFilesystemRecommendedSize() << "bytes";
} }
} }
else else

View File

@ -527,8 +527,8 @@ PartitionViewStep::onLeave()
Logger::Once o; Logger::Once o;
const bool okType = esp && PartUtils::isEfiFilesystemSuitableType( esp ); const bool okType = esp && PartUtils::isEfiFilesystemSuitableType( esp );
const bool okRecommendedSize = esp && PartUtils::isEfiFilesystemSuitableSize( esp ); const bool okRecommendedSize = esp && PartUtils::isEfiFilesystemRecommendedSize( esp );
const bool okMinimumSize = esp && PartUtils::isEfiFilesystemSuitableMinimumSize( esp ); const bool okMinimumSize = esp && PartUtils::isEfiFilesystemMinimumSize( esp );
const bool okFlag = esp && PartUtils::isEfiBootable( esp ); const bool okFlag = esp && PartUtils::isEfiBootable( esp );
const bool espExistsButIsWrong = esp && !( okType && okMinimumSize && okFlag ); const bool espExistsButIsWrong = esp && !( okType && okMinimumSize && okFlag );
@ -555,7 +555,7 @@ PartitionViewStep::onLeave()
// Three flavors of size-is-wrong // Three flavors of size-is-wrong
using Calamares::Units::operator""_MiB; using Calamares::Units::operator""_MiB;
const qint64 atLeastBytes = static_cast< qint64 >( PartUtils::efiFilesystemMinimumSize() ); const qint64 atLeastBytes = static_cast< qint64 >( PartUtils::efiFilesystemRecommendedSize() );
const auto atLeastMiB = Calamares::BytesToMiB( atLeastBytes ); const auto atLeastMiB = Calamares::BytesToMiB( atLeastBytes );
const QString requireConfiguredSize const QString requireConfiguredSize

View File

@ -471,7 +471,7 @@ isEfiFilesystemSuitableType( const Partition* candidate )
} }
bool bool
isEfiFilesystemSuitableSize( const Partition* candidate ) isEfiFilesystemRecommendedSize( const Partition* candidate )
{ {
auto size = candidate->capacity(); // bytes auto size = candidate->capacity(); // bytes
if ( size <= 0 ) if ( size <= 0 )
@ -479,7 +479,7 @@ isEfiFilesystemSuitableSize( const Partition* candidate )
return false; return false;
} }
if ( size >= efiFilesystemMinimumSize() ) if ( size >= efiFilesystemRecommendedSize() )
{ {
return true; return true;
} }
@ -491,7 +491,7 @@ isEfiFilesystemSuitableSize( const Partition* candidate )
} }
bool bool
isEfiFilesystemSuitableMinimumSize( const Partition* candidate ) isEfiFilesystemMinimumSize( const Partition* candidate )
{ {
using Calamares::Units::operator""_MiB; using Calamares::Units::operator""_MiB;
@ -522,9 +522,8 @@ isEfiBootable( const Partition* candidate )
return flags.testFlag( KPM_PARTITION_FLAG_ESP ); return flags.testFlag( KPM_PARTITION_FLAG_ESP );
} }
// TODO: this is configurable via the config file **already**
qint64 qint64
efiFilesystemMinimumSize() efiFilesystemRecommendedSize()
{ {
using Calamares::Units::operator""_MiB; using Calamares::Units::operator""_MiB;

View File

@ -95,15 +95,15 @@ bool isEfiFilesystemSuitableType( const Partition* candidate );
/** /**
* @brief Is the @p partition suitable as an EFI boot partition? * @brief Is the @p partition suitable as an EFI boot partition?
* Checks for filesystem size (300MiB, see efiFilesystemMinimumSize). * Checks for filesystem size (300MiB, see efi.recommendedSize).
*/ */
bool isEfiFilesystemSuitableSize( const Partition* candidate ); bool isEfiFilesystemRecommendedSize( const Partition* candidate );
/** /**
* @brief Is the @p candidate suitable as an EFI boot partition? * @brief Is the @p candidate suitable as an EFI boot partition?
* This checks the bonkers-small minimum of 32MiB. * Checks for filesystem size (32MiB at least, see efi.minimumSize).
*/ */
bool isEfiFilesystemSuitableMinimumSize( const Partition* candidate ); bool isEfiFilesystemMinimumSize( const Partition* candidate );
/** @brief Returns the minimum size of an EFI boot partition in bytes. /** @brief Returns the minimum size of an EFI boot partition in bytes.
* *
@ -113,12 +113,12 @@ bool isEfiFilesystemSuitableMinimumSize( const Partition* candidate );
* by the standard and how all of those are different). * by the standard and how all of those are different).
* *
* This can be configured through the `partition.conf` file, * This can be configured through the `partition.conf` file,
* key *efiSystemPartitionSize*, which will then apply to both * key *efi.recommendedSize*, which will then apply to both
* automatic partitioning **and** the warning for manual partitioning. * automatic partitioning **and** the warning for manual partitioning.
* *
* A minimum of 32MiB (which is bonkers-small) is enforced. * A minimum of 32MiB (which is bonkers-small) is enforced.
*/ */
qint64 efiFilesystemMinimumSize(); qint64 efiFilesystemRecommendedSize();
/** /**
* @brief Is the given @p partition bootable in EFI? Depending on * @brief Is the given @p partition bootable in EFI? Depending on

View File

@ -118,7 +118,7 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
if ( isEfi ) if ( isEfi )
{ {
qint64 uefisys_part_sizeB = PartUtils::efiFilesystemMinimumSize(); qint64 uefisys_part_sizeB = PartUtils::efiFilesystemRecommendedSize();
qint64 efiSectorCount = Calamares::bytesToSectors( uefisys_part_sizeB, dev->logicalSize() ); qint64 efiSectorCount = Calamares::bytesToSectors( uefisys_part_sizeB, dev->logicalSize() );
Q_ASSERT( efiSectorCount > 0 ); Q_ASSERT( efiSectorCount > 0 );