btrfs: Attempt to fix GCC2 build.
[haiku.git] / src / add-ons / kernel / partitioning_systems / intel / PartitionLocker.h
blob369521f8da936a9974002858e27d453af47364e8
1 /*
2 * Copyright 2003-2007, Haiku, Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
5 * Authors:
6 * Tomas Kucera, kucerat@centrum.cz
7 */
9 /*!
10 \file PartitionLocker.h
11 \ingroup intel_module
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 {
22 public:
23 PartitionLocker(partition_id partitionID);
24 ~PartitionLocker();
26 bool IsLocked() const;
27 partition_id PartitionId() const;
29 protected:
30 const disk_device_data* fDevice;
32 private:
33 partition_id fPartitionID;
37 /*!
38 \brief Structure which locks given partition for reading.
40 When this structure is going to be destroyed, it automatically unlocks
41 that partition.
43 class PartitionReadLocker : public PartitionLocker {
44 public:
45 PartitionReadLocker(partition_id partitionID);
46 ~PartitionReadLocker();
50 /*!
51 \brief Structure which locks given partition for writing.
53 When this structure is going to be destroyed, it automatically unlocks
54 that partition.
56 class PartitionWriteLocker : public PartitionLocker {
57 public:
58 PartitionWriteLocker(partition_id partitionID);
59 ~PartitionWriteLocker();
63 #endif // _PARTITION_LOCKER_H