2 * Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
6 * Tomas Kucera, kucerat@centrum.cz
10 #include "PartitionLocker.h"
13 // #pragma mark - PartitionLocker
16 PartitionLocker::PartitionLocker(partition_id partitionID
)
19 fPartitionID(partitionID
)
24 PartitionLocker::~PartitionLocker()
30 PartitionLocker::IsLocked() const
32 return fDevice
!= NULL
;
37 PartitionLocker::PartitionId() const
43 // #pragma mark - PartitionReadLocker
46 PartitionReadLocker::PartitionReadLocker(partition_id partitionID
)
48 PartitionLocker(partitionID
)
50 fDevice
= read_lock_disk_device(partitionID
);
54 PartitionReadLocker::~PartitionReadLocker()
57 read_unlock_disk_device(PartitionId());
61 // #pragma mark - PartitionWriteLocker
64 PartitionWriteLocker::PartitionWriteLocker(partition_id partitionID
)
66 PartitionLocker(partitionID
)
68 fDevice
= write_lock_disk_device(partitionID
);
72 PartitionWriteLocker::~PartitionWriteLocker()
75 write_unlock_disk_device(PartitionId());