Added scan_partition() function which can be used by disk systems (e.g.

in *_initialize()) to save some work.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@22441 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold
2007-10-04 18:03:24 +00:00
parent 088136f66b
commit 8c8f8c8420
8 changed files with 78 additions and 7 deletions
@@ -488,9 +488,28 @@ KDiskDeviceManager::WriteLockPartition(partition_id id)
return NULL;
}
// ScanPartition
status_t
KDiskDeviceManager::ScanPartition(KPartition* partition, bool async)
{
// TODO: This won't do. Locking the DDM while scanning the partition is not a
// good idea. Even locking the device doesn't feels right. Marking the partition
// busy and passing the disk system a temporary clone of the partition_data
// should work as well.
if (DeviceWriteLocker deviceLocker = partition->Device()) {
if (ManagerLocker locker = this)
return _ScanPartition(partition, async);
}
return B_ERROR;
}
// CreateFileDevice
partition_id
KDiskDeviceManager::CreateFileDevice(const char *filePath, bool *newlyCreated, bool async)
KDiskDeviceManager::CreateFileDevice(const char *filePath, bool *newlyCreated,
bool async)
{
if (!filePath)
return B_BAD_VALUE;
@@ -716,7 +735,8 @@ KDiskDeviceManager::RemoveJobQueue(KDiskDeviceJobQueue *jobQueue)
return jobQueue->InitCheck();
if (jobQueue->IsExecuting())
return B_BAD_VALUE;
return (_RemoveJobQueue(jobQueue) ? B_OK : B_ENTRY_NOT_FOUND);
return (_RemoveJobQueue(jobQueue)
? (status_t)B_OK : (status_t)B_ENTRY_NOT_FOUND);
}
// DeleteJobQueue
@@ -178,9 +178,26 @@ delete_partition(partition_id partitionID)
void
partition_modified(partition_id partitionID)
{
// not implemented
// TODO: implemented
}
// scan_partition
status_t
scan_partition(partition_id partitionID)
{
// get the partition
KDiskDeviceManager* manager = KDiskDeviceManager::Default();
KPartition* partition = manager->RegisterPartition(partitionID);
if (partition == NULL)
return B_ENTRY_NOT_FOUND;
PartitionRegistrar _(partition, true);
// scan it
return manager->ScanPartition(partition, false);
}
// find_disk_system
disk_system_id
find_disk_system(const char *name)
+1
View File
@@ -33,6 +33,7 @@ BuildPlatformStaticLibrary <build>fs_shell.a :
atomic.cpp
block_cache.cpp
command_cp.cpp
disk_device_manager.cpp
driver_settings.cpp
errno.cpp
fcntl.cpp
@@ -0,0 +1,22 @@
/*
* Copyright 2007, Ingo Weinhold, bonefish@cs.tu-berlin.de.
* Distributed under the terms of the MIT License.
*/
#include "fssh_disk_device_manager.h"
#include "fssh_errors.h"
fssh_status_t
fssh_scan_partition(fssh_partition_id partitionID)
{
return FSSH_B_OK;
}
bool
fssh_update_disk_device_job_progress(fssh_disk_job_id jobID, float progress)
{
return true;
}