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