From 45d6eb36fb4396af7360acef427cfad6ff6f8c23 Mon Sep 17 00:00:00 2001 From: Adriaan de Groot Date: Mon, 6 Dec 2021 11:21:27 +0100 Subject: [PATCH] [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. --- src/modules/luksopenswaphookcfg/LOSHInfo.h | 5 +++++ src/modules/luksopenswaphookcfg/LOSHJob.cpp | 3 ++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/modules/luksopenswaphookcfg/LOSHInfo.h b/src/modules/luksopenswaphookcfg/LOSHInfo.h index 94ccba379..470b5a0cc 100644 --- a/src/modules/luksopenswaphookcfg/LOSHInfo.h +++ b/src/modules/luksopenswaphookcfg/LOSHInfo.h @@ -23,6 +23,7 @@ struct LOSHInfo QString swap_mapper_name; QString mountable_keyfile_device; QString swap_device_path; + QString keyfile_device_mount_options; bool isValid() const { return !swap_device_path.isEmpty(); } @@ -49,6 +50,10 @@ struct LOSHInfo { return QStringLiteral( "crypto_keyfile.bin" ); } + if ( key == QStringLiteral( "keyfile_device_mount_options" ) ) + { + return keyfile_device_mount_options; + } return QString(); } diff --git a/src/modules/luksopenswaphookcfg/LOSHJob.cpp b/src/modules/luksopenswaphookcfg/LOSHJob.cpp index 986213cf5..a5e5a183a 100644 --- a/src/modules/luksopenswaphookcfg/LOSHJob.cpp +++ b/src/modules/luksopenswaphookcfg/LOSHJob.cpp @@ -103,7 +103,8 @@ LOSHJob::exec() if ( contents.isEmpty() ) { 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() );