Add support for fatresize program.

This commit is contained in:
Andrius Štikonas 2017-11-09 23:14:52 +00:00
parent d3cde41df0
commit fcfd78cdc4
2 changed files with 9 additions and 0 deletions

View File

@ -60,6 +60,8 @@ void fat16::init()
m_Copy = cmdSupportCore;
m_Backup = cmdSupportCore;
m_UpdateUUID = findExternal(QStringLiteral("dd")) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = findExternal(QStringLiteral("fatresize")) ? cmdSupportFileSystem : cmdSupportNone;
m_Shrink = findExternal(QStringLiteral("fatresize")) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUUID = cmdSupportCore;
}
@ -157,6 +159,12 @@ bool fat16::create(Report& report, const QString& deviceNode)
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool fat16::resize(Report& report, const QString& deviceNode, qint64 length) const
{
ExternalCommand cmd(report, QStringLiteral("fatresize"), { QStringLiteral("--verbose"), QStringLiteral("--size"), QString::number(length), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool fat16::updateUUID(Report& report, const QString& deviceNode) const
{
qint64 t = time(nullptr);

View File

@ -47,6 +47,7 @@ public:
bool create(Report& report, const QString& deviceNode) override;
bool updateUUID(Report& report, const QString& deviceNode) const override;
bool writeLabel(Report& report, const QString& deviceNode, const QString& newLabel) override;
bool resize(Report& report, const QString& deviceNode, qint64 length) const override;
CommandSupportType supportGetUsed() const override {
return m_GetUsed;