* KDiskDeviceManager::RescanDiskSystems() now also rescans all partitions with

the newly found disk systems.
* _ScanPartition() now allows to restrict the disk systems to a predefined set.
* _ScanPartition() now even scans partitions that already have a disk system
  assigned; if a better one is found, the existing one is replaced. It will
  ignore mounted or partitions with children, though.
* KPartition now also stores the priority of the disk system assigned to it.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@26177 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler
2008-06-30 10:36:47 +00:00
parent 781420cc0e
commit 8531599a27
4 changed files with 91 additions and 42 deletions
@@ -1,4 +1,10 @@
// KPartition.cpp
/*
* Copyright 2004-2008, Haiku, Inc. All rights reserved.
* Copyright 2003-2004, Ingo Weinhold, [email protected]. All rights reserved.
*
* Distributed under the terms of the MIT License.
*/
#include <errno.h>
#include <fcntl.h>
@@ -44,6 +50,7 @@ KPartition::KPartition(partition_id id)
fDevice(NULL),
fParent(NULL),
fDiskSystem(NULL),
fDiskSystemPriority(-1),
fListeners(NULL),
fChangeFlags(0),
fChangeCounter(0),
@@ -52,7 +59,7 @@ KPartition::KPartition(partition_id id)
fObsolete(false),
fPublished(false)
{
fPartitionData.id = (id >= 0 ? id : _NextID());
fPartitionData.id = id >= 0 ? id : _NextID();
fPartitionData.offset = 0;
fPartitionData.size = 0;
fPartitionData.content_size = 0;
@@ -895,13 +902,14 @@ KPartition::VisitEachDescendant(KPartitionVisitor *visitor)
// SetDiskSystem
void
KPartition::SetDiskSystem(KDiskSystem *diskSystem)
KPartition::SetDiskSystem(KDiskSystem *diskSystem, float priority)
{
// unload former disk system
if (fDiskSystem) {
fPartitionData.content_type = NULL;
fDiskSystem->Unload();
fDiskSystem = NULL;
fDiskSystemPriority = -1;
}
// set and load new one
fDiskSystem = diskSystem;
@@ -910,6 +918,7 @@ KPartition::SetDiskSystem(KDiskSystem *diskSystem)
// update concerned partition flags
if (fDiskSystem) {
fPartitionData.content_type = fDiskSystem->PrettyName();
fDiskSystemPriority = priority;
if (fDiskSystem->IsFileSystem())
AddFlags(B_PARTITION_FILE_SYSTEM);
else
@@ -926,6 +935,14 @@ KPartition::DiskSystem() const
return fDiskSystem;
}
float
KPartition::DiskSystemPriority() const
{
return fDiskSystemPriority;
}
// ParentDiskSystem
KDiskSystem *
KPartition::ParentDiskSystem() const