[partition] rename findFS

Rename findFS -> canonicalFilesystemName because that's what it actually
does. While here, apply coding style to the files that are affected.
This commit is contained in:
Adriaan de Groot 2021-06-18 11:06:02 +02:00
parent 546253d750
commit f9659989b1
7 changed files with 16 additions and 13 deletions

View File

@ -472,7 +472,7 @@ isEfiBootable( const Partition* candidate )
} }
QString QString
findFS( QString fsName, FileSystem::Type* fsType ) canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType )
{ {
QStringList fsLanguage { QLatin1String( "C" ) }; // Required language list to turn off localization QStringList fsLanguage { QLatin1String( "C" ) }; // Required language list to turn off localization
if ( fsName.isEmpty() ) if ( fsName.isEmpty() )

View File

@ -91,11 +91,13 @@ bool isEfiBootable( const Partition* candidate );
/** @brief translate @p fsName into a recognized name and type /** @brief translate @p fsName into a recognized name and type
* *
* Makes several attempts to translate the string into a * Makes several attempts to translate the string into a
* name that KPMCore will recognize. * name that KPMCore will recognize. Returns the canonical
* filesystem name (e.g. asking for "EXT4" will return "ext4").
*
* The corresponding filesystem type is stored in @p fsType, and * The corresponding filesystem type is stored in @p fsType, and
* its value is FileSystem::Unknown if @p fsName is not recognized. * its value is FileSystem::Unknown if @p fsName is not recognized.
*/ */
QString findFS( QString fsName, FileSystem::Type* fsType ); QString canonicalFilesystemName( const QString& fsName, FileSystem::Type* fsType );
} // namespace PartUtils } // namespace PartUtils

View File

@ -108,8 +108,10 @@ doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionO
partType = isEfi ? PartitionTable::gpt : PartitionTable::msdos; partType = isEfi ? PartitionTable::gpt : PartitionTable::msdos;
} }
FileSystem::Type type; // Looking up the defaultFsType (which should name a filesystem type)
PartUtils::findFS( o.defaultFsType, &type ); // will log an error and set the type to Unknown if there's something wrong.
FileSystem::Type type = FileSystem::Unknown;
PartUtils::canonicalFilesystemName( o.defaultFsType, &type );
core->initLayout( type == FileSystem::Unknown ? FileSystem::Ext4 : type ); core->initLayout( type == FileSystem::Unknown ? FileSystem::Ext4 : type );
core->createPartitionTable( dev, partType ); core->createPartitionTable( dev, partType );

View File

@ -75,7 +75,7 @@ PartitionLayout::PartitionEntry::PartitionEntry( const QString& label,
, partMinSize( minSize ) , partMinSize( minSize )
, partMaxSize( maxSize ) , partMaxSize( maxSize )
{ {
PartUtils::findFS( fs, &partFileSystem ); PartUtils::canonicalFilesystemName( fs, &partFileSystem );
} }

View File

@ -96,7 +96,7 @@ CreatePartitionDialog::CreatePartitionDialog( Device* device,
// File system; the config value is translated (best-effort) to a type // File system; the config value is translated (best-effort) to a type
FileSystem::Type defaultFSType; FileSystem::Type defaultFSType;
QString untranslatedFSName = PartUtils::findFS( QString untranslatedFSName = PartUtils::canonicalFilesystemName(
Calamares::JobQueue::instance()->globalStorage()->value( "defaultFileSystemType" ).toString(), &defaultFSType ); Calamares::JobQueue::instance()->globalStorage()->value( "defaultFileSystemType" ).toString(), &defaultFSType );
if ( defaultFSType == FileSystem::Type::Unknown ) if ( defaultFSType == FileSystem::Type::Unknown )
{ {

View File

@ -97,7 +97,7 @@ EditExistingPartitionDialog::EditExistingPartitionDialog( Device* device,
m_ui->fileSystemComboBox->addItems( fsNames ); m_ui->fileSystemComboBox->addItems( fsNames );
FileSystem::Type defaultFSType; FileSystem::Type defaultFSType;
QString untranslatedFSName = PartUtils::findFS( QString untranslatedFSName = PartUtils::canonicalFilesystemName(
Calamares::JobQueue::instance()->globalStorage()->value( "defaultFileSystemType" ).toString(), &defaultFSType ); Calamares::JobQueue::instance()->globalStorage()->value( "defaultFileSystemType" ).toString(), &defaultFSType );
if ( defaultFSType == FileSystem::Type::Unknown ) if ( defaultFSType == FileSystem::Type::Unknown )
{ {

View File

@ -388,7 +388,7 @@ shouldWarnForGPTOnBIOS( const PartitionCoreModule* core )
} }
auto [ r, device ] = core->bootLoaderModel()->findBootLoader( core->bootLoaderInstallPath() ); auto [ r, device ] = core->bootLoaderModel()->findBootLoader( core->bootLoaderInstallPath() );
Q_UNUSED(r); Q_UNUSED( r );
if ( device ) if ( device )
{ {
auto* table = device->partitionTable(); auto* table = device->partitionTable();
@ -403,8 +403,7 @@ shouldWarnForGPTOnBIOS( const PartitionCoreModule* core )
&& ( partition->fileSystem().type() == FileSystem::Unformatted ) && ( partition->fileSystem().type() == FileSystem::Unformatted )
&& ( partition->capacity() >= 8_MiB ) ) && ( partition->capacity() >= 8_MiB ) )
{ {
cDebug() << Logger::SubEntry << "Partition" << partition->devicePath() cDebug() << Logger::SubEntry << "Partition" << partition->devicePath() << partition->partitionPath()
<< partition->partitionPath()
<< "is a suitable bios_grub partition"; << "is a suitable bios_grub partition";
return false; return false;
} }
@ -591,7 +590,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
{ {
cWarning() << "Partition-module setting *defaultFileSystemType* is missing, will use ext4"; cWarning() << "Partition-module setting *defaultFileSystemType* is missing, will use ext4";
} }
QString fsRealName = PartUtils::findFS( fsName, &fsType ); QString fsRealName = PartUtils::canonicalFilesystemName( fsName, &fsType );
if ( fsRealName == fsName ) if ( fsRealName == fsName )
{ {
cDebug() << o << "Partition-module setting *defaultFileSystemType*" << fsRealName; cDebug() << o << "Partition-module setting *defaultFileSystemType*" << fsRealName;
@ -619,7 +618,7 @@ PartitionViewStep::setConfigurationMap( const QVariantMap& configurationMap )
// because it could take a while. Then when it's done, we can set up the widgets // because it could take a while. Then when it's done, we can set up the widgets
// and remove the spinner. // and remove the spinner.
m_future = new QFutureWatcher< void >(); m_future = new QFutureWatcher< void >();
connect( m_future, &QFutureWatcher< void >::finished, this, [ this ] { connect( m_future, &QFutureWatcher< void >::finished, this, [this] {
continueLoading(); continueLoading();
this->m_future->deleteLater(); this->m_future->deleteLater();
this->m_future = nullptr; this->m_future = nullptr;