diff --git a/src/fs/luks.cpp b/src/fs/luks.cpp index c9daa08..5f3de48 100644 --- a/src/fs/luks.cpp +++ b/src/fs/luks.cpp @@ -69,6 +69,8 @@ luks::~luks() void luks::init() { m_Create = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone; + m_SetLabel = cmdSupportFileSystem; + m_GetLabel = cmdSupportFileSystem; m_UpdateUUID = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone; m_Grow = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone; m_Copy = cmdSupportCore; @@ -126,8 +128,8 @@ bool luks::supportToolFound() const { return // m_GetUsed != cmdSupportNone && -// m_GetLabel != cmdSupportNone && -// m_SetLabel != cmdSupportNone && + m_GetLabel != cmdSupportNone && + m_SetLabel != cmdSupportNone && m_Create != cmdSupportNone && // m_Check != cmdSupportNone && m_UpdateUUID != cmdSupportNone && @@ -426,6 +428,19 @@ FileSystem::Type luks::type() const return FileSystem::Luks; } +QString luks::readLabel(const QString& deviceNode) const +{ + if (m_isCryptOpen && m_innerFs) + return m_innerFs->readLabel(mapperName(deviceNode)); + return QStringLiteral(); +} + +bool luks::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) +{ + Q_ASSERT(m_innerFs); + return m_innerFs->writeLabel(report, mapperName(deviceNode), newLabel); +} + bool luks::resize(Report& report, const QString& deviceNode, qint64) const { Q_ASSERT(m_innerFs); diff --git a/src/fs/luks.h b/src/fs/luks.h index 4cc142e..81308a4 100644 --- a/src/fs/luks.h +++ b/src/fs/luks.h @@ -90,6 +90,8 @@ public: virtual QString readUUID(const QString& deviceNode) const; virtual bool updateUUID(Report& report, const QString& deviceNode) const; virtual bool resize(Report& report, const QString& deviceNode, qint64 length) const; + virtual QString readLabel(const QString& deviceNode) const; + virtual bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel); virtual QString mountTitle() const override; virtual QString unmountTitle() const override;