Merge branch 'master' into luks-decorator

This commit is contained in:
Andrius Štikonas 2016-04-21 22:56:30 +01:00
commit 2e7055aa69
78 changed files with 172 additions and 171 deletions

View File

@ -23,7 +23,7 @@
#include "../fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class CoreBackendPartition;
class Report;

View File

@ -19,7 +19,7 @@
#define COPYSOURCE__H
#include <qglobal.h>
#include <QtGlobal>
class CopyTarget;

View File

@ -22,7 +22,7 @@
#include "../core/copysource.h"
#include "../util/libpartitionmanagerexport.h"
#include <qglobal.h>
#include <QtGlobal>
class Device;
class CopyTarget;

View File

@ -21,7 +21,7 @@
#include "../core/copysource.h"
#include <qglobal.h>
#include <QtGlobal>
#include <QFile>
class QString;

View File

@ -19,7 +19,7 @@
#define COPYTARGET__H
#include <qglobal.h>
#include <QtGlobal>
/** Base class for something to copy to.

View File

@ -22,7 +22,7 @@
#include "../core/copytarget.h"
#include "../util/libpartitionmanagerexport.h"
#include <qglobal.h>
#include <QtGlobal>
class Device;
class CoreBackendDevice;

View File

@ -21,7 +21,7 @@
#include "../core/copytarget.h"
#include <qglobal.h>
#include <QtGlobal>
#include <QFile>
class QString;

View File

@ -23,7 +23,7 @@
#include <QString>
#include <QObject>
#include <qglobal.h>
#include <QtGlobal>
class PartitionTable;
class CreatePartitionTableOperation;

View File

@ -23,7 +23,7 @@
#include <QString>
#include <QStringList>
#include <qglobal.h>
#include <QtGlobal>
struct mntent;

View File

@ -23,7 +23,7 @@
#include <QThread>
#include <QMutex>
#include <qglobal.h>
#include <QtGlobal>
class Operation;
class OperationStack;

View File

@ -25,7 +25,7 @@
#include <QList>
#include <QReadWriteLock>
#include <qglobal.h>
#include <QtGlobal>
class Device;
class Partition;

View File

@ -26,7 +26,7 @@
#include "../util/libpartitionmanagerexport.h"
#include <QStringList>
#include <qglobal.h>
#include <QtGlobal>
class Device;
class OperationStack;

View File

@ -19,7 +19,7 @@
#define PARTITIONALIGNMENT__H
#include "qglobal.h"
#include "QtGlobal"
#include "../util/libpartitionmanagerexport.h"

View File

@ -23,7 +23,7 @@
#include <QObject>
#include <QList>
#include <qglobal.h>
#include <QtGlobal>
class Partition;
class PartitionRole;

View File

@ -22,7 +22,7 @@
#include "../util/libpartitionmanagerexport.h"
#include <qglobal.h>
#include <QtGlobal>
class QString;

View File

@ -26,7 +26,7 @@
#include "../core/partitionrole.h"
#include <QList>
#include <qglobal.h>
#include <QtGlobal>
class Device;
class Partition;

View File

@ -21,7 +21,7 @@
#include "../util/libpartitionmanagerexport.h"
#include <qglobal.h>
#include <QtGlobal>
#include <QString>
#include <QList>

View File

@ -106,7 +106,8 @@ qint64 btrfs::maxLabelLength() const
qint64 btrfs::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("btrfs"), QStringList() << QStringLiteral("filesystem") << QStringLiteral("show") << QStringLiteral("--raw") << deviceNode);
ExternalCommand cmd(QStringLiteral("btrfs"),
{ QStringLiteral("filesystem"), QStringLiteral("show"), QStringLiteral("--raw"), deviceNode });
if (cmd.run()) {
QRegExp rxBytesUsed(QStringLiteral(" used (\\d+) path ") + deviceNode);
@ -120,13 +121,13 @@ qint64 btrfs::readUsedCapacity(const QString& deviceNode) const
bool btrfs::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("btrfsck"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("btrfsck"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool btrfs::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.btrfs"), QStringList() << QStringLiteral("-f") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.btrfs"), { QStringLiteral("--force"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
@ -140,18 +141,19 @@ bool btrfs::resize(Report& report, const QString& deviceNode, qint64 length) con
bool rval = false;
ExternalCommand mountCmd(report, QStringLiteral("mount"), QStringList() << QStringLiteral("-v") << QStringLiteral("-t") << QStringLiteral("btrfs") << deviceNode << tempDir.path());
ExternalCommand mountCmd(report, QStringLiteral("mount"),
{ QStringLiteral("--verbose"), QStringLiteral("--types"), QStringLiteral("btrfs"), deviceNode, tempDir.path() });
if (mountCmd.run(-1) && mountCmd.exitCode() == 0) {
QString len = length == -1 ? QStringLiteral("max") : QString::number(length);
ExternalCommand resizeCmd(report, QStringLiteral("btrfs"), QStringList() << QStringLiteral("filesystem") << QStringLiteral("resize") << len << tempDir.path());
ExternalCommand resizeCmd(report, QStringLiteral("btrfs"), { QStringLiteral("filesystem"), QStringLiteral("resize"), len, tempDir.path() });
if (resizeCmd.run(-1) && resizeCmd.exitCode() == 0)
rval = true;
else
report.line() << xi18nc("@info/plain", "Resizing Btrfs file system on partition <filename>%1</filename> failed: btrfs file system resize failed.", deviceNode);
ExternalCommand unmountCmd(report, QStringLiteral("umount"), QStringList() << tempDir.path());
ExternalCommand unmountCmd(report, QStringLiteral("umount"), { tempDir.path() });
if (!unmountCmd.run(-1) && unmountCmd.exitCode() == 0)
report.line() << xi18nc("@info/plain", "Warning: Resizing Btrfs file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
@ -163,7 +165,7 @@ bool btrfs::resize(Report& report, const QString& deviceNode, qint64 length) con
bool btrfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("btrfs"), QStringList() << QStringLiteral("filesystem") << QStringLiteral("label") << deviceNode << newLabel);
ExternalCommand cmd(report, QStringLiteral("btrfs"), { QStringLiteral("filesystem"), QStringLiteral("label"), deviceNode, newLabel });
return cmd.run(-1) && cmd.exitCode() == 0;
}

View File

@ -24,7 +24,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -95,19 +95,19 @@ qint64 exfat::maxLabelLength() const
bool exfat::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("exfatfsck"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("exfatfsck"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool exfat::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.exfat"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.exfat"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool exfat::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("exfatlabel"), QStringList() << deviceNode << newLabel);
ExternalCommand cmd(report, QStringLiteral("exfatlabel"), { deviceNode, newLabel });
return cmd.run(-1) && cmd.exitCode() == 0;
}

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -50,7 +50,7 @@ void ext2::init()
m_GetLabel = cmdSupportCore;
m_SetLabel = findExternal(QStringLiteral("e2label")) ? cmdSupportFileSystem : cmdSupportNone;
m_Create = findExternal(QStringLiteral("mkfs.ext2")) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("e2fsck"), QStringList() << QStringLiteral("-V")) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("e2fsck"), { QStringLiteral("-V") }) ? cmdSupportFileSystem : cmdSupportNone;
m_UpdateUUID = findExternal(QStringLiteral("tune2fs")) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("resize2fs"))) ? cmdSupportFileSystem : cmdSupportNone;
m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed) != cmdSupportNone ? cmdSupportFileSystem : cmdSupportNone;
@ -94,7 +94,7 @@ qint64 ext2::maxLabelLength() const
qint64 ext2::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("dumpe2fs"), QStringList() << QStringLiteral("-h") << deviceNode);
ExternalCommand cmd(QStringLiteral("dumpe2fs"), { QStringLiteral("-h"), deviceNode });
if (cmd.run()) {
qint64 blockCount = -1;
@ -124,20 +124,20 @@ qint64 ext2::readUsedCapacity(const QString& deviceNode) const
bool ext2::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("e2fsck"), QStringList() << QStringLiteral("-f") << QStringLiteral("-y") << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("e2fsck"), { QStringLiteral("-f"), QStringLiteral("-y"), QStringLiteral("-v"), deviceNode });
return cmd.run(-1) && (cmd.exitCode() == 0 || cmd.exitCode() == 1 || cmd.exitCode() == 2 || cmd.exitCode() == 256);
}
bool ext2::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.ext2"), QStringList() << QStringLiteral("-qF") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.ext2"), { QStringLiteral("-qF"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ext2::resize(Report& report, const QString& deviceNode, qint64 length) const
{
const QString len = QString::number(length / 512) + QStringLiteral("s");
const QStringList command = length == -1 ? QStringList() << deviceNode : QStringList() << deviceNode << len;
const QStringList command = length == -1 ? QStringList() << deviceNode : QStringList() << deviceNode << len;
ExternalCommand cmd(report, QStringLiteral("resize2fs"), command);
return cmd.run(-1) && cmd.exitCode() == 0;
@ -145,13 +145,13 @@ bool ext2::resize(Report& report, const QString& deviceNode, qint64 length) cons
bool ext2::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("e2label"), QStringList() << deviceNode << newLabel);
ExternalCommand cmd(report, QStringLiteral("e2label"), { deviceNode, newLabel });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ext2::updateUUID(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("tune2fs"), QStringList() << QStringLiteral("-U") << QStringLiteral("random") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("tune2fs"), { QStringLiteral("-U"), QStringLiteral("random"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -23,7 +23,7 @@
#include "fs/ext2.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -23,7 +23,7 @@
#include "fs/ext2.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class QString;

View File

@ -109,13 +109,13 @@ qint64 f2fs::maxLabelLength() const
bool f2fs::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("fsck.f2fs"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("fsck.f2fs"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool f2fs::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.f2fs"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -53,7 +53,7 @@ fat16::fat16(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QS
void fat16::init()
{
m_Create = findExternal(QStringLiteral("mkfs.msdos")) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = m_Check = findExternal(QStringLiteral("fsck.msdos"), QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = m_Check = findExternal(QStringLiteral("fsck.msdos"), {}, 2) ? cmdSupportFileSystem : cmdSupportNone;
m_GetLabel = cmdSupportCore;
m_SetLabel = findExternal(QStringLiteral("fatlabel")) ? cmdSupportFileSystem : cmdSupportNone;
m_Move = cmdSupportCore;
@ -104,7 +104,7 @@ qint64 fat16::maxLabelLength() const
qint64 fat16::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("fsck.msdos"), QStringList() << QStringLiteral("-n") << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(QStringLiteral("fsck.msdos"), { QStringLiteral("-n"), QStringLiteral("-v"), deviceNode });
if (cmd.run()) {
qint64 usedClusters = -1;
@ -131,19 +131,19 @@ bool fat16::writeLabel(Report& report, const QString& deviceNode, const QString&
{
report.line() << xi18nc("@info/plain", "Setting label for partition <filename>%1</filename> to %2", deviceNode, newLabel);
ExternalCommand cmd(report, QStringLiteral("fatlabel"), QStringList() << deviceNode << newLabel);
ExternalCommand cmd(report, QStringLiteral("fatlabel"), { deviceNode, newLabel });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool fat16::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("fsck.msdos"), QStringList() << QStringLiteral("-a") << QStringLiteral("-w") << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("fsck.msdos"), { QStringLiteral("-a"), QStringLiteral("-w"), QStringLiteral("-v"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool fat16::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.msdos"), QStringList() << QStringLiteral("-F16") << QStringLiteral("-I") << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.msdos"), { QStringLiteral("-F16"), QStringLiteral("-I"), QStringLiteral("-v"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
@ -155,7 +155,7 @@ bool fat16::updateUUID(Report& report, const QString& deviceNode) const
for (quint32 i = 0; i < sizeof(uuid); i++, t >>= 8)
uuid[i] = t & 0xff;
ExternalCommand cmd(report, QStringLiteral("dd"), QStringList() << QStringLiteral("of=") + deviceNode << QStringLiteral("bs=1") << QStringLiteral("count=4") << QStringLiteral("seek=39"));
ExternalCommand cmd(report, QStringLiteral("dd"), { QStringLiteral("of=") + deviceNode , QStringLiteral("bs=1"), QStringLiteral("count=4"), QStringLiteral("seek=39") });
if (!cmd.start())
return false;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -42,7 +42,7 @@ qint64 fat32::maxCapacity() const
bool fat32::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.msdos"), QStringList() << QStringLiteral("-F32") << QStringLiteral("-I") << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.msdos"), { QStringLiteral("-F32"), QStringLiteral("-I"), QStringLiteral("-v"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
@ -54,7 +54,7 @@ bool fat32::updateUUID(Report& report, const QString& deviceNode) const
for (quint32 i = 0; i < sizeof(uuid); i++, t >>= 8)
uuid[i] = t & 0xff;
ExternalCommand cmd(report, QStringLiteral("dd"), QStringList() << QStringLiteral("of=") + deviceNode << QStringLiteral("bs=1") << QStringLiteral("count=4") << QStringLiteral("seek=67"));
ExternalCommand cmd(report, QStringLiteral("dd"), { QStringLiteral("of=") + deviceNode, QStringLiteral("bs=1"), QStringLiteral("count=4"), QStringLiteral("seek=67") });
if (!cmd.start())
return false;

View File

@ -23,7 +23,7 @@
#include "fs/fat16.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -22,7 +22,7 @@
#define FILESYSTEM__H
#include "../util/libpartitionmanagerexport.h"
#include <qglobal.h>
#include <QtGlobal>
#include <QColor>
#include <QStringList>
#include <QString>

View File

@ -24,7 +24,7 @@
#include "../util/libpartitionmanagerexport.h"
#include <QMap>
#include <qglobal.h>
#include <QtGlobal>
class QString;

View File

@ -84,13 +84,13 @@ qint64 hfs::maxLabelLength() const
bool hfs::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("hfsck"), QStringList() << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("hfsck"), { QStringLiteral("-v"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool hfs::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("hformat"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("hformat"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -79,7 +79,7 @@ qint64 hfsplus::maxLabelLength() const
bool hfsplus::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("hpfsck"), QStringList() << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("hpfsck"), { QStringLiteral("-v"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -50,9 +50,9 @@ void jfs::init()
{
m_GetUsed = findExternal(QStringLiteral("jfs_debugfs")) ? cmdSupportFileSystem : cmdSupportNone;
m_GetLabel = cmdSupportCore;
m_SetLabel = findExternal(QStringLiteral("jfs_tune"), QStringList() << QStringLiteral("-V")) ? cmdSupportFileSystem : cmdSupportNone;
m_Create = findExternal(QStringLiteral("mkfs.jfs"), QStringList() << QStringLiteral("-V")) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = m_Check = findExternal(QStringLiteral("fsck.jfs"), QStringList() << QStringLiteral("-V")) ? cmdSupportFileSystem : cmdSupportNone;
m_SetLabel = findExternal(QStringLiteral("jfs_tune"), { QStringLiteral("-V") }) ? cmdSupportFileSystem : cmdSupportNone;
m_Create = findExternal(QStringLiteral("mkfs.jfs"),{ QStringLiteral("-V") }) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = m_Check = findExternal(QStringLiteral("fsck.jfs"), { QStringLiteral("-V") }) ? cmdSupportFileSystem : cmdSupportNone;
m_Copy = m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Backup = cmdSupportCore;
}
@ -133,19 +133,19 @@ qint64 jfs::readUsedCapacity(const QString& deviceNode) const
bool jfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("jfs_tune"), QStringList() << QStringLiteral("-L") << newLabel << deviceNode);
ExternalCommand cmd(report, QStringLiteral("jfs_tune"), { QStringLiteral("-L"), newLabel, deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool jfs::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("fsck.jfs"), QStringList() << QStringLiteral("-f") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("fsck.jfs"), { QStringLiteral("-f"), deviceNode });
return cmd.run(-1) && (cmd.exitCode() == 0 || cmd.exitCode() == 1);
}
bool jfs::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.jfs"), QStringList() << QStringLiteral("-q") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.jfs"), { QStringLiteral("-q"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
@ -159,17 +159,17 @@ bool jfs::resize(Report& report, const QString& deviceNode, qint64) const
bool rval = false;
ExternalCommand mountCmd(report, QStringLiteral("mount"), QStringList() << QStringLiteral("-v") << QStringLiteral("-t") << QStringLiteral("jfs") << deviceNode << tempDir.path());
ExternalCommand mountCmd(report, QStringLiteral("mount"), { QStringLiteral("-v"), QStringLiteral("-t"), QStringLiteral("jfs"), deviceNode, tempDir.path() });
if (mountCmd.run(-1)) {
ExternalCommand resizeMountCmd(report, QStringLiteral("mount"), QStringList() << QStringLiteral("-v") << QStringLiteral("-t") << QStringLiteral("jfs") << QStringLiteral("-o") << QStringLiteral("remount,resize") << deviceNode << tempDir.path());
ExternalCommand resizeMountCmd(report, QStringLiteral("mount"), { QStringLiteral("-v"), QStringLiteral("-t"), QStringLiteral("jfs"), QStringLiteral("-o"), QStringLiteral("remount,resize"), deviceNode, tempDir.path() });
if (resizeMountCmd.run(-1))
rval = true;
else
report.line() << xi18nc("@info/plain", "Resizing JFS file system on partition <filename>%1</filename> failed: Remount failed.", deviceNode);
ExternalCommand unmountCmd(report, QStringLiteral("umount"), QStringList() << tempDir.path());
ExternalCommand unmountCmd(report, QStringLiteral("umount"), { tempDir.path() });
if (!unmountCmd.run(-1))
report.line() << xi18nc("@info/plain", "Warning: Resizing JFS file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -77,7 +77,7 @@ qint64 linuxswap::maxLabelLength() const
bool linuxswap::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkswap"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkswap"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
@ -89,9 +89,9 @@ bool linuxswap::resize(Report& report, const QString& deviceNode, qint64 length)
QStringList args;
if (!label.isEmpty())
args << QStringLiteral("-L") << label;
args << QStringLiteral("--label") << label;
if (!uuid.isEmpty())
args << QStringLiteral("-U") << uuid;
args << QStringLiteral("--uuid") << uuid;
args << deviceNode;
@ -106,9 +106,9 @@ bool linuxswap::copy(Report& report, const QString& targetDeviceNode, const QStr
QStringList args;
if (!label.isEmpty())
args << QStringLiteral("-L") << label;
args << QStringLiteral("--label") << label;
if (!uuid.isEmpty())
args << QStringLiteral("-U") << uuid;
args << QStringLiteral("--uuid") << uuid;
args << targetDeviceNode;
@ -118,7 +118,7 @@ bool linuxswap::copy(Report& report, const QString& targetDeviceNode, const QStr
bool linuxswap::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("mkswap"), QStringList() << QStringLiteral("-L") << newLabel << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkswap"), { QStringLiteral("--label"), newLabel, deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
@ -135,14 +135,13 @@ QString linuxswap::unmountTitle() const
bool linuxswap::mount(const QString& deviceNode, const QString& mountPoint)
{
Q_UNUSED(mountPoint);
ExternalCommand cmd(QStringLiteral("swapon"), QStringList() << deviceNode);
ExternalCommand cmd(QStringLiteral("swapon"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool linuxswap::unmount(const QString& deviceNode)
{
ExternalCommand cmd(QStringLiteral("swapoff"), QStringList() << deviceNode);
ExternalCommand cmd(QStringLiteral("swapoff"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
@ -152,7 +151,7 @@ bool linuxswap::updateUUID(Report& report, const QString& deviceNode) const
QStringList args;
if (!label.isEmpty())
args << QStringLiteral("-L") << label;
args << QStringLiteral("--label") << label;
args << deviceNode;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -449,7 +449,7 @@ bool luks::resize(Report& report, const QString& deviceNode, qint64) const
if (mapperNode.isEmpty())
return false;
ExternalCommand cryptResizeCmd(report, QStringLiteral("cryptsetup"), QStringList() << QStringLiteral("resize") << mapperNode);
ExternalCommand cryptResizeCmd(report, QStringLiteral("cryptsetup"), { QStringLiteral("resize"), mapperNode });
report.line() << xi18nc("@info/plain", "Resizing LUKS crypt on partition <filename>%1</filename>.", deviceNode);
bool rval = false;

View File

@ -88,26 +88,26 @@ qint64 lvm2_pv::maxCapacity() const
bool lvm2_pv::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("lvm"), QStringList() << QStringLiteral("pvck") << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvck"), QStringLiteral("--verbose"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool lvm2_pv::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("lvm"), QStringList() << QStringLiteral("pvcreate") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvcreate"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool lvm2_pv::remove(Report& report, const QString& deviceNode) const
{
// TODO: check if PV is a member of an exported VG
ExternalCommand cmd(report, QStringLiteral("lvm"), QStringList() << QStringLiteral("pvremove") << QStringLiteral("-ffy") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvremove"), QStringLiteral("--force"), QStringLiteral("--force"), QStringLiteral("--yes"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool lvm2_pv::updateUUID(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("lvm"), QStringList() << QStringLiteral("pvchange") << QStringLiteral("-u") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("lvm"), { QStringLiteral("pvchange"), QStringLiteral("--uuid"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -24,7 +24,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -110,19 +110,19 @@ qint64 nilfs2::maxLabelLength() const
bool nilfs2::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("fsck.nilfs2"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("fsck.nilfs2"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool nilfs2::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.nilfs2"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.nilfs2"), { deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
qint64 nilfs2::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("nilfs-tune"), QStringList() << QStringLiteral("-l") << deviceNode);
ExternalCommand cmd(QStringLiteral("nilfs-tune"), { QStringLiteral("-l"), deviceNode });
if (cmd.run()) {
QRegExp rxBlockSize(QStringLiteral("(?:Block size:\\s+)(\\d+)"));
@ -145,17 +145,17 @@ bool nilfs2::resize(Report& report, const QString& deviceNode, qint64 length) co
bool rval = false;
ExternalCommand mountCmd(report, QStringLiteral("mount"), QStringList() << QStringLiteral("-v") << QStringLiteral("-t") << QStringLiteral("nilfs2") << deviceNode << tempDir.path());
ExternalCommand mountCmd(report, QStringLiteral("mount"), { QStringLiteral("--verbose"), QStringLiteral("--types"), QStringLiteral("nilfs2"), deviceNode, tempDir.path() });
if (mountCmd.run(-1) && mountCmd.exitCode() == 0) {
ExternalCommand resizeCmd(report, QStringLiteral("nilfs-resize"), QStringList() << QStringLiteral("-v") << QStringLiteral("-y") << deviceNode << QString::number(length));
ExternalCommand resizeCmd(report, QStringLiteral("nilfs-resize"), { QStringLiteral("--verbose"), QStringLiteral("--assume-yes"), deviceNode, QString::number(length) });
if (resizeCmd.run(-1) && resizeCmd.exitCode() == 0)
rval = true;
else
report.line() << xi18nc("@info/plain", "Resizing NILFS2 file system on partition <filename>%1</filename> failed: NILFS2 file system resize failed.", deviceNode);
ExternalCommand unmountCmd(report, QStringLiteral("umount"), QStringList() << tempDir.path());
ExternalCommand unmountCmd(report, QStringLiteral("umount"), { tempDir.path() });
if (!unmountCmd.run(-1) && unmountCmd.exitCode() == 0)
report.line() << xi18nc("@info/plain", "Warning: Resizing NILFS2 file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);
@ -167,14 +167,14 @@ bool nilfs2::resize(Report& report, const QString& deviceNode, qint64 length) co
bool nilfs2::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("nilfs-tune"), QStringList() << QStringLiteral("-l") << newLabel << deviceNode);
ExternalCommand cmd(report, QStringLiteral("nilfs-tune"), { QStringLiteral("-l"), newLabel, deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool nilfs2::updateUUID(Report& report, const QString& deviceNode) const
{
QUuid uuid = QUuid::createUuid();
ExternalCommand cmd(report, QStringLiteral("nilfs-tune"), QStringList() << QStringLiteral("-U") << uuid.toString() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("nilfs-tune"), { QStringLiteral("-U"), uuid.toString(), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -24,7 +24,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -105,7 +105,7 @@ qint64 ntfs::maxLabelLength() const
qint64 ntfs::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("ntfsresize"), QStringList() << QStringLiteral("--info") << QStringLiteral("--force") << QStringLiteral("--no-progress-bar") << deviceNode);
ExternalCommand cmd(QStringLiteral("ntfsresize"), { QStringLiteral("--info"), QStringLiteral("--force"), QStringLiteral("--no-progress-bar"), deviceNode });
if (cmd.run()) {
qint64 usedBytes = -1;
@ -123,13 +123,13 @@ qint64 ntfs::readUsedCapacity(const QString& deviceNode) const
bool ntfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand writeCmd(report, QStringLiteral("ntfslabel"), QStringList() << QStringLiteral("--force") << deviceNode << newLabel.simplified());
ExternalCommand writeCmd(report, QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode, newLabel.simplified() });
writeCmd.setProcessChannelMode(QProcess::SeparateChannels);
if (!writeCmd.run(-1))
return false;
ExternalCommand testCmd(QStringLiteral("ntfslabel"), QStringList() << QStringLiteral("--force") << deviceNode);
ExternalCommand testCmd(QStringLiteral("ntfslabel"), { QStringLiteral("--force"), deviceNode });
testCmd.setProcessChannelMode(QProcess::SeparateChannels);
if (!testCmd.run(-1))
@ -140,30 +140,29 @@ bool ntfs::writeLabel(Report& report, const QString& deviceNode, const QString&
bool ntfs::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("ntfsresize"), QStringList() << QStringLiteral("-P") << QStringLiteral("-i") << QStringLiteral("-f") << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("ntfsresize"), { QStringLiteral("--no-progress-bar"), QStringLiteral("--info"), QStringLiteral("--force"), QStringLiteral("--verbose"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ntfs::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.ntfs"), QStringList() << QStringLiteral("-f") << QStringLiteral("-vv") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.ntfs"), { QStringLiteral("--quick"), QStringLiteral("--verbose"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ntfs::copy(Report& report, const QString& targetDeviceNode, const QString& sourceDeviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("ntfsclone"), QStringList() << QStringLiteral("-f") << QStringLiteral("--overwrite") << targetDeviceNode << sourceDeviceNode);
ExternalCommand cmd(report, QStringLiteral("ntfsclone"), { QStringLiteral("--force"), QStringLiteral("--overwrite"), targetDeviceNode, sourceDeviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ntfs::resize(Report& report, const QString& deviceNode, qint64 length) const
{
QStringList args;
args << QStringLiteral("-P") << QStringLiteral("-f") << deviceNode << QStringLiteral("-s") << QString::number(length);
QStringList args = { QStringLiteral("--no-progress-bar"), QStringLiteral("--force"), deviceNode, QStringLiteral("--size"), QString::number(length) };
QStringList dryRunArgs = args;
dryRunArgs << QStringLiteral("-n");
dryRunArgs << QStringLiteral("--no-action");
ExternalCommand cmdDryRun(QStringLiteral("ntfsresize"), dryRunArgs);
if (cmdDryRun.run(-1) && cmdDryRun.exitCode() == 0) {
@ -176,6 +175,7 @@ bool ntfs::resize(Report& report, const QString& deviceNode, qint64 length) cons
bool ntfs::updateUUID(Report& report, const QString& deviceNode) const
{
Q_UNUSED(report);
QUuid uuid = QUuid::createUuid();
char* s = reinterpret_cast<char*>(&uuid.data4[0]);

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -46,16 +46,16 @@ ocfs2::ocfs2(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QS
void ocfs2::init()
{
m_Create = findExternal(QStringLiteral("mkfs.ocfs2"), QStringList() << QStringLiteral("-V")) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("fsck.ocfs2"), QStringList(), 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("tunefs.ocfs2"), QStringList() << QStringLiteral("-V")) && findExternal(QStringLiteral("debugfs.ocfs2"), QStringList() << QStringLiteral("-V"))) ? cmdSupportFileSystem : cmdSupportNone;
m_Create = findExternal(QStringLiteral("mkfs.ocfs2"), { QStringLiteral("--version") }) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("fsck.ocfs2"), {}, 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("tunefs.ocfs2"), { QStringLiteral("--version") }) && findExternal(QStringLiteral("debugfs.ocfs2"), { QStringLiteral("--version") })) ? cmdSupportFileSystem : cmdSupportNone;
m_Shrink = cmdSupportNone;
// TODO: it seems there's no way to get the FS usage with ocfs2
m_GetUsed = cmdSupportNone;
m_SetLabel = findExternal(QStringLiteral("tunefs.ocfs2"), QStringList() << QStringLiteral("-V")) ? cmdSupportFileSystem : cmdSupportNone;
m_UpdateUUID = findExternal(QStringLiteral("tunefs.ocfs2"), QStringList() << QStringLiteral("-V")) ? cmdSupportFileSystem : cmdSupportNone;
m_SetLabel = findExternal(QStringLiteral("tunefs.ocfs2"), { QStringLiteral("--version") }) ? cmdSupportFileSystem : cmdSupportNone;
m_UpdateUUID = findExternal(QStringLiteral("tunefs.ocfs2"), { QStringLiteral("--version") }) ? cmdSupportFileSystem : cmdSupportNone;
m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
@ -105,13 +105,13 @@ qint64 ocfs2::readUsedCapacity(const QString& deviceNode) const
bool ocfs2::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("fsck.ocfs2"), QStringList() << QStringLiteral("-f") << QStringLiteral("-y") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("fsck.ocfs2"), { QStringLiteral("-f"), QStringLiteral("-y"), deviceNode });
return cmd.run(-1) && (cmd.exitCode() == 0 || cmd.exitCode() == 1 || cmd.exitCode() == 2);
}
bool ocfs2::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.ocfs2"), QStringList() << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.ocfs2"), { deviceNode });
if (cmd.start())
{
@ -126,7 +126,7 @@ bool ocfs2::create(Report& report, const QString& deviceNode) const
bool ocfs2::resize(Report& report, const QString& deviceNode, qint64 length) const
{
ExternalCommand cmdBlockSize(QStringLiteral("debugfs.ocfs2"), QStringList() << QStringLiteral("-R") << QStringLiteral("stats") << deviceNode);
ExternalCommand cmdBlockSize(QStringLiteral("debugfs.ocfs2"), { QStringLiteral("--request"), QStringLiteral("stats"), deviceNode });
qint32 blockSize = -1;
if (cmdBlockSize.run()) {
@ -139,19 +139,19 @@ bool ocfs2::resize(Report& report, const QString& deviceNode, qint64 length) con
if (blockSize == -1)
return false;
ExternalCommand cmd(report, QStringLiteral("tunefs.ocfs2"), QStringList() << QStringLiteral("-y") << QStringLiteral("-S") << deviceNode << QString::number(length / blockSize));
ExternalCommand cmd(report, QStringLiteral("tunefs.ocfs2"), { QStringLiteral("--yes"), QStringLiteral("--volume-size"), deviceNode, QString::number(length / blockSize) });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ocfs2::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("tunefs.ocfs2"), QStringList() << QStringLiteral("-L") << newLabel << deviceNode);
ExternalCommand cmd(report, QStringLiteral("tunefs.ocfs2"), { QStringLiteral("--label"), newLabel, deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ocfs2::updateUUID(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("tunefs.ocfs2"), QStringList() << QStringLiteral("-U") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("tunefs.ocfs2"), { QStringLiteral("--uuid-reset"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -42,9 +42,9 @@ reiser4::reiser4(qint64 firstsector, qint64 lastsector, qint64 sectorsused, cons
void reiser4::init()
{
m_GetLabel = cmdSupportCore;
m_GetUsed = findExternal(QStringLiteral("debugfs.reiser4"), QStringList(), 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Create = findExternal(QStringLiteral("mkfs.reiser4"), QStringList(), 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("fsck.reiser4"), QStringList(), 16) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = findExternal(QStringLiteral("debugfs.reiser4"), {}, 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Create = findExternal(QStringLiteral("mkfs.reiser4"), {}, 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("fsck.reiser4"), {}, 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Move = m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Backup = cmdSupportCore;
}
@ -85,7 +85,7 @@ qint64 reiser4::maxLabelLength() const
qint64 reiser4::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("debugfs.reiser4"), QStringList() << deviceNode);
ExternalCommand cmd(QStringLiteral("debugfs.reiser4"), { deviceNode });
if (cmd.run()) {
qint64 blocks = -1;
@ -115,13 +115,13 @@ qint64 reiser4::readUsedCapacity(const QString& deviceNode) const
bool reiser4::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("fsck.reiser4"), QStringList() << QStringLiteral("--fix") << QStringLiteral("-y") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("fsck.reiser4"), { QStringLiteral("--yes"), QStringLiteral("--fix"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool reiser4::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.reiser4"), QStringList() << QStringLiteral("--yes") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.reiser4"), { QStringLiteral("--yes"), QStringLiteral("--force"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -49,12 +49,12 @@ reiserfs::reiserfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, co
void reiserfs::init()
{
m_GetLabel = cmdSupportCore;
m_GetUsed = findExternal(QStringLiteral("debugreiserfs"), QStringList(), 16) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = findExternal(QStringLiteral("debugreiserfs"), {}, 16) ? cmdSupportFileSystem : cmdSupportNone;
m_SetLabel = findExternal(QStringLiteral("reiserfstune")) ? cmdSupportFileSystem : cmdSupportNone;
m_Create = findExternal(QStringLiteral("mkfs.reiserfs")) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("fsck.reiserfs")) ? cmdSupportFileSystem : cmdSupportNone;
m_Move = m_Copy = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Grow = findExternal(QStringLiteral("resize_reiserfs"), QStringList(), 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = findExternal(QStringLiteral("resize_reiserfs"), {}, 16) ? cmdSupportFileSystem : cmdSupportNone;
m_Shrink = (m_GetUsed != cmdSupportNone && m_Grow != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
m_Backup = cmdSupportCore;
m_UpdateUUID = findExternal(QStringLiteral("reiserfstune")) ? cmdSupportFileSystem : cmdSupportNone;
@ -100,7 +100,7 @@ qint64 reiserfs::maxLabelLength() const
qint64 reiserfs::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("debugreiserfs"), QStringList() << deviceNode);
ExternalCommand cmd(QStringLiteral("debugreiserfs"), { deviceNode });
if (cmd.run()) {
qint64 blockCount = -1;
@ -130,25 +130,25 @@ qint64 reiserfs::readUsedCapacity(const QString& deviceNode) const
bool reiserfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("reiserfstune"), QStringList() << QStringLiteral("-l") << newLabel << deviceNode);
ExternalCommand cmd(report, QStringLiteral("reiserfstune"), { QStringLiteral("--label"), newLabel, deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool reiserfs::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("fsck.reiserfs"), QStringList() << QStringLiteral("--fix-fixable") << QStringLiteral("-q") << QStringLiteral("-y") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("fsck.reiserfs"), { QStringLiteral("--fix-fixable"), QStringLiteral("--quiet"), QStringLiteral("--yes"), deviceNode });
return cmd.run(-1) && (cmd.exitCode() == 0 || cmd.exitCode() == 1 || cmd.exitCode() == 256);
}
bool reiserfs::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.reiserfs"), QStringList() << QStringLiteral("-f") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.reiserfs"), { QStringLiteral("-f"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool reiserfs::resize(Report& report, const QString& deviceNode, qint64 length) const
{
ExternalCommand cmd(report, QStringLiteral("resize_reiserfs"), QStringList() << deviceNode << QStringLiteral("-q") << QStringLiteral("-s") << QString::number(length));
ExternalCommand cmd(report, QStringLiteral("resize_reiserfs"), { deviceNode, QStringLiteral("-q"), QStringLiteral("-s"), QString::number(length) });
bool rval = cmd.start(-1);
@ -164,7 +164,7 @@ bool reiserfs::resize(Report& report, const QString& deviceNode, qint64 length)
bool reiserfs::updateUUID(Report& report, const QString& deviceNode) const
{
const QString uuid = QUuid::createUuid().toString().remove(QRegExp(QStringLiteral("\\{|\\}")));
ExternalCommand cmd(report, QStringLiteral("reiserfstune"), QStringList() << QStringLiteral("-u") << uuid << deviceNode);
ExternalCommand cmd(report, QStringLiteral("reiserfstune"), { QStringLiteral("--uuid"), uuid, deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
}

View File

@ -25,7 +25,7 @@
#include "util/capacity.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class QString;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
namespace FS
{

View File

@ -55,7 +55,7 @@ void xfs::init()
m_Create = findExternal(QStringLiteral("mkfs.xfs")) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("xfs_repair")) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = (findExternal(QStringLiteral("xfs_growfs"), QStringList() << QStringLiteral("-V")) && m_Check != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = (findExternal(QStringLiteral("xfs_growfs"), { QStringLiteral("-V") }) && m_Check != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
m_Copy = findExternal(QStringLiteral("xfs_copy")) ? cmdSupportFileSystem : cmdSupportNone;
m_Move = (m_Check != cmdSupportNone) ? cmdSupportCore : cmdSupportNone;
m_Backup = cmdSupportCore;
@ -100,7 +100,7 @@ qint64 xfs::maxLabelLength() const
qint64 xfs::readUsedCapacity(const QString& deviceNode) const
{
ExternalCommand cmd(QStringLiteral("xfs_db"), QStringList() << QStringLiteral("-c") << QStringLiteral("sb 0") << QStringLiteral("-c") << QStringLiteral("print") << deviceNode);
ExternalCommand cmd(QStringLiteral("xfs_db"), { QStringLiteral("-c"), QStringLiteral("sb 0"), QStringLiteral("-c"), QStringLiteral("print"), deviceNode });
if (cmd.run()) {
qint64 dBlocks = -1;
@ -130,25 +130,25 @@ qint64 xfs::readUsedCapacity(const QString& deviceNode) const
bool xfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
ExternalCommand cmd(report, QStringLiteral("xfs_db"), QStringList() << QStringLiteral("-x") << QStringLiteral("-c") << QStringLiteral("sb 0") << QStringLiteral("-c") << QStringLiteral("label ") + newLabel << deviceNode);
ExternalCommand cmd(report, QStringLiteral("xfs_db"), { QStringLiteral("-x"), QStringLiteral("-c"), QStringLiteral("sb 0"), QStringLiteral("-c"), QStringLiteral("label ") + newLabel, deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool xfs::check(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("xfs_repair"), QStringList() << QStringLiteral("-v") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("xfs_repair"), { QStringLiteral("-v"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool xfs::create(Report& report, const QString& deviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("mkfs.xfs"), QStringList() << QStringLiteral("-f") << deviceNode);
ExternalCommand cmd(report, QStringLiteral("mkfs.xfs"), { QStringLiteral("-f"), deviceNode });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool xfs::copy(Report& report, const QString& targetDeviceNode, const QString& sourceDeviceNode) const
{
ExternalCommand cmd(report, QStringLiteral("xfs_copy"), QStringList() << sourceDeviceNode << targetDeviceNode);
ExternalCommand cmd(report, QStringLiteral("xfs_copy"), { sourceDeviceNode, targetDeviceNode });
// xfs_copy behaves a little strangely. It apparently kills itself at the end of main, causing QProcess
// to report that it crashed.
@ -169,17 +169,17 @@ bool xfs::resize(Report& report, const QString& deviceNode, qint64) const
bool rval = false;
ExternalCommand mountCmd(report, QStringLiteral("mount"), QStringList() << QStringLiteral("-v") << QStringLiteral("-t") << QStringLiteral("xfs") << deviceNode << tempDir.path());
ExternalCommand mountCmd(report, QStringLiteral("mount"), { QStringLiteral("--verbose"), QStringLiteral("--types"), QStringLiteral("xfs"), deviceNode, tempDir.path() });
if (mountCmd.run(-1)) {
ExternalCommand resizeCmd(report, QStringLiteral("xfs_growfs"), QStringList() << tempDir.path());
ExternalCommand resizeCmd(report, QStringLiteral("xfs_growfs"), { tempDir.path() });
if (resizeCmd.run(-1))
rval = true;
else
report.line() << xi18nc("@info/plain", "Resizing XFS file system on partition <filename>%1</filename> failed: xfs_growfs failed.", deviceNode);
ExternalCommand unmountCmd(report, QStringLiteral("umount"), QStringList() << tempDir.path());
ExternalCommand unmountCmd(report, QStringLiteral("umount"), { tempDir.path() });
if (!unmountCmd.run(-1))
report.line() << xi18nc("@info/plain", "Warning: Resizing XFS file system on partition <filename>%1</filename>: Unmount failed.", deviceNode);

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -46,7 +46,7 @@ zfs::zfs(qint64 firstsector, qint64 lastsector, qint64 sectorsused, const QStrin
void zfs::init()
{
m_SetLabel = findExternal(QStringLiteral("zpool"), QStringList(), 2) ? cmdSupportFileSystem : cmdSupportNone;
m_SetLabel = findExternal(QStringLiteral("zpool"), {}, 2) ? cmdSupportFileSystem : cmdSupportNone;
m_GetLabel = cmdSupportCore;
m_Backup = cmdSupportCore;
@ -88,16 +88,15 @@ qint64 zfs::maxCapacity() const
bool zfs::remove(Report& report, const QString& deviceNode) const
{
Q_UNUSED(deviceNode)
// TODO: check if -f option is needed
ExternalCommand cmd(report, QStringLiteral("zpool"), QStringList() << QStringLiteral("destroy") << QStringLiteral("-f") << this->label());
ExternalCommand cmd(report, QStringLiteral("zpool"), { QStringLiteral("destroy"), QStringLiteral("-f"), label() });
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool zfs::writeLabel(Report& report, const QString& deviceNode, const QString& newLabel)
{
Q_UNUSED(deviceNode)
ExternalCommand cmd1(report, QStringLiteral("zpool"), QStringList() << QStringLiteral("export") << this->label());
ExternalCommand cmd2(report, QStringLiteral("zpool"), QStringList() << QStringLiteral("import") << this->label() << newLabel);
ExternalCommand cmd1(report, QStringLiteral("zpool"), { QStringLiteral("export"), label() });
ExternalCommand cmd2(report, QStringLiteral("zpool"), { QStringLiteral("import"), label(), newLabel });
return cmd1.run(-1) && cmd1.exitCode() == 0 && cmd2.run(-1) && cmd2.exitCode() == 0;
}
}

View File

@ -24,7 +24,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -21,7 +21,7 @@
#include "jobs/job.h"
#include <qglobal.h>
#include <QtGlobal>
class Partition;
class Device;

View File

@ -24,7 +24,7 @@
#include "../util/libpartitionmanagerexport.h"
#include <QObject>
#include <qglobal.h>
#include <QtGlobal>
class QString;
class QIcon;

View File

@ -21,7 +21,7 @@
#include "jobs/job.h"
#include <qglobal.h>
#include <QtGlobal>
class Partition;
class Device;

View File

@ -23,7 +23,7 @@
#include <QObject>
#include <QList>
#include <qglobal.h>
#include <QtGlobal>
class Partition;
class Device;

View File

@ -21,7 +21,7 @@
#include "backend/corebackenddevice.h"
#include <qglobal.h>
#include <QtGlobal>
class Partition;
class PartitionTable;

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
class CoreBackendPartition;
class Report;

View File

@ -31,7 +31,7 @@
#include <QList>
#include <QVariant>
#include <qglobal.h>
#include <QtGlobal>
class LibPartedDevice;
class LibPartedPartitionTable;

View File

@ -21,7 +21,7 @@
#include "backend/corebackenddevice.h"
#include <qglobal.h>
#include <QtGlobal>
#include <parted/parted.h>

View File

@ -123,7 +123,7 @@ static const struct {
{ FileSystem::Ntfs, QStringLiteral("ntfs") },
{ FileSystem::Exfat, QStringLiteral("ntfs") },
{ FileSystem::ReiserFS, QStringLiteral("reiserfs") },
{ FileSystem::Reiser4, QStringLiteral("reiser4") },
{ FileSystem::Reiser4, QStringLiteral("reiserfs") },
{ FileSystem::Xfs, QStringLiteral("xfs") },
{ FileSystem::Jfs, QStringLiteral("jfs") },
{ FileSystem::Hfs, QStringLiteral("hfs") },
@ -252,7 +252,8 @@ bool LibPartedPartitionTable::clobberFileSystem(Report& report, const Partition&
if (pedPartition->type == PED_PARTITION_NORMAL || pedPartition->type == PED_PARTITION_LOGICAL) {
if (ped_device_open(pedDevice())) {
//reiser4 stores "ReIsEr4" at sector 128 with a sector size of 512 bytes
rval = ped_geometry_write(&pedPartition->geom, "0000000", 65536 / pedDevice()->sector_size, 1);
char zeroes[pedDevice()->sector_size*129] = {0};
rval = ped_geometry_write(&pedPartition->geom, zeroes, 0, 129);
if (!rval)
report.line() << xi18nc("@info/plain", "Failed to erase filesystem signature on partition <filename>%1</filename>.", partition.deviceNode());

View File

@ -23,7 +23,7 @@
#include "fs/filesystem.h"
#include <qglobal.h>
#include <QtGlobal>
#include <parted/parted.h>

View File

@ -23,7 +23,7 @@
class Partition;
class Device;
#include <qglobal.h>
#include <QtGlobal>
/** Represent any kind of capacity.

View File

@ -26,7 +26,7 @@
#include <QProcess>
#include <QStringList>
#include <QString>
#include <qglobal.h>
#include <QtGlobal>
class Report;

View File

@ -23,7 +23,7 @@
#include <QString>
#include <QObject>
#include <qglobal.h>
#include <QtGlobal>
class LIBKPMCORE_EXPORT Log
{

View File

@ -29,7 +29,7 @@
#include <KAboutData>
#include <KLocalizedString>
#include <kxmlgui_version.h>
#include <kio_version.h>
#include <sys/utsname.h>
#include <unistd.h>
@ -78,7 +78,7 @@ QString HtmlReport::header()
<< tableLine(i18n("Date:"), QLocale().toString(QDateTime::currentDateTime(), QLocale::ShortFormat))
<< tableLine(i18n("Program version:"), QCoreApplication::applicationVersion())
<< tableLine(i18n("Backend:"), QStringLiteral("%1 (%2)").arg(CoreBackendManager::self()->backend()->id()).arg(CoreBackendManager::self()->backend()->version()))
<< tableLine(i18n("KDE Frameworks version:"), QStringLiteral(KXMLGUI_VERSION_STRING))
<< tableLine(i18n("KDE Frameworks version:"), QStringLiteral(KIO_VERSION_STRING))
<< tableLine(i18n("Machine:"), unameString)
<< "</table>\n<br/>\n";

View File

@ -25,7 +25,7 @@
#include <QObject>
#include <QList>
#include <QString>
#include <qglobal.h>
#include <QtGlobal>
class ReportLine;