Fixed the build in case debug output was enabled.
Moved the debug macros into the program flow, so that they don't look so temporary :) git-svn-id: file:///srv/svn/repos/haiku/trunk/current@9557 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
// KScanPartitionJob.cpp
|
// KScanPartitionJob.cpp
|
||||||
|
|
||||||
|
#include <KernelExport.h>
|
||||||
|
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
|
|
||||||
@@ -13,22 +15,21 @@
|
|||||||
|
|
||||||
// debugging
|
// debugging
|
||||||
#define DBG(x)
|
#define DBG(x)
|
||||||
//#define DBG(x) x
|
|
||||||
#define OUT dprintf
|
#define OUT dprintf
|
||||||
|
|
||||||
// constructor
|
|
||||||
KScanPartitionJob::KScanPartitionJob(partition_id partitionID)
|
KScanPartitionJob::KScanPartitionJob(partition_id partitionID)
|
||||||
: KDiskDeviceJob(B_DISK_DEVICE_JOB_SCAN, partitionID)
|
: KDiskDeviceJob(B_DISK_DEVICE_JOB_SCAN, partitionID)
|
||||||
{
|
{
|
||||||
SetDescription("scanning partition");
|
SetDescription("scanning partition");
|
||||||
}
|
}
|
||||||
|
|
||||||
// destructor
|
|
||||||
KScanPartitionJob::~KScanPartitionJob()
|
KScanPartitionJob::~KScanPartitionJob()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do
|
|
||||||
status_t
|
status_t
|
||||||
KScanPartitionJob::Do()
|
KScanPartitionJob::Do()
|
||||||
{
|
{
|
||||||
@@ -37,6 +38,7 @@ KScanPartitionJob::Do()
|
|||||||
KPartition *partition = manager->WriteLockPartition(PartitionID());
|
KPartition *partition = manager->WriteLockPartition(PartitionID());
|
||||||
if (!partition)
|
if (!partition)
|
||||||
return B_ENTRY_NOT_FOUND;
|
return B_ENTRY_NOT_FOUND;
|
||||||
|
|
||||||
KDiskDevice *device = partition->Device();
|
KDiskDevice *device = partition->Device();
|
||||||
PartitionRegistrar registrar1(partition, true);
|
PartitionRegistrar registrar1(partition, true);
|
||||||
PartitionRegistrar registrar2(device, true);
|
PartitionRegistrar registrar2(device, true);
|
||||||
@@ -53,7 +55,7 @@ KScanPartitionJob::Do()
|
|||||||
return error;
|
return error;
|
||||||
}
|
}
|
||||||
|
|
||||||
// _ScanPartition
|
|
||||||
status_t
|
status_t
|
||||||
KScanPartitionJob::_ScanPartition(KPartition *partition)
|
KScanPartitionJob::_ScanPartition(KPartition *partition)
|
||||||
{
|
{
|
||||||
@@ -61,15 +63,18 @@ KScanPartitionJob::_ScanPartition(KPartition *partition)
|
|||||||
// the partition's device must be write-locked
|
// the partition's device must be write-locked
|
||||||
if (!partition)
|
if (!partition)
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
DBG(
|
DBG(
|
||||||
KPath partitionPath;
|
KPath partitionPath;
|
||||||
partition->GetPath(&partitionPath);
|
partition->GetPath(&partitionPath);
|
||||||
OUT("KDiskDeviceManager::_ScanPartition(%s)\n", partitionPath.Path())
|
OUT("KDiskDeviceManager::_ScanPartition(%s)\n", partitionPath.Path());
|
||||||
)
|
)
|
||||||
|
|
||||||
// publish the partition
|
// publish the partition
|
||||||
status_t error = partition->PublishDevice();
|
status_t error = partition->PublishDevice();
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
// find the disk system that returns the best priority for this partition
|
// find the disk system that returns the best priority for this partition
|
||||||
float bestPriority = -1;
|
float bestPriority = -1;
|
||||||
KDiskSystem *bestDiskSystem = NULL;
|
KDiskSystem *bestDiskSystem = NULL;
|
||||||
@@ -77,9 +82,12 @@ OUT("KDiskDeviceManager::_ScanPartition(%s)\n", partitionPath.Path())
|
|||||||
int32 itCookie = 0;
|
int32 itCookie = 0;
|
||||||
while (KDiskSystem *diskSystem = manager->LoadNextDiskSystem(&itCookie)) {
|
while (KDiskSystem *diskSystem = manager->LoadNextDiskSystem(&itCookie)) {
|
||||||
DBG(OUT(" trying: %s\n", diskSystem->Name()));
|
DBG(OUT(" trying: %s\n", diskSystem->Name()));
|
||||||
|
|
||||||
void *cookie = NULL;
|
void *cookie = NULL;
|
||||||
float priority = diskSystem->Identify(partition, &cookie);
|
float priority = diskSystem->Identify(partition, &cookie);
|
||||||
DBG(OUT(" returned: %f\n", priority));
|
|
||||||
|
DBG(OUT(" returned: %ld/1000\n", int32(1000 * priority)));
|
||||||
|
|
||||||
if (priority >= 0 && priority > bestPriority) {
|
if (priority >= 0 && priority > bestPriority) {
|
||||||
// new best disk system
|
// new best disk system
|
||||||
if (bestDiskSystem) {
|
if (bestDiskSystem) {
|
||||||
@@ -96,6 +104,7 @@ DBG(OUT(" returned: %f\n", priority));
|
|||||||
diskSystem->Unload();
|
diskSystem->Unload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now, if we have found a disk system, let it scan the partition
|
// now, if we have found a disk system, let it scan the partition
|
||||||
if (bestDiskSystem) {
|
if (bestDiskSystem) {
|
||||||
DBG(OUT(" scanning with: %s\n", bestDiskSystem->Name()));
|
DBG(OUT(" scanning with: %s\n", bestDiskSystem->Name()));
|
||||||
|
|||||||
Reference in New Issue
Block a user