[partition] Move LUKS helpers code-documentation

This commit is contained in:
Adriaan de Groot 2022-05-24 12:48:29 +02:00
parent 2a7cbd2520
commit de03a92a8f
2 changed files with 17 additions and 8 deletions

View File

@ -168,13 +168,6 @@ testPassphrase( FS::luks* fs, const QString& deviceNode, const QString& passphra
#endif
// Adapted from src/fs/luks.cpp cryptOpen which always opens a dialog to ask for a passphrase
/**
* @brief
* Save an existing passphrase for a previously encrypted partition.
* @param partition
* @param passphrase
* @return SavePassphraseValue
*/
SavePassphraseValue
savePassphrase( Partition* partition, const QString& passphrase )
{

View File

@ -43,7 +43,15 @@ class PartitionRole;
namespace KPMHelpers
{
enum SavePassphraseValue
/** @brief Return (errors) for savePassphrase()
*
* There's a handful of things that can go wrong when
* saving a passphrase for a given partition; this
* expresses clearly which ones are wrong.
*
* @c NoError is "Ok" when saving the passphrase succeeds.
*/
enum class SavePassphraseValue
{
NoError,
EmptyPassphrase,
@ -85,6 +93,14 @@ Partition* createNewEncryptedPartition( PartitionNode* parent,
Partition* clonePartition( Device* device, Partition* partition );
/** @brief Save an existing passphrase for a previously encrypted partition.
*
* Tries to apply the passphrase to the partition; this checks if the
* @p partition is one that can have a passphrase applied, and
* runs `cryptsetup` to check that the passphrase actually works
* for the partition. Returns `NoError` on success, or an explanatory
* other value if it fails.
*/
SavePassphraseValue savePassphrase( Partition* partition, const QString& passphrase );
/** @brief Return a result for an @p operation