Files
haiku-beta6/headers/private/storage/Partition.h
T

126 lines
3.4 KiB
C++
Raw Normal View History

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