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
|
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
#include <DiskDeviceDefs.h>
|
|
|
|
#include <Messenger.h>
|
|
|
|
#include <Mime.h>
|
2003-02-01 00:17:20 +03:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
class BBitmap;
|
2003-05-29 01:46:11 +04:00
|
|
|
class BDiskDevice;
|
2003-07-07 03:11:10 +04:00
|
|
|
class BDiskDeviceVisitor;
|
|
|
|
class BPartitioningInfo;
|
|
|
|
class BDiskScannerParameterEditor; // TODO: Rename!
|
|
|
|
class BDiskSystem;
|
|
|
|
class BVolume;
|
|
|
|
struct user_partition_data;
|
2003-05-29 01:46:11 +04:00
|
|
|
|
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;
|
2003-05-29 01:51:24 +04:00
|
|
|
uint32 BlockSize() const;
|
2003-06-10 03:02:16 +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-07-08 21:38:45 +04:00
|
|
|
bool ContainsFileSystem() const;
|
|
|
|
bool ContainsPartitioningSystem() const;
|
2003-05-29 01:46:11 +04:00
|
|
|
|
|
|
|
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-07-07 03:11:10 +04:00
|
|
|
|
|
|
|
uint32 Flags() const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
const char *Name() const;
|
|
|
|
const char *ContentName() const;
|
|
|
|
const char *Type() const; // See DiskDeviceTypes.h
|
|
|
|
const char *ContentType() const; // See DiskDeviceTypes.h
|
2003-06-10 03:02:16 +04:00
|
|
|
partition_id UniqueID() const;
|
2003-07-07 03:11:10 +04:00
|
|
|
// TODO: just ID() ?
|
2003-06-23 03:29:29 +04:00
|
|
|
|
|
|
|
status_t GetDiskSystem(BDiskSystem *diskSystem) const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
virtual status_t GetPath(BPath *path) const;
|
2003-05-29 01:46:11 +04:00
|
|
|
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-06-10 03:02:16 +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-07-07 03:11:10 +04:00
|
|
|
status_t GetPartitioningInfo(BPartitioningInfo *info) const;
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
BPartition *VisitEachChild(BDiskDeviceVisitor *visitor);
|
|
|
|
virtual BPartition *VisitEachDescendent(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:47:29 +04:00
|
|
|
bool CanDefragment(bool *whileMounted = NULL) const;
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t Defragment() const;
|
|
|
|
|
2003-05-29 01:47:29 +04:00
|
|
|
bool CanRepair(bool *checkOnly, bool *whileMounted = NULL) const;
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t Repair(bool checkOnly) const;
|
|
|
|
|
2003-05-29 01:47:29 +04:00
|
|
|
bool CanResize(bool *whileMounted = NULL) const;
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t ValidateResize(off_t*) const;
|
|
|
|
status_t Resize(off_t);
|
|
|
|
|
2003-05-29 01:47:29 +04:00
|
|
|
bool CanMove(bool *whileMounted = NULL) const;
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t ValidateMove(off_t*) const;
|
|
|
|
status_t Move(off_t);
|
|
|
|
|
2003-05-29 01:47:29 +04:00
|
|
|
bool CanEditParameters(bool *whileMounted = NULL) const;
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t GetParameterEditor(
|
2003-05-29 01:47:29 +04:00
|
|
|
BDiskScannerParameterEditor **editor,
|
|
|
|
BDiskScannerParameterEditor **contentEditor);
|
2003-05-29 01:51:24 +04:00
|
|
|
status_t SetParameters(const char *parameters, const char *contentParameters);
|
2003-05-29 01:46:11 +04:00
|
|
|
|
2003-06-10 03:02:16 +04:00
|
|
|
// TODO: Add name/content name editing methods, Also in BDiskSystem.
|
|
|
|
|
2003-05-29 01:47:29 +04:00
|
|
|
bool CanInitialize(const char *diskSystem) const;
|
2003-05-29 01:46:11 +04:00
|
|
|
status_t GetInitializationParameterEditor(const char *system,
|
|
|
|
BDiskScannerParameterEditor **editor) const;
|
2003-06-23 03:29:29 +04:00
|
|
|
status_t Initialize(const char *diskSystem, const char *parameters);
|
2003-05-29 01:46:11 +04:00
|
|
|
|
|
|
|
// Modification of child partitions
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-05-29 01:46:11 +04:00
|
|
|
bool CanCreateChild() const;
|
2003-06-23 03:29:29 +04:00
|
|
|
status_t GetChildCreationParameterEditor(const char *system,
|
2003-05-29 01:47:29 +04:00
|
|
|
BDiskScannerParameterEditor **editor) const;
|
|
|
|
status_t ValidateCreateChild(off_t *start, off_t *size,
|
2003-06-23 03:29:29 +04:00
|
|
|
const char *type, const char *parameters) const;
|
|
|
|
status_t CreateChild(off_t start, off_t size, const char *type,
|
|
|
|
const char *parameters, BPartition** child = NULL);
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-06-10 03:02:16 +04:00
|
|
|
bool CanDeleteChild(int32 index) const;
|
|
|
|
status_t DeleteChild(int32 index);
|
2003-05-29 01:43:58 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
private:
|
|
|
|
BPartition();
|
|
|
|
BPartition(const Partition &);
|
|
|
|
virtual ~BPartition();
|
2003-05-29 01:51:24 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
status_t SetTo(BDiskDevice *device, BPartition *parent,
|
|
|
|
user_partition_data *data);
|
|
|
|
void Unset();
|
2003-05-29 01:51:24 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
friend class BDiskDevice;
|
2003-05-29 01:51:24 +04:00
|
|
|
|
2003-07-07 03:11:10 +04:00
|
|
|
BDiskDevice *fDevice;
|
|
|
|
BPartition *fParent;
|
|
|
|
user_partition_data *fPartitionData;
|
|
|
|
};
|
2003-02-01 00:17:20 +03:00
|
|
|
|
|
|
|
#endif // _PARTITION_H
|