disk device manager: check that partitions are unmounted before uninitializing.
when uninitializing a partition or a disk (removing the partition table), check that all partitions from that table are unmounted, as they are about to become invalid. Fixes #8827.
This commit is contained in:
parent
04dbe5b1c5
commit
4ed39e6a62
@ -85,6 +85,7 @@ public:
|
|||||||
bool ContainsPartitioningSystem() const;
|
bool ContainsPartitioningSystem() const;
|
||||||
bool IsReadOnly() const;
|
bool IsReadOnly() const;
|
||||||
bool IsMounted() const;
|
bool IsMounted() const;
|
||||||
|
bool IsChildMounted();
|
||||||
|
|
||||||
bool IsDevice() const;
|
bool IsDevice() const;
|
||||||
|
|
||||||
|
@ -559,6 +559,20 @@ KPartition::IsMounted() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
bool
|
||||||
|
KPartition::IsChildMounted()
|
||||||
|
{
|
||||||
|
struct IsMountedVisitor : KPartitionVisitor {
|
||||||
|
virtual bool VisitPre(KPartition* partition)
|
||||||
|
{
|
||||||
|
return partition->IsMounted();
|
||||||
|
}
|
||||||
|
} checkVisitor;
|
||||||
|
|
||||||
|
return VisitEachDescendant(&checkVisitor) != NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool
|
bool
|
||||||
KPartition::IsDevice() const
|
KPartition::IsDevice() const
|
||||||
{
|
{
|
||||||
|
@ -1249,7 +1249,8 @@ _user_uninitialize_partition(partition_id partitionID, int32* _changeCounter)
|
|||||||
if (!partition->CheckAndMarkBusy(true))
|
if (!partition->CheckAndMarkBusy(true))
|
||||||
return B_BUSY;
|
return B_BUSY;
|
||||||
|
|
||||||
// TODO: We should also check, if any partition is mounted!
|
if (partition->IsMounted() || partition->IsChildMounted())
|
||||||
|
return B_BAD_DATA;
|
||||||
|
|
||||||
KDiskSystem* diskSystem = partition->DiskSystem();
|
KDiskSystem* diskSystem = partition->DiskSystem();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user