Always use outer UUID for mapper name.

This commit is contained in:
Teo Mrnjavac 2016-05-05 14:15:39 +02:00
parent 0bd44b94dc
commit 6013b5887c
2 changed files with 9 additions and 1 deletions

View File

@ -454,7 +454,7 @@ FileSystem::Type luks::type() const
QString luks::suggestedMapperName(const QString& deviceNode) const QString luks::suggestedMapperName(const QString& deviceNode) const
{ {
return QStringLiteral("luks-") + readUUID(deviceNode); return QStringLiteral("luks-") + readOuterUUID(deviceNode);
} }
QString luks::readLabel(const QString& deviceNode) const QString luks::readLabel(const QString& deviceNode) const
@ -507,6 +507,11 @@ QString luks::readUUID(const QString& deviceNode) const
{ {
if (m_isCryptOpen && m_innerFs) if (m_isCryptOpen && m_innerFs)
return m_innerFs->readUUID(mapperName(deviceNode)); return m_innerFs->readUUID(mapperName(deviceNode));
return readOuterUUID(deviceNode);
}
QString luks::readOuterUUID(const QString &deviceNode) const
{
ExternalCommand cmd(QStringLiteral("cryptsetup"), ExternalCommand cmd(QStringLiteral("cryptsetup"),
{ QStringLiteral("luksUUID"), deviceNode }); { QStringLiteral("luksUUID"), deviceNode });
if (cmd.run()) { if (cmd.run()) {

View File

@ -149,6 +149,9 @@ public:
static QString getPayloadOffset(const QString& deviceNode); static QString getPayloadOffset(const QString& deviceNode);
static bool canEncryptType(FileSystem::Type type); static bool canEncryptType(FileSystem::Type type);
protected:
virtual QString readOuterUUID(const QString& deviceNode) const;
public: public:
static CommandSupportType m_GetUsed; static CommandSupportType m_GetUsed;
static CommandSupportType m_GetLabel; static CommandSupportType m_GetLabel;