Merge branch 'master' into luks-decorator
This commit is contained in:
commit
f7e62d93f9
|
@ -456,7 +456,7 @@ void OperationStack::clearOperations()
|
||||||
Operation* o = operations().takeLast();
|
Operation* o = operations().takeLast();
|
||||||
if (o->status() == Operation::StatusPending)
|
if (o->status() == Operation::StatusPending)
|
||||||
o->undo();
|
o->undo();
|
||||||
delete o;
|
o->deleteLater();
|
||||||
}
|
}
|
||||||
|
|
||||||
emit operationsChanged();
|
emit operationsChanged();
|
||||||
|
|
|
@ -80,7 +80,8 @@ Partition::~Partition()
|
||||||
// list of children). As a workaround, always remove a partition from its parent here in the dtor.
|
// 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
|
// This presumably fixes 232092, but backporting is too risky until we're sure this doesn't cause
|
||||||
// side-effects.
|
// side-effects.
|
||||||
parent()->remove(this);
|
if (m_Parent)
|
||||||
|
parent()->remove(this);
|
||||||
clearChildren();
|
clearChildren();
|
||||||
deleteFileSystem();
|
deleteFileSystem();
|
||||||
}
|
}
|
||||||
|
|
|
@ -27,6 +27,7 @@
|
||||||
|
|
||||||
#include <QStringList>
|
#include <QStringList>
|
||||||
#include <QtGlobal>
|
#include <QtGlobal>
|
||||||
|
#include <QPointer>
|
||||||
|
|
||||||
class Device;
|
class Device;
|
||||||
class OperationStack;
|
class OperationStack;
|
||||||
|
@ -270,7 +271,7 @@ private:
|
||||||
|
|
||||||
qint32 m_Number;
|
qint32 m_Number;
|
||||||
Partitions m_Children;
|
Partitions m_Children;
|
||||||
PartitionNode* m_Parent;
|
QPointer< PartitionNode > m_Parent;
|
||||||
FileSystem* m_FileSystem;
|
FileSystem* m_FileSystem;
|
||||||
PartitionRole m_Roles;
|
PartitionRole m_Roles;
|
||||||
qint64 m_FirstSector;
|
qint64 m_FirstSector;
|
||||||
|
|
|
@ -53,7 +53,7 @@ void btrfs::init()
|
||||||
m_Create = findExternal(QStringLiteral("mkfs.btrfs")) ? cmdSupportFileSystem : cmdSupportNone;
|
m_Create = findExternal(QStringLiteral("mkfs.btrfs")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
m_Check = findExternal(QStringLiteral("btrfsck"), QStringList(), 1) ? cmdSupportFileSystem : cmdSupportNone;
|
m_Check = findExternal(QStringLiteral("btrfsck"), QStringList(), 1) ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
m_Grow = (m_Check != cmdSupportNone && findExternal(QStringLiteral("btrfs"))) ? 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_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
|
|
||||||
m_SetLabel = findExternal(QStringLiteral("btrfs")) ? cmdSupportFileSystem : cmdSupportNone;
|
m_SetLabel = findExternal(QStringLiteral("btrfs")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
|
@ -91,7 +91,7 @@ FileSystem::SupportTool btrfs::supportToolName() const
|
||||||
|
|
||||||
qint64 btrfs::minCapacity() 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
|
qint64 btrfs::maxCapacity() const
|
||||||
|
|
|
@ -94,7 +94,7 @@ FileSystem::SupportTool f2fs::supportToolName() const
|
||||||
|
|
||||||
qint64 f2fs::minCapacity() 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
|
qint64 f2fs::maxCapacity() const
|
||||||
|
|
|
@ -59,7 +59,7 @@ void nilfs2::init()
|
||||||
m_SetLabel = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
|
m_SetLabel = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
m_UpdateUUID = 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_GetUsed = findExternal(QStringLiteral("nilfs-tune")) ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
|
m_Shrink = (m_Grow != cmdSupportNone && m_GetUsed != cmdSupportNone) ? cmdSupportFileSystem : cmdSupportNone;
|
||||||
|
|
||||||
|
|
|
@ -176,27 +176,9 @@ bool ntfs::resize(Report& report, const QString& deviceNode, qint64 length) cons
|
||||||
bool ntfs::updateUUID(Report& report, const QString& deviceNode) const
|
bool ntfs::updateUUID(Report& report, const QString& deviceNode) const
|
||||||
{
|
{
|
||||||
Q_UNUSED(report);
|
Q_UNUSED(report);
|
||||||
QUuid uuid = QUuid::createUuid();
|
ExternalCommand cmd(QStringLiteral("ntfslabel"), { QStringLiteral("--new-serial"), deviceNode });
|
||||||
char* s = reinterpret_cast<char*>(&uuid.data4[0]);
|
|
||||||
|
|
||||||
QFile device(deviceNode);
|
return cmd.run(-1) && cmd.exitCode() == 0;
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool ntfs::updateBootSector(Report& report, const QString& deviceNode) const
|
bool ntfs::updateBootSector(Report& report, const QString& deviceNode) const
|
||||||
|
|
|
@ -32,7 +32,7 @@ T sum(const QList<T>& list)
|
||||||
{
|
{
|
||||||
T rval = 0;
|
T rval = 0;
|
||||||
foreach(const T & val, list)
|
foreach(const T & val, list)
|
||||||
rval += val;
|
rval += val;
|
||||||
return rval;
|
return rval;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue