Merge branch 'master' into luks-decorator

This commit is contained in:
Andrius Štikonas 2016-04-27 16:34:02 +01:00
commit f7e62d93f9
8 changed files with 12 additions and 28 deletions

View File

@ -456,7 +456,7 @@ void OperationStack::clearOperations()
Operation* o = operations().takeLast();
if (o->status() == Operation::StatusPending)
o->undo();
delete o;
o->deleteLater();
}
emit operationsChanged();

View File

@ -80,7 +80,8 @@ Partition::~Partition()
// list of children). As a workaround, always remove a partition from its parent here in the dtor.
// This presumably fixes 232092, but backporting is too risky until we're sure this doesn't cause
// side-effects.
parent()->remove(this);
if (m_Parent)
parent()->remove(this);
clearChildren();
deleteFileSystem();
}

View File

@ -27,6 +27,7 @@
#include <QStringList>
#include <QtGlobal>
#include <QPointer>
class Device;
class OperationStack;
@ -270,7 +271,7 @@ private:
qint32 m_Number;
Partitions m_Children;
PartitionNode* m_Parent;
QPointer< PartitionNode > m_Parent;
FileSystem* m_FileSystem;
PartitionRole m_Roles;
qint64 m_FirstSector;

View File

@ -53,7 +53,7 @@ void btrfs::init()
m_Create = findExternal(QStringLiteral("mkfs.btrfs")) ? cmdSupportFileSystem : cmdSupportNone;
m_Check = findExternal(QStringLiteral("btrfsck"), QStringList(), 1) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("btrfs"))) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = findExternal(QStringLiteral("btrfs-debug-tree")) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = findExternal(QStringLiteral("btrfs")) ? cmdSupportFileSystem : cmdSupportNone;
m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
m_SetLabel = findExternal(QStringLiteral("btrfs")) ? cmdSupportFileSystem : cmdSupportNone;
@ -91,7 +91,7 @@ FileSystem::SupportTool btrfs::supportToolName() const
qint64 btrfs::minCapacity() const
{
return 256 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB);
return 40 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB);
}
qint64 btrfs::maxCapacity() const

View File

@ -94,7 +94,7 @@ FileSystem::SupportTool f2fs::supportToolName() const
qint64 f2fs::minCapacity() const
{
return 128 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB); // FIXME
return 30 * Capacity::unitFactor(Capacity::Byte, Capacity::MiB);
}
qint64 f2fs::maxCapacity() const

View File

@ -59,7 +59,7 @@ void nilfs2::init()
m_SetLabel = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
m_UpdateUUID = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("nilfs-resize"))) ? cmdSupportFileSystem : cmdSupportNone;
m_Grow = findExternal(QStringLiteral("nilfs-resize")) ? cmdSupportFileSystem : cmdSupportNone;
m_GetUsed = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;

View File

@ -176,27 +176,9 @@ 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]);
ExternalCommand cmd(QStringLiteral("ntfslabel"), { QStringLiteral("--new-serial"), deviceNode });
QFile device(deviceNode);
if (!device.open(QFile::ReadWrite | QFile::Unbuffered)) {
Log() << xi18nc("@info/plain", "Could not open partition <filename>%1</filename> for writing when trying to update the NTFS serial number.", deviceNode);
return false;
}
if (!device.seek(0x48)) {
Log() << xi18nc("@info/plain", "Could not seek to position 0x48 on partition <filename>%1</filename> when trying to update the NTFS serial number.", deviceNode);
return false;
}
if (device.write(s, 8) != 8) {
Log() << xi18nc("@info/plain", "Could not write new NTFS serial number to partition <filename>%1</filename>.", deviceNode);
return false;
}
Log() << xi18nc("@info/plain", "Updated NTFS serial number for partition <filename>%1</filename> successfully.", deviceNode);
return true;
return cmd.run(-1) && cmd.exitCode() == 0;
}
bool ntfs::updateBootSector(Report& report, const QString& deviceNode) const

View File

@ -32,7 +32,7 @@ T sum(const QList<T>& list)
{
T rval = 0;
foreach(const T & val, list)
rval += val;
rval += val;
return rval;
}