[partition] Reduce warnings

This commit is contained in:
Adriaan de Groot 2021-12-08 00:15:01 +01:00
parent 13700b18c8
commit e8ca298712
3 changed files with 12 additions and 5 deletions

View File

@ -451,6 +451,8 @@ isEfiFilesystemSuitableType( const Partition* candidate )
{
auto type = candidate->fileSystem().type();
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" )
switch ( type )
{
case FileSystem::Type::Fat32:
@ -465,6 +467,7 @@ isEfiFilesystemSuitableType( const Partition* candidate )
cWarning() << "EFI boot partition must be FAT32";
return false;
}
QT_WARNING_POP
}
bool
@ -526,14 +529,15 @@ efiFilesystemMinimumSize()
{
using CalamaresUtils::Units::operator""_MiB;
auto uefisys_part_sizeB = 300_MiB;
size_t uefisys_part_sizeB = 300_MiB;
// The default can be overridden; the key used here comes
// from the partition module Config.cpp
auto* gs = Calamares::JobQueue::instance()->globalStorage();
if ( gs->contains( "efiSystemPartitionSize_i" ) )
{
uefisys_part_sizeB = gs->value( "efiSystemPartitionSize_i" ).toLongLong();
qint64 v = gs->value( "efiSystemPartitionSize_i" ).toLongLong();
uefisys_part_sizeB = v > 0 ? static_cast< size_t >( v ) : 0;
}
// There is a lower limit of what can be configured
if ( uefisys_part_sizeB < 32_MiB )

View File

@ -71,15 +71,15 @@ swapSuggestion( const qint64 availableSpaceB, Config::SwapChoice swap )
// Allow for a fudge factor
suggestedSwapSizeB *= overestimationFactor;
suggestedSwapSizeB = qRound( suggestedSwapSizeB * overestimationFactor );
// don't use more than 10% of available space
if ( !ensureSuspendToDisk )
{
suggestedSwapSizeB = qMin( suggestedSwapSizeB, qint64( 0.10 * availableSpaceB ) );
suggestedSwapSizeB = qMin( suggestedSwapSizeB, availableSpaceB / 10 /* 10% is 0.1 */ );
}
cDebug() << "Suggested swap size:" << suggestedSwapSizeB / 1024. / 1024. / 1024. << "GiB";
cDebug() << "Suggested swap size:" << CalamaresUtils::BytesToGiB( suggestedSwapSizeB ) << "GiB";
return suggestedSwapSizeB;
}

View File

@ -141,6 +141,8 @@ void
PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType )
{
using FileSystem = FileSystem::Type;
QT_WARNING_PUSH
QT_WARNING_DISABLE_CLANG( "-Wswitch-enum" )
switch ( defaultFsType )
{
case FileSystem::Unknown:
@ -196,6 +198,7 @@ PartitionLayout::setDefaultFsType( FileSystem::Type defaultFsType )
<< "Using ext4 instead.";
defaultFsType = FileSystem::Ext4;
}
QT_WARNING_POP
m_defaultFsType = defaultFsType;
}