[luksopenswaphookcfg] Extend info with btrfs subvol

This is a C++-ification of e8936392 from dalto8 . Add a line
for options to the empty-file-fallback.
This commit is contained in:
Adriaan de Groot 2021-12-06 11:21:27 +01:00
parent 7ea21663ca
commit 45d6eb36fb
2 changed files with 7 additions and 1 deletions

View File

@ -23,6 +23,7 @@ struct LOSHInfo
QString swap_mapper_name; QString swap_mapper_name;
QString mountable_keyfile_device; QString mountable_keyfile_device;
QString swap_device_path; QString swap_device_path;
QString keyfile_device_mount_options;
bool isValid() const { return !swap_device_path.isEmpty(); } bool isValid() const { return !swap_device_path.isEmpty(); }
@ -49,6 +50,10 @@ struct LOSHInfo
{ {
return QStringLiteral( "crypto_keyfile.bin" ); return QStringLiteral( "crypto_keyfile.bin" );
} }
if ( key == QStringLiteral( "keyfile_device_mount_options" ) )
{
return keyfile_device_mount_options;
}
return QString(); return QString();
} }

View File

@ -103,7 +103,8 @@ LOSHJob::exec()
if ( contents.isEmpty() ) if ( contents.isEmpty() )
{ {
contents << QStringLiteral( "# swap_device=" ) << QStringLiteral( "# crypt_swap_name=" ) contents << QStringLiteral( "# swap_device=" ) << QStringLiteral( "# crypt_swap_name=" )
<< QStringLiteral( "# keyfile_device=" ) << QStringLiteral( "# keyfile_filename=" ); << QStringLiteral( "# keyfile_device=" ) << QStringLiteral( "# keyfile_filename=" )
<< QStringLiteral( "# keyfile_device_mount_options" );
} }
write_openswap_conf( m_configFilePath, contents, LOSHInfo::fromGlobalStorage() ); write_openswap_conf( m_configFilePath, contents, LOSHInfo::fromGlobalStorage() );