DiskDevice API v2.3.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3376 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -8,7 +8,6 @@
|
||||
|
||||
class BDiskDevice : public BPartition {
|
||||
public:
|
||||
char* DeviceType() const;
|
||||
bool IsRemovable() const;
|
||||
bool HasMedia() const;
|
||||
|
||||
@@ -20,6 +19,7 @@ public:
|
||||
bool IsModified() const;
|
||||
int32 CommitModifications(bool synchronously = true,
|
||||
BMessenger progressMessenger = BMessenger(),
|
||||
bool receiveCompleteProgressUpdates = true,
|
||||
BMessage *template = NULL);
|
||||
private:
|
||||
friend class BDiskDeviceList;
|
||||
|
||||
@@ -15,14 +15,24 @@ enum {
|
||||
B_DISK_DEVICE_JOB_MOVE,
|
||||
B_DISK_DEVICE_JOB_DEFRAGMENT,
|
||||
B_DISK_DEVICE_JOB_REPAIR,
|
||||
}
|
||||
};
|
||||
|
||||
// disk device job statuses
|
||||
enum {
|
||||
B_DISK_DEVICE_JOB_UNINITIALIZED,
|
||||
B_DISK_DEVICE_JOB_SCHEDULED,
|
||||
B_DISK_DEVICE_JOB_IN_PROGRESS,
|
||||
B_DISK_DEVICE_JOB_SUCCEEDED,
|
||||
B_DISK_DEVICE_JOB_FAILED,
|
||||
B_DISK_DEVICE_JOB_CANCELED,
|
||||
};
|
||||
|
||||
class BDiskDeviceJob {
|
||||
public:
|
||||
int32 ID() const;
|
||||
uint32 Type() const;
|
||||
uint8 Progress() const; // 0 to 100
|
||||
bool Finished() const;
|
||||
uint32 Status() const;
|
||||
const char *Description() const;
|
||||
|
||||
BPartition* Partition() const;
|
||||
|
||||
@@ -26,13 +26,19 @@ namespace BPrivate {
|
||||
|
||||
// watchable events
|
||||
enum {
|
||||
B_DEVICE_REQUEST_MOUNT_POINT = 0x01, // mount point changes
|
||||
B_DEVICE_REQUEST_MOUNTING = 0x02, // mounting/unmounting
|
||||
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
|
||||
// Basic masks
|
||||
B_DEVICE_REQUEST_MOUNT_POINT = 0x0001, // mount point changes
|
||||
B_DEVICE_REQUEST_MOUNTING = 0x0002, // mounting/unmounting
|
||||
B_DEVICE_REQUEST_PARTITION = 0x0004, // partition changes
|
||||
B_DEVICE_REQUEST_DEVICE = 0x0008, // device changes (media changes)
|
||||
B_DEVICE_REQUEST_DEVICE_LIST = 0x0010, // device additions/removals
|
||||
B_DEVICE_REQUEST_JOB_LIST = 0x0020, // job addition/initiation/cancellation/completion
|
||||
B_DEVICE_REQUEST_JOB_SIMPLE_PROGRESS = 0x0040, // simple job progress (i.e. "% complete" only)
|
||||
B_DEVICE_REQUEST_JOB_EXTRA_PROGRESS = 0x0080, // extra info on job progress (no "% complete" info)
|
||||
|
||||
// Combination masks
|
||||
B_DEVICE_REQUEST_JOB_COMPLETE_PROGRESS = 0x00C0, // complete job progress info
|
||||
B_DEVICE_REQUEST_ALL = 0xffff, // all events
|
||||
};
|
||||
|
||||
// notification message "what" field
|
||||
@@ -56,9 +62,12 @@ enum {
|
||||
B_DEVICE_MEDIA_CHANGED, // media changed
|
||||
B_DEVICE_ADDED, // device added
|
||||
B_DEVICE_REMOVED, // device removed
|
||||
B_DEVICE_JOB_ADDED, // job added
|
||||
B_DEVICE_JOB_SCHEDULED, // job added
|
||||
B_DEVICE_JOB_INITIATED, // job initiated
|
||||
B_DEVICE_JOB_CANCELED, // job canceled
|
||||
B_DEVICE_JOB_FINISHED, // job finished
|
||||
B_DEVICE_JOB_SIMPLE_PROGRESS, // job percent complete progress
|
||||
B_DEVICE_JOB_EXTRA_PROGRESS, // extended job progress info
|
||||
};
|
||||
|
||||
// notification message "cause" field values
|
||||
@@ -85,6 +94,7 @@ public:
|
||||
status_t GetNextDiskSystem(BDiskSystem *system);
|
||||
status_t RewindDiskSystems();
|
||||
|
||||
// Active jobs are those that are scheduled or in-progress
|
||||
status_t GetNextActiveJob(BDiskDeviceJob *job);
|
||||
status_t RewindActiveJobs();
|
||||
|
||||
@@ -108,14 +118,14 @@ public:
|
||||
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,
|
||||
BPartition **partition) const;
|
||||
|
||||
status_t StartWatching(BMessenger target,
|
||||
uint32 eventMask = B_DEVICE_REQUEST_ALL);
|
||||
status_t StartWatchingJob(BDiskDeviceJob *job, BMessenger target,
|
||||
uint32 eventMask = B_DEVICE_REQUEST_JOB_COMPLETE_PROGRESS);
|
||||
status_t StopWatching(BMessenger target);
|
||||
|
||||
private:
|
||||
|
||||
@@ -23,7 +23,10 @@ const char *kPartitionTypeCDDA = "Compact Disc Audio Session";
|
||||
const char *kPartitionTypeAmiga = "Amiga Partition Map";
|
||||
const char *kPartitionTypeApple = "Apple Partition Map";
|
||||
const char *kPartitionTypeIntel = "Intel Partition Map";
|
||||
|
||||
const char *kPartitionTypeIntelPrimary = "Intel Primary Partition";
|
||||
const char *kPartitionTypeIntelExtended = "Intel Extended Partition";
|
||||
const char *kPartitionTypeIntelLogical = "Intel Logical Partition";
|
||||
|
||||
const char *kPartitionTypeAmigaFFS = "AmigaFFS Filesystem";
|
||||
const char *kPartitionTypeBFS = "BFS Filesystem";
|
||||
|
||||
@@ -10,27 +10,29 @@ class BDiskSystem {
|
||||
public:
|
||||
const char *Name() const;
|
||||
|
||||
bool SupportsDefragmenting(BPartition *partition) const;
|
||||
bool SupportsRepairing(BPartition *partition, bool checkOnly) const;
|
||||
bool SupportsResizing(BPartition *partition) const;
|
||||
bool SupportsDefragmenting(BPartition *partition, bool *whileMounted) const;
|
||||
bool SupportsRepairing(BPartition *partition, bool checkOnly, bool *whileMounted) const;
|
||||
bool SupportsResizing(BPartition *partition, bool *whileMounted) const;
|
||||
bool SupportsResizingChild(BPartition *child) const;
|
||||
bool SupportsMoving(BPartition *partition) const;
|
||||
bool SupportsMoving(BPartition *partition, bool *whileMounted) const;
|
||||
bool SupportsMovingChild(BPartition *child) const;
|
||||
bool SupportsParentSystem(const char *system) const;
|
||||
// True in most cases. NULL == raw device.
|
||||
bool SupportsChildSystem(const char *system) const;
|
||||
// False for most file systems, true for most partitioning
|
||||
// systems.
|
||||
|
||||
|
||||
bool ValidateResize(BPartition *partition, off_t *size) const;
|
||||
bool ValidateMove(BPartition *partition, off_t *start) const;
|
||||
bool ValidateResizeChild(BPartition *partition, off_t *size) const;
|
||||
bool ValidateMoveChild(BPartition *partition, off_t *start) const;
|
||||
bool ValidateCreateChild(BPartition *partition, off_t *start, off_t *size) const;
|
||||
bool ValidateCreateChild(BPartition *partition, off_t *start, off_t *size, const char *parameters) const;
|
||||
bool ValidateInitialize(BPartition *partition) const;
|
||||
|
||||
bool IsPartitioningSystem() const;
|
||||
bool IsFileSystem() const;
|
||||
bool IsSubSystemFor(BPartition *parent) const;
|
||||
};
|
||||
|
||||
#endif // _DISK_SYSTEM_H
|
||||
|
||||
@@ -35,7 +35,8 @@ public:
|
||||
bool IsMounted() const;
|
||||
|
||||
const char* Name() const;
|
||||
const char* Type() const; // See DiskDeviceTypes.h
|
||||
const char* Type() const; // See DiskDeviceTypes.h
|
||||
const char* ContentType() const; // See DiskDeviceTypes.h
|
||||
int32 UniqueID() const;
|
||||
uint32 Flags() const;
|
||||
|
||||
@@ -57,7 +58,7 @@ public:
|
||||
int32 CountPartitionableSpaces() const;
|
||||
|
||||
BPartition* VisitEachChild(BDiskDeviceVisitor *visitor);
|
||||
BPartition* VisitSubtree(BDiskDeviceVisitor *visitor);
|
||||
BPartition* VisitEachDescendent(BDiskDeviceVisitor *visitor);
|
||||
|
||||
// Self Modification
|
||||
|
||||
@@ -65,45 +66,44 @@ public:
|
||||
status_t Lock(); // to be non-blocking
|
||||
status_t Unlock();
|
||||
|
||||
bool CanDefragment() const;
|
||||
bool CanDefragment(bool *whileMounted = NULL) const;
|
||||
status_t Defragment() const;
|
||||
|
||||
bool CanRepair(bool checkOnly) const;
|
||||
bool CanRepair(bool *checkOnly, bool *whileMounted = NULL) const;
|
||||
status_t Repair(bool checkOnly) const;
|
||||
|
||||
bool CanResize() const;
|
||||
bool CanResizeWhileMounted() const;
|
||||
bool CanResize(bool *whileMounted = NULL) const;
|
||||
status_t ValidateResize(off_t*) const;
|
||||
status_t Resize(off_t);
|
||||
|
||||
bool CanMove() const;
|
||||
bool CanMove(bool *whileMounted = NULL) const;
|
||||
status_t ValidateMove(off_t*) const;
|
||||
status_t Move(off_t);
|
||||
|
||||
bool CanEditParameters() const;
|
||||
bool CanEditParameters(bool *whileMounted = NULL) const;
|
||||
status_t GetParameterEditor(
|
||||
BDiskScannerParameterEditor **editor,
|
||||
BDiskScannerParameterEditor **parentEditor);
|
||||
status_t ValidateSetParameters(const char **parameters) const;
|
||||
status_t SetParameters(const char *parameters);
|
||||
BDiskScannerParameterEditor **editor,
|
||||
BDiskScannerParameterEditor **contentEditor);
|
||||
status_t SetParameters(const char *parameters, const char **contentParameters);
|
||||
|
||||
bool CanInitialize() const;
|
||||
bool CanInitialize(const char *diskSystem) const;
|
||||
status_t GetInitializationParameterEditor(const char *system,
|
||||
BDiskScannerParameterEditor **editor) const;
|
||||
status_t ValidateInitialize(const char *diskSystem, const char **parameters) const;
|
||||
status_t Initialize(const char *diskSystem,
|
||||
const char *parameters);
|
||||
|
||||
// Modification of child partitions
|
||||
|
||||
bool CanCreateChild() const;
|
||||
status_t ValidateCreateChild(
|
||||
off_t *start,
|
||||
off_t *size) const;
|
||||
status_t CreateChild(off_t start, off_t size);
|
||||
status_t GetChildCreationParameterEditor(const char *system,
|
||||
BDiskScannerParameterEditor **editor) const;
|
||||
status_t ValidateCreateChild(off_t *start, off_t *size,
|
||||
const char *parameters) const;
|
||||
status_t CreateChild(off_t start, off_t size, const char *parameters,
|
||||
**BPartition child = NULL);
|
||||
|
||||
bool CanDeleteChild(int32 index) const;
|
||||
status_t DeleteChild();
|
||||
status_t DeleteChild(int32 index);
|
||||
|
||||
protected:
|
||||
BObjectList<BPartition> fChildren;
|
||||
|
||||
Reference in New Issue
Block a user