2003-02-20 03:20:36 +03:00
|
|
|
//----------------------------------------------------------------------
|
2005-05-03 04:28:31 +04:00
|
|
|
// This software is part of the Haiku distribution and is covered
|
|
|
|
// by the MIT license.
|
2003-02-20 03:20:36 +03:00
|
|
|
//---------------------------------------------------------------------
|
|
|
|
#ifndef _DISK_DEVICE_LIST_H
|
|
|
|
#define _DISK_DEVICE_LIST_H
|
|
|
|
|
2005-05-03 04:28:31 +04:00
|
|
|
|
2003-02-20 03:20:36 +03:00
|
|
|
#include <DiskDeviceVisitor.h>
|
|
|
|
#include <Handler.h>
|
|
|
|
#include <ObjectList.h>
|
|
|
|
|
2005-05-03 04:28:31 +04:00
|
|
|
|
2003-02-20 03:20:36 +03:00
|
|
|
class BDiskDevice;
|
2004-11-01 18:27:45 +03:00
|
|
|
class BDiskDeviceRoster;
|
2003-02-20 03:20:36 +03:00
|
|
|
class BPartition;
|
|
|
|
class BSession;
|
|
|
|
|
|
|
|
class BDiskDeviceList : public BHandler {
|
|
|
|
public:
|
2005-05-03 04:28:31 +04:00
|
|
|
BDiskDeviceList(bool useOwnLocker = true);
|
2003-02-20 03:20:36 +03:00
|
|
|
virtual ~BDiskDeviceList();
|
|
|
|
|
|
|
|
virtual void MessageReceived(BMessage *message);
|
|
|
|
virtual void SetNextHandler(BHandler *handler);
|
|
|
|
|
|
|
|
status_t Fetch();
|
|
|
|
void Unset();
|
|
|
|
|
|
|
|
bool Lock();
|
|
|
|
void Unlock();
|
|
|
|
|
2003-06-10 03:02:16 +04:00
|
|
|
int32 CountDevices() const;
|
|
|
|
BDiskDevice *DeviceAt(int32 index) const;
|
2003-02-20 03:20:36 +03:00
|
|
|
|
|
|
|
BDiskDevice *VisitEachDevice(BDiskDeviceVisitor *visitor);
|
|
|
|
BPartition *VisitEachPartition(BDiskDeviceVisitor *visitor);
|
|
|
|
|
|
|
|
BPartition *VisitEachMountedPartition(BDiskDeviceVisitor *visitor);
|
|
|
|
BPartition *VisitEachMountablePartition(BDiskDeviceVisitor *visitor);
|
|
|
|
|
2003-06-10 03:02:16 +04:00
|
|
|
BDiskDevice *DeviceWithID(partition_id id) const;
|
|
|
|
BPartition *PartitionWithID(partition_id id) const;
|
2003-02-20 03:20:36 +03:00
|
|
|
|
|
|
|
virtual void MountPointMoved(BPartition *partition);
|
|
|
|
virtual void PartitionMounted(BPartition *partition);
|
|
|
|
virtual void PartitionUnmounted(BPartition *partition);
|
2004-11-01 18:27:45 +03:00
|
|
|
virtual void PartitionInitialized(BPartition *partition);
|
2003-05-29 01:46:11 +04:00
|
|
|
virtual void PartitionResized(BPartition *partition);
|
|
|
|
virtual void PartitionMoved(BPartition *partition);
|
|
|
|
virtual void PartitionCreated(BPartition *partition);
|
2004-11-01 18:27:45 +03:00
|
|
|
virtual void PartitionDeleted(BPartition *partition,
|
|
|
|
partition_id partitionID);
|
2003-05-29 01:46:11 +04:00
|
|
|
virtual void PartitionDefragmented(BPartition *partition);
|
|
|
|
virtual void PartitionRepaired(BPartition *partition);
|
2004-11-01 18:27:45 +03:00
|
|
|
virtual void PartitionChanged(BPartition *partition, uint32 event);
|
2003-02-20 03:20:36 +03:00
|
|
|
virtual void MediaChanged(BDiskDevice *device);
|
|
|
|
virtual void DeviceAdded(BDiskDevice *device);
|
|
|
|
virtual void DeviceRemoved(BDiskDevice *device);
|
|
|
|
|
|
|
|
private:
|
2004-11-01 18:27:45 +03:00
|
|
|
status_t _StartWatching();
|
|
|
|
void _StopWatching();
|
|
|
|
|
2003-02-20 03:20:36 +03:00
|
|
|
void _MountPointMoved(BMessage *message);
|
|
|
|
void _PartitionMounted(BMessage *message);
|
|
|
|
void _PartitionUnmounted(BMessage *message);
|
2003-05-29 01:46:11 +04:00
|
|
|
void _PartitionInitialized(BMessage *message);
|
|
|
|
void _PartitionResized(BMessage *message);
|
|
|
|
void _PartitionMoved(BMessage *message);
|
|
|
|
void _PartitionCreated(BMessage *message);
|
|
|
|
void _PartitionDeleted(BMessage *message);
|
|
|
|
void _PartitionDefragmented(BMessage *message);
|
|
|
|
void _PartitionRepaired(BMessage *message);
|
2003-02-20 03:20:36 +03:00
|
|
|
void _MediaChanged(BMessage *message);
|
|
|
|
void _DeviceAdded(BMessage *message);
|
|
|
|
void _DeviceRemoved(BMessage *message);
|
|
|
|
|
|
|
|
BDiskDevice *_FindDevice(BMessage *message);
|
|
|
|
BPartition *_FindPartition(BMessage *message);
|
|
|
|
|
|
|
|
BDiskDevice *_UpdateDevice(BMessage *message);
|
|
|
|
|
|
|
|
private:
|
|
|
|
BLocker *fLocker;
|
|
|
|
BObjectList<BDiskDevice> fDevices;
|
|
|
|
bool fSubscribed;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif // _DISK_DEVICE_LIST_H
|