2003-02-01 01:05:09 +03:00
|
|
|
//----------------------------------------------------------------------
|
|
|
|
// This software is part of the OpenBeOS distribution and is covered
|
|
|
|
// by the OpenBeOS license.
|
|
|
|
//---------------------------------------------------------------------
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
#ifndef _PARTITION_H
|
|
|
|
#define _PARTITION_H
|
|
|
|
|
|
|
|
#include <ObjectList.h>
|
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
class BDiskDevice;
|
|
|
|
|
|
|
|
// partition statuses
|
|
|
|
enum {
|
|
|
|
B_PARTITION_VALID,
|
|
|
|
B_PARTITION_CORRUPT,
|
|
|
|
B_PARTITION_UNRECOGNIZED,
|
|
|
|
}
|
|
|
|
|
2003-02-01 00:17:20 +03:00
|
|
|
class BPartition {
|
|
|
|
public:
|
2003-05-29 01:46:11 +04:00
|
|
|
// Partition Info
|
2003-05-29 01:43:58 +04:00
|
|
|
|
|
|
|
off_t Offset() const; // 0 for devices
|
2003-02-01 00:17:20 +03:00
|
|
|
off_t Size() const;
|
|
|
|
int32 BlockSize() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
int32 Index() const; // 0 for devices
|
2003-05-29 01:46:11 +04:00
|
|
|
uint32 Status() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
bool IsMountable() const;
|
|
|
|
bool IsPartitionable() const;
|
|
|
|
|
|
|
|
bool IsDevice() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
bool IsReadOnly() const;
|
2003-05-29 01:46:11 +04:00
|
|
|
bool IsMounted() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
|
|
|
const char* Name() const;
|
|
|
|
const char* Type() const; // See DiskDeviceTypes.h
|
2003-02-01 00:17:20 +03:00
|
|
|
int32 UniqueID() const;
|
2003-05-29 01:46:11 +04:00
|
|
|
uint32 Flags() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t GetPath(BPath *path) const;
|
|
|
|
status_t GetVolume(BVolume *volume) const;
|
|
|
|
status_t GetIcon(BBitmap *icon, icon_size which) const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t Mount(uint32 mountFlags = 0, const char *parameters = NULL);
|
|
|
|
status_t Unmount();
|
|
|
|
|
2003-05-29 01:43:58 +04:00
|
|
|
// Hierarchy Info
|
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
BDiskDevice* Device() const;
|
|
|
|
BPartition* Parent() const;
|
|
|
|
BPartition* ChildAt(int32 index) const;
|
|
|
|
int32 CountChildren() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
BPartitionableSpace* PartitionableSpaceAt(int32 index) const;
|
|
|
|
int32 CountPartitionableSpaces() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
|
|
|
BPartition* VisitEachChild(BDiskDeviceVisitor *visitor);
|
2003-05-29 01:46:11 +04:00
|
|
|
BPartition* VisitSubtree(BDiskDeviceVisitor *visitor);
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
// Self Modification
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
bool IsLocked() const;
|
|
|
|
status_t Lock(); // to be non-blocking
|
|
|
|
status_t Unlock();
|
|
|
|
|
|
|
|
bool CanDefragment() const;
|
|
|
|
status_t Defragment() const;
|
|
|
|
|
|
|
|
bool CanRepair(bool checkOnly) const;
|
|
|
|
status_t Repair(bool checkOnly) const;
|
|
|
|
|
|
|
|
bool CanResize() const;
|
|
|
|
bool CanResizeWhileMounted() const;
|
|
|
|
status_t ValidateResize(off_t*) const;
|
|
|
|
status_t Resize(off_t);
|
|
|
|
|
|
|
|
bool CanMove() const;
|
|
|
|
status_t ValidateMove(off_t*) const;
|
|
|
|
status_t Move(off_t);
|
|
|
|
|
|
|
|
bool CanEditParameters() const;
|
|
|
|
status_t GetParameterEditor(
|
|
|
|
BDiskScannerParameterEditor **editor,
|
|
|
|
BDiskScannerParameterEditor **parentEditor);
|
|
|
|
status_t ValidateSetParameters(const char **parameters) const;
|
|
|
|
status_t SetParameters(const char *parameters);
|
|
|
|
|
|
|
|
bool CanInitialize() 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
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
bool CanCreateChild() const;
|
|
|
|
status_t ValidateCreateChild(
|
|
|
|
off_t *start,
|
|
|
|
off_t *size) const;
|
|
|
|
status_t CreateChild(off_t start, off_t size);
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
bool CanDeleteChild(int32 index) const;
|
|
|
|
status_t DeleteChild();
|
2003-05-29 01:43:58 +04:00
|
|
|
|
|
|
|
protected:
|
|
|
|
BObjectList<BPartition> fChildren;
|
2003-02-08 03:39:38 +03:00
|
|
|
int32 fUniqueID;
|
|
|
|
int32 fChangeCounter;
|
2003-05-29 01:43:58 +04:00
|
|
|
off_t fOffset;
|
|
|
|
off_t fSize;
|
|
|
|
int32 fBlockSize;
|
2003-02-08 03:39:38 +03:00
|
|
|
int32 fIndex;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
|
|
|
bool fIsMountable;
|
|
|
|
bool fIsDevice;
|
|
|
|
bool fIsReadOnly;
|
|
|
|
|
|
|
|
char fName[B_FILE_NAME_LENGTH];
|
|
|
|
char fType[B_FILE_NAME_LENGTH];
|
|
|
|
}
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
#endif // _PARTITION_H
|