Do not allow moving partitions without partition table.
This commit is contained in:
parent
81f8939cb1
commit
de346177b5
|
@ -261,6 +261,15 @@ bool Partition::hasChildren() const
|
|||
return false;
|
||||
}
|
||||
|
||||
/** @return returns the Partition Table which contains this Partition */
|
||||
const PartitionTable* Partition::partitionTable() const {
|
||||
const PartitionNode *p = this;
|
||||
while (p->parent() != nullptr) {
|
||||
p = p->parent();
|
||||
}
|
||||
return static_cast<const PartitionTable*>(p);
|
||||
}
|
||||
|
||||
/** Sets an extended Partition to mounted if any of its children are mounted */
|
||||
void Partition::checkChildrenMounted()
|
||||
{
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2008-2010 Volker Lanz <vl@fidra.de>
|
||||
SPDX-FileCopyrightText: 2008 Laurent Montel <montel@kde.org>
|
||||
SPDX-FileCopyrightText: 2013-2019 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2013-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2015 Chris Campbell <c.j.campbell@ed.ac.uk>
|
||||
SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
|
||||
SPDX-FileCopyrightText: 2020 Gaël PORTAY <gael.portay@collabora.com>
|
||||
|
@ -96,6 +96,8 @@ public:
|
|||
return false; /**< @return always false for Partition */
|
||||
}
|
||||
|
||||
const PartitionTable* partitionTable() const;
|
||||
|
||||
PartitionNode* parent() override {
|
||||
return m_Parent; /**< @return the Partition's parent PartitionNode */
|
||||
}
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
SPDX-FileCopyrightText: 2008-2012 Volker Lanz <vl@fidra.de>
|
||||
SPDX-FileCopyrightText: 2012-2018 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2012-2020 Andrius Štikonas <andrius@stikonas.eu>
|
||||
SPDX-FileCopyrightText: 2015 Teo Mrnjavac <teo@kde.org>
|
||||
SPDX-FileCopyrightText: 2016 Chantara Tith <tith.chantara@gmail.com>
|
||||
SPDX-FileCopyrightText: 2018 Caio Jordão Carvalho <caiojcarvalho@gmail.com>
|
||||
|
@ -326,6 +326,10 @@ bool ResizeOperation::canGrow(const Partition* p)
|
|||
if (p == nullptr)
|
||||
return false;
|
||||
|
||||
// Whole block device filesystems cannot be resized
|
||||
if (p->partitionTable()->type() == PartitionTable::TableType::none)
|
||||
return false;
|
||||
|
||||
if (isLVMPVinNewlyVG(p))
|
||||
return false;
|
||||
|
||||
|
@ -348,6 +352,10 @@ bool ResizeOperation::canShrink(const Partition* p)
|
|||
if (p == nullptr)
|
||||
return false;
|
||||
|
||||
// Whole block device filesystems cannot be resized
|
||||
if (p->partitionTable()->type() == PartitionTable::TableType::none)
|
||||
return false;
|
||||
|
||||
if (isLVMPVinNewlyVG(p))
|
||||
return false;
|
||||
|
||||
|
@ -373,6 +381,10 @@ bool ResizeOperation::canMove(const Partition* p)
|
|||
if (p == nullptr)
|
||||
return false;
|
||||
|
||||
// Whole block device filesystems cannot be moved
|
||||
if (p->partitionTable()->type() == PartitionTable::TableType::none)
|
||||
return false;
|
||||
|
||||
if (isLVMPVinNewlyVG(p))
|
||||
return false;
|
||||
|
||||
|
|
Loading…
Reference in New Issue