#include <QString>
#include <QStringList>
#include <QFile>
-#include <QUuid>
#include <ctime>
#include <algorithm>
m_Create = findExternal("mkfs.ntfs") ? cmdSupportFileSystem : cmdSupportNone;
m_Copy = findExternal("ntfsclone") ? cmdSupportFileSystem : cmdSupportNone;
m_Backup = cmdSupportCore;
- m_UpdateUUID = findExternal("dd") ? cmdSupportFileSystem : cmdSupportNone;
+ m_UpdateUUID = m_SetLabel;
m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_GetUUID = cmdSupportCore;
}
FileSystem::SupportTool ntfs::supportToolName() const
{
- return SupportTool("ntfsprogs", KUrl("http://www.tuxera.com/community/open-source-ntfs-3g/"));
+ return SupportTool("ntfs-3g", KUrl("https://github.com/tuxera/ntfs-3g"));
}
qint64 ntfs::minCapacity() const
bool ntfs::copy(Report& report, const QString& targetDeviceNode, const QString& sourceDeviceNode) const
{
- ExternalCommand cmd(report, "ntfsclone", QStringList() << "-f" << "--overwrite" << targetDeviceNode << sourceDeviceNode);
+ ExternalCommand cmd(report, "ntfsclone", QStringList() << "-f" << "--overwrite" << targetDeviceNode << sourceDeviceNode);
- return cmd.run(-1) && cmd.exitCode() == 0;
+ return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ntfs::resize(Report& report, const QString& deviceNode, qint64 length) const
bool ntfs::updateUUID(Report& report, const QString& deviceNode) const
{
- QUuid uuid = QUuid::createUuid();
-
- ExternalCommand cmd(report, "dd", QStringList() << "of=" + deviceNode << "bs=1" << "count=8" << "seek=72");
-
- if (!cmd.start())
- return false;
+ ExternalCommand cmd(report, "ntfslabel", QStringList() << "--new-serial" << deviceNode);
- if (cmd.write(reinterpret_cast<char*>(&uuid.data4[0]), 8) != 8)
- return false;
-
- return cmd.waitFor(-1);
+ return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ntfs::updateBootSector(Report& report, const QString& deviceNode) const