btrfs: [] on the end of a struct field is a variable length array.
[haiku.git] / headers / private / storage / DiskDeviceList.h
blob31e298146b7b62997a3a1a5a57aa12de177dc452
1 /*
2 * Copyright 2003-2007, Haiku Inc. All Rights Reserved.
3 * Distributed under the terms of the MIT License.
4 */
5 #ifndef _DISK_DEVICE_LIST_H
6 #define _DISK_DEVICE_LIST_H
9 #include <DiskDeviceDefs.h>
10 #include <DiskDeviceVisitor.h>
11 #include <Handler.h>
12 #include <ObjectList.h>
14 class BDiskDevice;
15 class BDiskDeviceRoster;
16 class BLocker;
17 class BPartition;
18 class BSession;
21 class BDiskDeviceList : public BHandler {
22 public:
23 BDiskDeviceList(bool useOwnLocker = true);
24 virtual ~BDiskDeviceList();
26 virtual void MessageReceived(BMessage *message);
27 virtual void SetNextHandler(BHandler *handler);
29 status_t Fetch();
30 void Unset();
32 bool Lock();
33 void Unlock();
35 int32 CountDevices() const;
36 BDiskDevice *DeviceAt(int32 index) const;
38 BDiskDevice *VisitEachDevice(BDiskDeviceVisitor *visitor);
39 BPartition *VisitEachPartition(BDiskDeviceVisitor *visitor);
41 BPartition *VisitEachMountedPartition(BDiskDeviceVisitor *visitor);
42 BPartition *VisitEachMountablePartition(BDiskDeviceVisitor *visitor);
44 BDiskDevice *DeviceWithID(partition_id id) const;
45 BPartition *PartitionWithID(partition_id id) const;
47 virtual void MountPointMoved(BPartition *partition);
48 virtual void PartitionMounted(BPartition *partition);
49 virtual void PartitionUnmounted(BPartition *partition);
50 virtual void PartitionInitialized(BPartition *partition);
51 virtual void PartitionResized(BPartition *partition);
52 virtual void PartitionMoved(BPartition *partition);
53 virtual void PartitionCreated(BPartition *partition);
54 virtual void PartitionDeleted(BPartition *partition,
55 partition_id partitionID);
56 virtual void PartitionDefragmented(BPartition *partition);
57 virtual void PartitionRepaired(BPartition *partition);
58 virtual void PartitionChanged(BPartition *partition, uint32 event);
59 virtual void MediaChanged(BDiskDevice *device);
60 virtual void DeviceAdded(BDiskDevice *device);
61 virtual void DeviceRemoved(BDiskDevice *device);
63 private:
64 status_t _StartWatching();
65 void _StopWatching();
67 void _MountPointMoved(BMessage *message);
68 void _PartitionMounted(BMessage *message);
69 void _PartitionUnmounted(BMessage *message);
70 void _PartitionInitialized(BMessage *message);
71 void _PartitionResized(BMessage *message);
72 void _PartitionMoved(BMessage *message);
73 void _PartitionCreated(BMessage *message);
74 void _PartitionDeleted(BMessage *message);
75 void _PartitionDefragmented(BMessage *message);
76 void _PartitionRepaired(BMessage *message);
77 void _MediaChanged(BMessage *message);
78 void _DeviceAdded(BMessage *message);
79 void _DeviceRemoved(BMessage *message);
81 BDiskDevice *_FindDevice(BMessage *message);
82 BPartition *_FindPartition(BMessage *message);
84 BDiskDevice *_UpdateDevice(BMessage *message);
86 private:
87 BLocker *fLocker;
88 BObjectList<BDiskDevice> fDevices;
89 bool fSubscribed;
92 #endif // _DISK_DEVICE_LIST_H