Patch by Bryce Groff: Allow passing an ID of any partition contained in the

disk device to the locking functions, not only the ID of the disk device
itself.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@32094 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Ingo Weinhold 2009-08-03 19:01:20 +00:00
parent 5e243bb30e
commit 1d099cad03

View File

@ -22,7 +22,7 @@ disk_device_data *
write_lock_disk_device(partition_id partitionID)
{
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
if (KDiskDevice *device = manager->RegisterDevice(partitionID)) {
if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) {
if (device->WriteLock())
return device->DeviceData();
// Only unregister, when the locking fails. The guarantees, that the
@ -38,7 +38,7 @@ void
write_unlock_disk_device(partition_id partitionID)
{
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
if (KDiskDevice *device = manager->RegisterDevice(partitionID)) {
if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) {
bool isLocked = device->IsWriteLocked();
if (isLocked) {
device->WriteUnlock();
@ -54,7 +54,7 @@ disk_device_data *
read_lock_disk_device(partition_id partitionID)
{
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
if (KDiskDevice *device = manager->RegisterDevice(partitionID)) {
if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) {
if (device->ReadLock())
return device->DeviceData();
// Only unregister, when the locking fails. The guarantees, that the
@ -70,7 +70,7 @@ void
read_unlock_disk_device(partition_id partitionID)
{
KDiskDeviceManager *manager = KDiskDeviceManager::Default();
if (KDiskDevice *device = manager->RegisterDevice(partitionID)) {
if (KDiskDevice *device = manager->RegisterDevice(partitionID, false)) {
bool isLocked = device->IsReadLocked(false);
if (isLocked) {
device->ReadUnlock();