* Now we set partition_data::content_type correctly. The intel
partitioning system module relies on it, otherwise extended partitions won't be recognized. * Be a little less lazy and do the priority partition recognition, i.e. all partitioning systems are asked to identify a partition and the one that believes it can handle the partition best, wins the pot. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@12187 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -211,22 +211,55 @@ Partition::Scan(bool mountFileSystems)
|
||||
|
||||
TRACE(("Partition::Scan()\n"));
|
||||
|
||||
const partition_module_info *bestModule = NULL;
|
||||
void *bestCookie = NULL;
|
||||
float bestPriority = -1;
|
||||
|
||||
for (int32 i = 0; i < sNumPartitionModules; i++) {
|
||||
const partition_module_info *module = sPartitionModules[i];
|
||||
void *cookie;
|
||||
void *cookie = NULL;
|
||||
NodeOpener opener(this, O_RDONLY);
|
||||
|
||||
TRACE(("check for partitioning_system: %s\n", module->pretty_name));
|
||||
|
||||
if (module->identify_partition(opener.Descriptor(), this, &cookie) <= 0.0)
|
||||
float priority
|
||||
= module->identify_partition(opener.Descriptor(), this, &cookie);
|
||||
if (priority < 0.0)
|
||||
continue;
|
||||
|
||||
status_t status = module->scan_partition(opener.Descriptor(), this, cookie);
|
||||
if (priority <= bestPriority) {
|
||||
// the disk system recognized the partition worse than the currently
|
||||
// best one
|
||||
module->free_identify_partition_cookie(this, cookie);
|
||||
continue;
|
||||
}
|
||||
|
||||
// a new winner, replace the previous one
|
||||
if (bestModule)
|
||||
bestModule->free_identify_partition_cookie(this, bestCookie);
|
||||
bestModule = module;
|
||||
bestCookie = cookie;
|
||||
bestPriority = priority;
|
||||
}
|
||||
|
||||
// now let the best matching disk system scan the partition
|
||||
if (bestModule) {
|
||||
NodeOpener opener(this, O_RDONLY);
|
||||
status_t status = bestModule->scan_partition(opener.Descriptor(), this,
|
||||
bestCookie);
|
||||
bestModule->free_identify_partition_cookie(this, bestCookie);
|
||||
|
||||
if (status != B_OK) {
|
||||
dprintf("Partitioning module `%s' recognized the partition, but "
|
||||
"failed to scan it\n", bestModule->pretty_name);
|
||||
return status;
|
||||
}
|
||||
|
||||
if (status == B_OK) {
|
||||
fIsPartitioningSystem = true;
|
||||
|
||||
content_type = bestModule->pretty_name;
|
||||
flags |= B_PARTITION_PARTITIONING_SYSTEM;
|
||||
|
||||
// now that we've found something, check our children
|
||||
// out as well!
|
||||
|
||||
@@ -254,11 +287,10 @@ Partition::Scan(bool mountFileSystems)
|
||||
}
|
||||
|
||||
// remember the module name that identified us
|
||||
fModuleName = module->module.name;
|
||||
fModuleName = bestModule->module.name;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
}
|
||||
|
||||
// scan for file systems
|
||||
|
||||
|
||||
Reference in New Issue
Block a user