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 \file PartitionLocker.h
12 \brief Structures for easy locking and automatic unlocking partitions.
15 #ifndef _PARTITION_LOCKER_H
16 #define _PARTITION_LOCKER_H
18 #include <disk_device_manager.h>
21 class PartitionLocker
{
23 PartitionLocker(partition_id partitionID
);
26 bool IsLocked() const;
27 partition_id
PartitionId() const;
30 const disk_device_data
* fDevice
;
33 partition_id fPartitionID
;
38 \brief Structure which locks given partition for reading.
40 When this structure is going to be destroyed, it automatically unlocks
43 class PartitionReadLocker
: public PartitionLocker
{
45 PartitionReadLocker(partition_id partitionID
);
46 ~PartitionReadLocker();
51 \brief Structure which locks given partition for writing.
53 When this structure is going to be destroyed, it automatically unlocks
56 class PartitionWriteLocker
: public PartitionLocker
{
58 PartitionWriteLocker(partition_id partitionID
);
59 ~PartitionWriteLocker();
63 #endif // _PARTITION_LOCKER_H