LVM support #6

Closed
andrius wants to merge 109 commits from (deleted):lvm-support-rebase into master
1 changed files with 9 additions and 2 deletions
Showing only changes of commit 15738373e0 - Show all commits

View File

@ -606,8 +606,15 @@ qint64 luks::getKeySize(const QString& deviceNode) const
*/
qint64 luks::getPayloadOffset(const QString& deviceNode) const
{
//4096 sectors and 512 bytes.
return 4096 * 512;
ExternalCommand cmd(QStringLiteral("cryptsetup"),
{ QStringLiteral("luksDump"), deviceNode });
if (cmd.run(-1) && cmd.exitCode() == 0) {
QRegularExpression re(QStringLiteral("Payload offset:\\s+(\\d+)"));
QRegularExpressionMatch rePayloadOffset = re.match(cmd.output());
if (rePayloadOffset.hasMatch())
return rePayloadOffset.captured(1).toLongLong() * 512; // assuming LUKS sector size is 512
}
return -1;
}
bool luks::canEncryptType(FileSystem::Type type)