DiskDevice API v2.2.

git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3375 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Tyler Dauwalder
2003-05-28 21:46:11 +00:00
parent 40f3824020
commit 17dc6e0c84
9 changed files with 225 additions and 93 deletions
+28 -18
View File
@@ -14,7 +14,9 @@
class BDirectory;
class BDiskDevice;
class BDiskDeviceJob;
class BDiskScannerPartitionAddOn;
class BDiskSystem;
class BPartition;
class BSession;
@@ -29,6 +31,7 @@ enum {
B_DEVICE_REQUEST_PARTITION = 0x04, // partition changes
B_DEVICE_REQUEST_DEVICE = 0x10, // device changes (media changes)
B_DEVICE_REQUEST_DEVICE_LIST = 0x20, // device additions/removals
B_DEVICE_REQUEST_JOBS = 0x40, // job addition/initiation/completion
B_DEVICE_REQUEST_ALL = 0xff, // all events
};
@@ -43,22 +46,28 @@ enum {
B_DEVICE_MOUNT_POINT_MOVED, // mount point moved/renamed
B_DEVICE_PARTITION_MOUNTED, // partition mounted
B_DEVICE_PARTITION_UNMOUNTED, // partition unmounted
B_DEVICE_PARTITION_CHANGED, // partition changed, e.g. initialized
// or resized or moved
B_DEVICE_PARTITION_ADDED, // partition added
B_DEVICE_PARTITION_REMOVED, // partition removed
B_DEVICE_PARTITION_INITIALIZED, // partition initialized
B_DEVICE_PARTITION_RESIZED, // partition resized
B_DEVICE_PARTITION_MOVED, // partition moved
B_DEVICE_PARTITION_CREATED, // partition created
B_DEVICE_PARTITION_DELETED, // partition deleted
B_DEVICE_PARTITION_DEFRAGMENTED, // partition defragmented
B_DEVICE_PARTITION_REPAIRED, // partition repaired
B_DEVICE_MEDIA_CHANGED, // media changed
B_DEVICE_ADDED, // device added
B_DEVICE_REMOVED // device removed
B_DEVICE_REMOVED, // device removed
B_DEVICE_JOB_ADDED, // job added
B_DEVICE_JOB_INITIATED, // job initiated
B_DEVICE_JOB_FINISHED, // job finished
};
// notification message "cause" field values
enum {
// helpful causes
B_DEVICE_CAUSE_MEDIA_CHANGED,
B_DEVICE_CAUSE_FORMATTED,
B_DEVICE_CAUSE_PARTITIONED,
B_DEVICE_CAUSE_INITIALIZED,
B_DEVICE_CAUSE_FORMATTED, // is this still applicable?
B_DEVICE_CAUSE_PARTITIONED, // is this still applicable?
B_DEVICE_CAUSE_INITIALIZED, // is this still applicable?
// unknown cause
B_DEVICE_CAUSE_UNKNOWN,
// for internal use only (e.g.: partition added, because device added)
@@ -69,16 +78,22 @@ class BDiskDeviceRoster {
public:
BDiskDeviceRoster();
~BDiskDeviceRoster();
status_t GetNextDevice(BDiskDevice *device);
status_t Rewind();
status_t RewindDevices();
status_t GetNextDiskSystem(BDiskSystem *system);
status_t RewindDiskSystems();
status_t GetNextActiveJob(BDiskDeviceJob *job);
status_t RewindActiveJobs();
bool VisitEachDevice(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL);
bool VisitEachPartition(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL,
BPartition **partition = NULL);
bool Traverse(BDiskDeviceVisitor *visitor);
bool VisitAll(BDiskDeviceVisitor *visitor);
bool VisitEachMountedPartition(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL,
@@ -92,7 +107,8 @@ public:
bool VisitEachPartitionablePartition(BDiskDeviceVisitor *visitor,
BDiskDevice *device = NULL,
BPartition **partition = NULL);
// Do we want visit functions for disk systems and/or jobs?
status_t GetDeviceWithID(int32 id, BDiskDevice *device) const;
status_t GetPartitionWithID(int32 id, BDiskDevice *device,
@@ -102,12 +118,6 @@ public:
uint32 eventMask = B_DEVICE_REQUEST_ALL);
status_t StopWatching(BMessenger target);
// partition and FS add-ons
status_t GetNextPartitioningSystem(char *shortName, char *longName = NULL);
status_t GetNextFileSystem(char *shortName, char *longName = NULL);
status_t RewindPartitiningSystems();
status_t RewindFileSystems();
private:
status_t _GetObjectWithID(const char *fieldName, int32 id,
BDiskDevice *device) const;