calamares/src/modules/partition/core/PartitionActions.h

90 lines
2.7 KiB
C
Raw Normal View History

/* === This file is part of Calamares - <https://calamares.io> ===
2014-09-04 19:37:30 +02:00
*
2020-08-22 01:19:58 +02:00
* SPDX-FileCopyrightText: 2014-2016 Teo Mrnjavac <teo@kde.org>
* SPDX-License-Identifier: GPL-3.0-or-later
2014-09-04 19:37:30 +02:00
*
* Calamares is Free Software: see the License-Identifier above.
2014-09-04 19:37:30 +02:00
*
*/
#ifndef PARTITIONACTIONS_H
#define PARTITIONACTIONS_H
2014-09-04 19:37:30 +02:00
#include "core/Config.h"
#include <QSet>
#include <QString>
2014-09-04 19:37:30 +02:00
class PartitionCoreModule;
class Device;
class Partition;
2014-09-04 19:37:30 +02:00
namespace PartitionActions
2014-09-04 19:37:30 +02:00
{
/** @brief Namespace for enums
*
* This namespace houses non-class enums.....
*/
namespace Choices
{
struct ReplacePartitionOptions
{
QString defaultPartitionTableType; // e.g. "gpt" or "msdos"
QString defaultFsType; // e.g. "ext4" or "btrfs"
QString luksPassphrase; // optional
ReplacePartitionOptions( const QString& pt, const QString& fs, const QString& luks )
: defaultPartitionTableType ( pt )
, defaultFsType( fs )
, luksPassphrase( luks )
{
}
};
struct AutoPartitionOptions : ReplacePartitionOptions
{
QString efiPartitionMountPoint; // optional, e.g. "/boot"
quint64 requiredSpaceB; // estimated required space for root partition
Config::SwapChoice swap;
AutoPartitionOptions( const QString& pt,
const QString& fs,
const QString& luks,
const QString& efi,
qint64 requiredBytes,
Config::SwapChoice s )
: ReplacePartitionOptions( pt, fs, luks )
, efiPartitionMountPoint( efi )
, requiredSpaceB( requiredBytes > 0 ? static_cast< quint64 >( requiredBytes ) : 0 )
, swap( s )
{
}
};
} // namespace Choices
2017-03-03 12:31:39 +01:00
/**
* @brief doAutopartition sets up an autopartitioning operation on the given Device.
* @param core a pointer to the PartitionCoreModule instance.
* @param dev the device to wipe.
* @param options settings for autopartitioning.
2017-03-03 12:31:39 +01:00
*/
void doAutopartition( PartitionCoreModule* core, Device* dev, Choices::AutoPartitionOptions options );
2017-03-03 12:31:39 +01:00
/**
* @brief doReplacePartition sets up replace-partitioning with the given partition.
* @param core a pointer to the PartitionCoreModule instance.
* @param dev a pointer to the Device on which to replace a partition.
* @param partition a pointer to the Partition to be replaced.
* @param options settings for partitioning (not all fields apply)
*
2017-03-03 12:31:39 +01:00
* @note this function also takes care of requesting PCM to delete the partition.
*/
void doReplacePartition( PartitionCoreModule* core,
Device* dev,
Partition* partition,
Choices::ReplacePartitionOptions options );
} // namespace PartitionActions
2014-09-04 19:37:30 +02:00
#endif // PARTITIONACTIONS_H