Add support for checking innerFS.

This commit is contained in:
Andrius Štikonas 2016-04-26 13:26:40 +01:00
parent d5438ba007
commit d87ac7dc20
2 changed files with 19 additions and 2 deletions

View File

@ -73,6 +73,7 @@ void luks::init()
m_GetLabel = cmdSupportFileSystem;
m_UpdateUUID = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = findExternal(QStringLiteral("cryptsetup")) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = cmdSupportCore;
m_Copy = cmdSupportCore;
m_Move = cmdSupportCore;
m_Backup = cmdSupportCore;
@ -131,7 +132,7 @@ bool luks::supportToolFound() const
m_GetLabel != cmdSupportNone &&
m_SetLabel != cmdSupportNone &&
m_Create != cmdSupportNone &&
// m_Check != cmdSupportNone &&
m_Check != cmdSupportNone &&
m_UpdateUUID != cmdSupportNone &&
m_Grow != cmdSupportNone &&
// m_Shrink != cmdSupportNone &&
@ -336,6 +337,17 @@ void luks::createInnerFileSystem(FileSystem::Type type)
m_innerFs = FileSystemFactory::cloneWithNewType(type, *this);
}
bool luks::check(Report& report, const QString& deviceNode) const
{
Q_ASSERT(m_innerFs);
QString mapperNode = mapperName(deviceNode);
if (mapperNode.isEmpty())
return false;
return m_innerFs->check(report, mapperNode);
}
bool luks::mount(const QString& deviceNode, const QString& mountPoint)
{
if (!m_isCryptOpen)

View File

@ -73,7 +73,11 @@ public:
return m_Move;
}
virtual CommandSupportType supportCheck() const {
return m_Check;
if (!m_isCryptOpen)
return cmdSupportNone;
if (m_Check && m_innerFs)
return m_innerFs->supportShrink();
return cmdSupportNone;
}
virtual CommandSupportType supportCopy() const {
return m_Copy;
@ -91,6 +95,7 @@ public:
return m_GetUUID;
}
virtual bool check(Report& report, const QString& deviceNode) const override;
virtual bool create(Report &report, const QString &deviceNode) const override;
virtual qint64 minCapacity() const;
virtual SupportTool supportToolName() const;