diff --git a/src/system/kernel/disk_device_manager/disk_device_manager.cpp b/src/system/kernel/disk_device_manager/disk_device_manager.cpp index a7dd2c82b2..5e4e61bc49 100644 --- a/src/system/kernel/disk_device_manager/disk_device_manager.cpp +++ b/src/system/kernel/disk_device_manager/disk_device_manager.cpp @@ -18,11 +18,11 @@ // write_lock_disk_device -disk_device_data * +disk_device_data* write_lock_disk_device(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) { + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + if (KDiskDevice* device = manager->RegisterDevice(partitionID, false)) { if (device->WriteLock()) return device->DeviceData(); // Only unregister, when the locking fails. The guarantees, that the @@ -37,8 +37,8 @@ write_lock_disk_device(partition_id partitionID) void write_unlock_disk_device(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) { + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + if (KDiskDevice* device = manager->RegisterDevice(partitionID, false)) { bool isLocked = device->IsWriteLocked(); if (isLocked) { device->WriteUnlock(); @@ -50,11 +50,11 @@ write_unlock_disk_device(partition_id partitionID) // read_lock_disk_device -disk_device_data * +disk_device_data* read_lock_disk_device(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) { + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + if (KDiskDevice* device = manager->RegisterDevice(partitionID, false)) { if (device->ReadLock()) return device->DeviceData(); // Only unregister, when the locking fails. The guarantees, that the @@ -69,8 +69,8 @@ read_lock_disk_device(partition_id partitionID) void read_unlock_disk_device(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) { + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + if (KDiskDevice* device = manager->RegisterDevice(partitionID, false)) { bool isLocked = device->IsReadLocked(false); if (isLocked) { device->ReadUnlock(); @@ -83,11 +83,11 @@ read_unlock_disk_device(partition_id partitionID) // find_disk_device int32 -find_disk_device(const char *path) +find_disk_device(const char* path) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); partition_id id = -1; - if (KDiskDevice *device = manager->RegisterDevice(path)) { + if (KDiskDevice* device = manager->RegisterDevice(path)) { id = device->ID(); device->Unregister(); } @@ -97,11 +97,11 @@ find_disk_device(const char *path) // find_partition int32 -find_partition(const char *path) +find_partition(const char* path) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); partition_id id = -1; - if (KPartition *partition = manager->RegisterPartition(path)) { + if (KPartition* partition = manager->RegisterPartition(path)) { id = partition->ID(); partition->Unregister(); } @@ -110,31 +110,31 @@ find_partition(const char *path) // get_disk_device -disk_device_data * +disk_device_data* get_disk_device(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - KDiskDevice *device = manager->FindDevice(partitionID, false); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + KDiskDevice* device = manager->FindDevice(partitionID, false); return (device ? device->DeviceData() : NULL); } // get_partition -partition_data * +partition_data* get_partition(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - KPartition *partition = manager->FindPartition(partitionID); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + KPartition* partition = manager->FindPartition(partitionID); return (partition ? partition->PartitionData() : NULL); } // get_parent_partition -partition_data * +partition_data* get_parent_partition(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - KPartition *partition = manager->FindPartition(partitionID); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + KPartition* partition = manager->FindPartition(partitionID); if (partition && partition->Parent()) return partition->Parent()->PartitionData(); return NULL; @@ -142,12 +142,12 @@ get_parent_partition(partition_id partitionID) // get_child_partition -partition_data * +partition_data* get_child_partition(partition_id partitionID, int32 index) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - if (KPartition *partition = manager->FindPartition(partitionID)) { - if (KPartition *child = partition->ChildAt(index)) + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + if (KPartition* partition = manager->FindPartition(partitionID)) { + if (KPartition* child = partition->ChildAt(index)) return child->PartitionData(); } return NULL; @@ -157,8 +157,8 @@ get_child_partition(partition_id partitionID, int32 index) int open_partition(partition_id partitionID, int openMode) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - KPartition *partition = manager->FindPartition(partitionID); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + KPartition* partition = manager->FindPartition(partitionID); if (partition == NULL) return B_BAD_VALUE; @@ -170,14 +170,15 @@ open_partition(partition_id partitionID, int openMode) return fd; } + // create_child_partition -partition_data * +partition_data* create_child_partition(partition_id partitionID, int32 index, off_t offset, off_t size, partition_id childID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - if (KPartition *partition = manager->FindPartition(partitionID)) { - KPartition *child = NULL; + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + if (KPartition* partition = manager->FindPartition(partitionID)) { + KPartition* child = NULL; if (partition->CreateChild(childID, index, offset, size, &child) == B_OK) { return child->PartitionData(); @@ -196,9 +197,9 @@ create_child_partition(partition_id partitionID, int32 index, off_t offset, bool delete_partition(partition_id partitionID) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - if (KPartition *partition = manager->FindPartition(partitionID)) { - if (KPartition *parent = partition->Parent()) + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + if (KPartition* partition = manager->FindPartition(partitionID)) { + if (KPartition* parent = partition->Parent()) return parent->RemoveChild(partition); } return false; @@ -234,8 +235,8 @@ status_t get_default_partition_content_name(partition_id partitionID, const char* fileSystemName, char* buffer, size_t bufferSize) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); - KPartition *partition = manager->RegisterPartition(partitionID); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); + KPartition* partition = manager->RegisterPartition(partitionID); if (partition == NULL) return B_ENTRY_NOT_FOUND; @@ -265,11 +266,11 @@ get_default_partition_content_name(partition_id partitionID, // find_disk_system disk_system_id -find_disk_system(const char *name) +find_disk_system(const char* name) { - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); if (ManagerLocker locker = manager) { - if (KDiskSystem *diskSystem = manager->FindDiskSystem(name)) + if (KDiskSystem* diskSystem = manager->FindDiskSystem(name)) return diskSystem->ID(); } return -1; @@ -281,9 +282,9 @@ bool update_disk_device_job_progress(disk_job_id jobID, float progress) { #if 0 - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); if (ManagerLocker locker = manager) { - if (KDiskDeviceJob *job = manager->FindJob(jobID)) { + if (KDiskDeviceJob* job = manager->FindJob(jobID)) { job->UpdateProgress(progress); return true; } @@ -295,12 +296,12 @@ update_disk_device_job_progress(disk_job_id jobID, float progress) // update_disk_device_job_extra_progress bool -update_disk_device_job_extra_progress(disk_job_id jobID, const char *info) +update_disk_device_job_extra_progress(disk_job_id jobID, const char* info) { #if 0 - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); if (ManagerLocker locker = manager) { - if (KDiskDeviceJob *job = manager->FindJob(jobID)) { + if (KDiskDeviceJob* job = manager->FindJob(jobID)) { job->UpdateExtraProgress(info); return true; } @@ -312,12 +313,12 @@ update_disk_device_job_extra_progress(disk_job_id jobID, const char *info) // set_disk_device_job_error_message bool -set_disk_device_job_error_message(disk_job_id jobID, const char *message) +set_disk_device_job_error_message(disk_job_id jobID, const char* message) { #if 0 - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); if (ManagerLocker locker = manager) { - if (KDiskDeviceJob *job = manager->FindJob(jobID)) { + if (KDiskDeviceJob* job = manager->FindJob(jobID)) { job->SetErrorMessage(message); return true; } @@ -334,13 +335,13 @@ update_disk_device_job_interrupt_properties(disk_job_id jobID, { #if 0 bool paused = false; - KDiskDeviceManager *manager = KDiskDeviceManager::Default(); + KDiskDeviceManager* manager = KDiskDeviceManager::Default(); do { sem_id pauseSemaphore = -1; if (ManagerLocker locker = manager) { // get the job and the respective job queue - if (KDiskDeviceJob *job = manager->FindJob(jobID)) { - if (KDiskDeviceJobQueue *jobQueue = job->JobQueue()) { + if (KDiskDeviceJob* job = manager->FindJob(jobID)) { + if (KDiskDeviceJobQueue* jobQueue = job->JobQueue()) { // terminate if canceled. if (jobQueue->IsCanceled()) { if (jobQueue->ShallReverse())