DiskDevice API v2.4
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@3378 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -17,7 +17,7 @@ public:
|
||||
void Unset();
|
||||
|
||||
bool IsModified() const;
|
||||
int32 CommitModifications(bool synchronously = true,
|
||||
uint32 CommitModifications(bool synchronously = true,
|
||||
BMessenger progressMessenger = BMessenger(),
|
||||
bool receiveCompleteProgressUpdates = true,
|
||||
BMessage *template = NULL);
|
||||
|
||||
@@ -6,6 +6,8 @@
|
||||
#ifndef _DISK_DEVICE_JOB_H
|
||||
#define _DISK_DEVICE_JOB_H
|
||||
|
||||
#include <String.h>
|
||||
|
||||
// disk device job types
|
||||
enum {
|
||||
B_DISK_DEVICE_JOB_CREATE,
|
||||
@@ -29,16 +31,19 @@ enum {
|
||||
|
||||
class BDiskDeviceJob {
|
||||
public:
|
||||
int32 ID() const;
|
||||
uint32 ID() const;
|
||||
uint32 Type() const;
|
||||
uint8 Progress() const; // 0 to 100
|
||||
float Progress() const; // [0.0, 1.0]
|
||||
uint32 Status() const;
|
||||
const char *Description() const;
|
||||
|
||||
BPartition* Partition() const;
|
||||
private:
|
||||
int32 fPartitionID;
|
||||
int32 fJobID;
|
||||
uint32 fJobID;
|
||||
uint32 fType;
|
||||
uint32 fPartitionID;
|
||||
uint32 fStatus;
|
||||
BString fDescription;
|
||||
};
|
||||
|
||||
#endif // _DISK_DEVICE_JOB_H
|
||||
|
||||
@@ -28,8 +28,8 @@ public:
|
||||
bool Lock();
|
||||
void Unlock();
|
||||
|
||||
int32 CountDevices() const;
|
||||
BDiskDevice *DeviceAt(int32 index) const;
|
||||
uint32 CountDevices() const;
|
||||
BDiskDevice *DeviceAt(uint32 index) const;
|
||||
|
||||
BDiskDevice *VisitEachDevice(BDiskDeviceVisitor *visitor);
|
||||
BPartition *VisitEachPartition(BDiskDeviceVisitor *visitor);
|
||||
@@ -39,8 +39,8 @@ public:
|
||||
BPartition *VisitEachMountablePartition(BDiskDeviceVisitor *visitor);
|
||||
BPartition *VisitEachInitializablePartition(BDiskDeviceVisitor *visitor);
|
||||
|
||||
BDiskDevice *DeviceWithID(int32 id) const;
|
||||
BPartition *PartitionWithID(int32 id) const;
|
||||
BDiskDevice *DeviceWithID(uint32 id) const;
|
||||
BPartition *PartitionWithID(uint32 id) const;
|
||||
|
||||
virtual void MountPointMoved(BPartition *partition);
|
||||
virtual void PartitionMounted(BPartition *partition);
|
||||
|
||||
@@ -26,7 +26,6 @@ public:
|
||||
PartitionFilter *filter);
|
||||
|
||||
virtual bool Visit(BDiskDevice *device);
|
||||
virtual bool Visit(BSession *session);
|
||||
virtual bool Visit(BPartition *partition);
|
||||
|
||||
private:
|
||||
@@ -37,14 +36,13 @@ private:
|
||||
// IDFinderVisitor
|
||||
class IDFinderVisitor : public BDiskDeviceVisitor {
|
||||
public:
|
||||
IDFinderVisitor(int32 id);
|
||||
IDFinderVisitor(uint32 id);
|
||||
|
||||
virtual bool Visit(BDiskDevice *device);
|
||||
virtual bool Visit(BSession *session);
|
||||
virtual bool Visit(BPartition *partition);
|
||||
|
||||
private:
|
||||
int32 fID;
|
||||
uint32 fID;
|
||||
};
|
||||
|
||||
status_t get_disk_device_messenger(BMessenger *messenger);
|
||||
|
||||
@@ -118,8 +118,8 @@ public:
|
||||
BDiskDevice *device = NULL,
|
||||
BPartition **partition = NULL);
|
||||
|
||||
status_t GetDeviceWithID(int32 id, BDiskDevice *device) const;
|
||||
status_t GetPartitionWithID(int32 id, BDiskDevice *device,
|
||||
status_t GetDeviceWithID(uint32 id, BDiskDevice *device) const;
|
||||
status_t GetPartitionWithID(uint32 id, BDiskDevice *device,
|
||||
BPartition **partition) const;
|
||||
|
||||
status_t StartWatching(BMessenger target,
|
||||
@@ -129,19 +129,19 @@ public:
|
||||
status_t StopWatching(BMessenger target);
|
||||
|
||||
private:
|
||||
status_t _GetObjectWithID(const char *fieldName, int32 id,
|
||||
status_t _GetObjectWithID(const char *fieldName, uint32 id,
|
||||
BDiskDevice *device) const;
|
||||
|
||||
// TODO: Introduce iterators instead of these functions.
|
||||
|
||||
static status_t _GetNextAddOn(BDirectory **directory, int32 *index,
|
||||
static status_t _GetNextAddOn(BDirectory **directory, uint32 *index,
|
||||
const char *subdir,
|
||||
BPrivate::AddOnImage *image);
|
||||
static status_t _GetNextAddOn(BDirectory *directory,
|
||||
BPrivate::AddOnImage *image);
|
||||
static status_t _GetNextAddOnDir(BPath *path, int32 *index,
|
||||
static status_t _GetNextAddOnDir(BPath *path, uint32 *index,
|
||||
const char *subdir);
|
||||
static status_t _GetNextAddOnDir(BDirectory **directory, int32 *index,
|
||||
static status_t _GetNextAddOnDir(BDirectory **directory, uint32 *index,
|
||||
const char *subdir);
|
||||
|
||||
static status_t _LoadPartitionAddOn(const char *partitioningSystem,
|
||||
@@ -150,11 +150,11 @@ private:
|
||||
|
||||
private:
|
||||
BMessenger fManager;
|
||||
int32 fCookie;
|
||||
uint32 fCookie;
|
||||
BDirectory *fPartitionAddOnDir;
|
||||
BDirectory *fFSAddOnDir;
|
||||
int32 fPartitionAddOnDirIndex;
|
||||
int32 fFSAddOnDirIndex;
|
||||
uint32 fPartitionAddOnDirIndex;
|
||||
uint32 fFSAddOnDirIndex;
|
||||
};
|
||||
|
||||
#endif // _DISK_DEVICE_ROSTER_H
|
||||
|
||||
@@ -28,7 +28,6 @@ public:
|
||||
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 char *parameters) const;
|
||||
bool ValidateInitialize(BPartition *partition) const;
|
||||
|
||||
bool IsPartitioningSystem() const;
|
||||
bool IsFileSystem() const;
|
||||
|
||||
@@ -23,8 +23,8 @@ public:
|
||||
|
||||
off_t Offset() const; // 0 for devices
|
||||
off_t Size() const;
|
||||
int32 BlockSize() const;
|
||||
int32 Index() const; // 0 for devices
|
||||
uint32 BlockSize() const;
|
||||
uint32 Index() const; // 0 for devices
|
||||
uint32 Status() const;
|
||||
|
||||
bool IsMountable() const;
|
||||
@@ -37,7 +37,7 @@ public:
|
||||
const char* Name() const;
|
||||
const char* Type() const; // See DiskDeviceTypes.h
|
||||
const char* ContentType() const; // See DiskDeviceTypes.h
|
||||
int32 UniqueID() const;
|
||||
uint32 UniqueID() const;
|
||||
uint32 Flags() const;
|
||||
|
||||
status_t GetPath(BPath *path) const;
|
||||
@@ -51,11 +51,10 @@ public:
|
||||
|
||||
BDiskDevice* Device() const;
|
||||
BPartition* Parent() const;
|
||||
BPartition* ChildAt(int32 index) const;
|
||||
int32 CountChildren() const;
|
||||
BPartition* ChildAt(uint32 index) const;
|
||||
uint32 CountChildren() const;
|
||||
|
||||
BPartitionableSpace* PartitionableSpaceAt(int32 index) const;
|
||||
int32 CountPartitionableSpaces() const;
|
||||
BPartitioningInfo* GetPartitioningInfo() const;
|
||||
|
||||
BPartition* VisitEachChild(BDiskDeviceVisitor *visitor);
|
||||
BPartition* VisitEachDescendent(BDiskDeviceVisitor *visitor);
|
||||
@@ -84,7 +83,7 @@ public:
|
||||
status_t GetParameterEditor(
|
||||
BDiskScannerParameterEditor **editor,
|
||||
BDiskScannerParameterEditor **contentEditor);
|
||||
status_t SetParameters(const char *parameters, const char **contentParameters);
|
||||
status_t SetParameters(const char *parameters, const char *contentParameters);
|
||||
|
||||
bool CanInitialize(const char *diskSystem) const;
|
||||
status_t GetInitializationParameterEditor(const char *system,
|
||||
@@ -100,26 +99,35 @@ public:
|
||||
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);
|
||||
BPartition** child = NULL);
|
||||
|
||||
bool CanDeleteChild(int32 index) const;
|
||||
status_t DeleteChild(int32 index);
|
||||
bool CanDeleteChild(uint32 index) const;
|
||||
status_t DeleteChild(uint32 index);
|
||||
|
||||
protected:
|
||||
BObjectList<BPartition> fChildren;
|
||||
int32 fUniqueID;
|
||||
int32 fChangeCounter;
|
||||
off_t fOffset;
|
||||
off_t fSize;
|
||||
int32 fBlockSize;
|
||||
int32 fIndex;
|
||||
uint32 fBlockSize;
|
||||
uint32 fIndex;
|
||||
uint32 fStatus;
|
||||
|
||||
bool fIsMountable;
|
||||
bool fIsPartitionable;
|
||||
|
||||
bool fIsDevice;
|
||||
bool fIsReadOnly;
|
||||
bool fIsMounted;
|
||||
|
||||
char fName[B_FILE_NAME_LENGTH];
|
||||
char fType[B_FILE_NAME_LENGTH];
|
||||
char fContentType[B_FILE_NAME_LENGTH];
|
||||
|
||||
uint32 fUniqueID;
|
||||
uint32 fFlags;
|
||||
|
||||
BObjectList<BPartition> fChildren;
|
||||
|
||||
uint32 fChangeCounter;
|
||||
}
|
||||
|
||||
#endif // _PARTITION_H
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
//----------------------------------------------------------------------
|
||||
// This software is part of the OpenBeOS distribution and is covered
|
||||
// by the OpenBeOS license.
|
||||
//---------------------------------------------------------------------
|
||||
|
||||
#ifndef _PARTITIONING_INFO_H
|
||||
#define _PARTITIONING_INFO_H
|
||||
|
||||
class BPartition;
|
||||
|
||||
class BPartitioningInfo {
|
||||
public:
|
||||
status_t GetPartitionableSpaceAt(uint32 index, off_t *Offset, off_t *Size) const;
|
||||
uint32 CountPartitionableSpaces() const;
|
||||
|
||||
BPartition* Parent() const;
|
||||
private:
|
||||
off_t *fOffsetArray;
|
||||
off_t *fSizeArray;
|
||||
uint32 fCount;
|
||||
};
|
||||
|
||||
#endif // _PARTITIONING_INFO_H
|
||||
Reference in New Issue
Block a user