Add initial support for reading and writing innerFS labels.

This commit is contained in:
Andrius Štikonas 2016-04-21 21:19:49 +01:00
parent 8c1dd32baa
commit 33c049926f
Signed by: andrius
GPG Key ID: C86115C8091792EC
2 changed files with 19 additions and 2 deletions

View File

@ -69,6 +69,8 @@ luks::~luks()
void luks::init() void luks::init()
{ {
m_Create = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone; m_Create = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone;
m_SetLabel = cmdSupportFileSystem;
m_GetLabel = cmdSupportFileSystem;
m_UpdateUUID = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone; m_UpdateUUID = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone; m_Grow = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone;
m_Copy = cmdSupportCore; m_Copy = cmdSupportCore;
@ -126,8 +128,8 @@ bool luks::supportToolFound() const
{ {
return return
// m_GetUsed != cmdSupportNone && // m_GetUsed != cmdSupportNone &&
// m_GetLabel != cmdSupportNone && m_GetLabel != cmdSupportNone &&
// m_SetLabel != cmdSupportNone && m_SetLabel != cmdSupportNone &&
m_Create != cmdSupportNone && m_Create != cmdSupportNone &&
// m_Check != cmdSupportNone && // m_Check != cmdSupportNone &&
m_UpdateUUID != cmdSupportNone && m_UpdateUUID != cmdSupportNone &&
@ -426,6 +428,19 @@ FileSystem::Type luks::type() const
return FileSystem::Luks; 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 bool luks::resize(Report& report, const QString& deviceNode, qint64) const
{ {
Q_ASSERT(m_innerFs); Q_ASSERT(m_innerFs);

View File

@ -90,6 +90,8 @@ public:
virtual QString readUUID(const QString& deviceNode) const; virtual QString readUUID(const QString& deviceNode) const;
virtual bool updateUUID(Report& report, 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 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 mountTitle() const override;
virtual QString unmountTitle() const override; virtual QString unmountTitle() const override;