partition: factor out 32_MiB constant

This commit is contained in:
Adriaan de Groot 2023-11-07 23:41:10 +01:00
parent d0ae922439
commit c506808d72

View File

@ -501,7 +501,7 @@ isEfiFilesystemMinimumSize( const Partition* candidate )
return false; return false;
} }
if ( size >= 32_MiB ) if ( size >= efiFilesystemMinimumSize() )
{ {
return true; return true;
} }
@ -522,11 +522,13 @@ isEfiBootable( const Partition* candidate )
return flags.testFlag( KPM_PARTITION_FLAG_ESP ); return flags.testFlag( KPM_PARTITION_FLAG_ESP );
} }
using Calamares::Units::operator""_MiB;
static constexpr qint64 efiSpecificationHardMinimumSize = 32_MiB;
qint64 qint64
efiFilesystemRecommendedSize() efiFilesystemRecommendedSize()
{ {
using Calamares::Units::operator""_MiB;
qint64 uefisys_part_sizeB = 300_MiB; qint64 uefisys_part_sizeB = 300_MiB;
// The default can be overridden; the key used here comes // The default can be overridden; the key used here comes
@ -538,9 +540,9 @@ efiFilesystemRecommendedSize()
uefisys_part_sizeB = v > 0 ? v : 0; uefisys_part_sizeB = v > 0 ? v : 0;
} }
// There is a lower limit of what can be configured // There is a lower limit of what can be configured
if ( uefisys_part_sizeB < 32_MiB ) if ( uefisys_part_sizeB < efiSpecificationHardMinimumSize )
{ {
uefisys_part_sizeB = 32_MiB; uefisys_part_sizeB = efiSpecificationHardMinimumSize;
} }
return uefisys_part_sizeB; return uefisys_part_sizeB;
} }
@ -548,8 +550,7 @@ efiFilesystemRecommendedSize()
qint64 qint64
efiFilesystemMinimumSize() efiFilesystemMinimumSize()
{ {
using Calamares::Units::operator""_MiB; return efiSpecificationHardMinimumSize;
return 32_MiB;
} }
QString QString