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 7 8 9 #include <DiskDeviceDefs.h> 10 #include <DiskDeviceVisitor.h> 11 #include <Handler.h> 12 #include <ObjectList.h> 13 14 15 class BDiskDevice; 16 class BDiskDeviceRoster; 17 class BPartition; 18 class BSession; 19 20 class BDiskDeviceList : public BHandler { 21 public: 22 BDiskDeviceList(bool useOwnLocker = true); 23 virtual ~BDiskDeviceList(); 24 25 virtual void MessageReceived(BMessage *message); 26 virtual void SetNextHandler(BHandler *handler); 27 28 status_t Fetch(); 29 void Unset(); 30 31 bool Lock(); 32 void Unlock(); 33 34 int32 CountDevices() const; 35 BDiskDevice *DeviceAt(int32 index) const; 36 37 BDiskDevice *VisitEachDevice(BDiskDeviceVisitor *visitor); 38 BPartition *VisitEachPartition(BDiskDeviceVisitor *visitor); 39 40 BPartition *VisitEachMountedPartition(BDiskDeviceVisitor *visitor); 41 BPartition *VisitEachMountablePartition(BDiskDeviceVisitor *visitor); 42 43 BDiskDevice *DeviceWithID(partition_id id) const; 44 BPartition *PartitionWithID(partition_id id) const; 45 46 virtual void MountPointMoved(BPartition *partition); 47 virtual void PartitionMounted(BPartition *partition); 48 virtual void PartitionUnmounted(BPartition *partition); 49 virtual void PartitionInitialized(BPartition *partition); 50 virtual void PartitionResized(BPartition *partition); 51 virtual void PartitionMoved(BPartition *partition); 52 virtual void PartitionCreated(BPartition *partition); 53 virtual void PartitionDeleted(BPartition *partition, 54 partition_id partitionID); 55 virtual void PartitionDefragmented(BPartition *partition); 56 virtual void PartitionRepaired(BPartition *partition); 57 virtual void PartitionChanged(BPartition *partition, uint32 event); 58 virtual void MediaChanged(BDiskDevice *device); 59 virtual void DeviceAdded(BDiskDevice *device); 60 virtual void DeviceRemoved(BDiskDevice *device); 61 62 private: 63 status_t _StartWatching(); 64 void _StopWatching(); 65 66 void _MountPointMoved(BMessage *message); 67 void _PartitionMounted(BMessage *message); 68 void _PartitionUnmounted(BMessage *message); 69 void _PartitionInitialized(BMessage *message); 70 void _PartitionResized(BMessage *message); 71 void _PartitionMoved(BMessage *message); 72 void _PartitionCreated(BMessage *message); 73 void _PartitionDeleted(BMessage *message); 74 void _PartitionDefragmented(BMessage *message); 75 void _PartitionRepaired(BMessage *message); 76 void _MediaChanged(BMessage *message); 77 void _DeviceAdded(BMessage *message); 78 void _DeviceRemoved(BMessage *message); 79 80 BDiskDevice *_FindDevice(BMessage *message); 81 BPartition *_FindPartition(BMessage *message); 82 83 BDiskDevice *_UpdateDevice(BMessage *message); 84 85 private: 86 BLocker *fLocker; 87 BObjectList<BDiskDevice> fDevices; 88 bool fSubscribed; 89 }; 90 91 #endif // _DISK_DEVICE_LIST_H 92