[partition] Factor out GS keys for EFI-size sharing

This commit is contained in:
Adriaan de Groot 2023-11-09 22:17:51 +01:00
parent b06afd9074
commit 449fba03be
2 changed files with 20 additions and 2 deletions

View File

@ -530,10 +530,16 @@ isEfiBootable( const Partition* candidate )
return flags.testFlag( KPM_PARTITION_FLAG_ESP );
}
QString
efiFilesystemRecommendedSizeGSKey()
{
return QStringLiteral( "efiSystemPartitionSize_i" );
}
qint64
efiFilesystemRecommendedSize()
{
const QString key = QStringLiteral( "efiSystemPartitionSize_i" );
const QString key = efiFilesystemRecommendedSizeGSKey();
qint64 uefisys_part_sizeB = 300_MiB;
@ -553,10 +559,16 @@ efiFilesystemRecommendedSize()
return uefisys_part_sizeB;
}
QString
efiFilesystemMinimumSizeGSKey()
{
return QStringLiteral( "efiSystemPartitionMinimumSize_i" );
}
qint64
efiFilesystemMinimumSize()
{
const QString key = QStringLiteral( "efiSystemPartitionMinimumSize_i" );
const QString key = efiFilesystemMinimumSizeGSKey();
qint64 uefisys_part_sizeB = efiFilesystemRecommendedSize();

View File

@ -120,12 +120,18 @@ bool isEfiFilesystemMinimumSize( const Partition* candidate );
*/
qint64 efiFilesystemRecommendedSize();
// Helper for consistency: the GS key used to share the recommended size
QString efiFilesystemRecommendedSizeGSKey();
/** @brief Returns the hard-minimum size of an EFI boot partition in bytes.
*
* This is 32MiB, based on the FAT32 standard and EFI documentation.
*/
qint64 efiFilesystemMinimumSize();
// Helper for consistency: the GS key used to share the minimum size
QString efiFilesystemMinimumSizeGSKey();
/**
* @brief Is the given @p partition bootable in EFI? Depending on
* the partition table layout, this may mean different flags.