123b03456SIngo Weinhold /* 223b03456SIngo Weinhold * Copyright 2007, Ingo Weinhold, bonefish@users.sf.net. 323b03456SIngo Weinhold * Distributed under the terms of the MIT License. 423b03456SIngo Weinhold */ 523b03456SIngo Weinhold #ifndef _PARTITION_DELEGATE_H 623b03456SIngo Weinhold #define _PARTITION_DELEGATE_H 723b03456SIngo Weinhold 8*2f3ce2bfSBryce Groff #include <DiskSystemAddOn.h> 923b03456SIngo Weinhold #include <MutablePartition.h> 1023b03456SIngo Weinhold #include <Partition.h> 1123b03456SIngo Weinhold 1223b03456SIngo Weinhold 1323b03456SIngo Weinhold class BDiskSystemAddOn; 1423b03456SIngo Weinhold class BPartitionHandle; 1523b03456SIngo Weinhold 1623b03456SIngo Weinhold 1723b03456SIngo Weinhold class BPartition::Delegate { 1823b03456SIngo Weinhold public: 1923b03456SIngo Weinhold Delegate(BPartition* partition); 2023b03456SIngo Weinhold ~Delegate(); 2123b03456SIngo Weinhold Partition()2223b03456SIngo Weinhold BPartition* Partition() const { return fPartition; } 2323b03456SIngo Weinhold 2423b03456SIngo Weinhold BMutablePartition* MutablePartition(); 2523b03456SIngo Weinhold const BMutablePartition* MutablePartition() const; 2623b03456SIngo Weinhold 2723b03456SIngo Weinhold status_t InitHierarchy( 2823b03456SIngo Weinhold const user_partition_data* partitionData, 2923b03456SIngo Weinhold Delegate* parent); 3023b03456SIngo Weinhold status_t InitAfterHierarchy(); 3123b03456SIngo Weinhold 3223b03456SIngo Weinhold const user_partition_data* PartitionData() const; 3323b03456SIngo Weinhold 3423b03456SIngo Weinhold Delegate* ChildAt(int32 index) const; 3523b03456SIngo Weinhold int32 CountChildren() const; 3623b03456SIngo Weinhold 3754a5f0b7SIngo Weinhold bool IsModified() const; 3854a5f0b7SIngo Weinhold 3923b03456SIngo Weinhold uint32 SupportedOperations(uint32 mask); 4023b03456SIngo Weinhold uint32 SupportedChildOperations(Delegate* child, 4123b03456SIngo Weinhold uint32 mask); 4223b03456SIngo Weinhold 4323b03456SIngo Weinhold // Self Modification 4423b03456SIngo Weinhold 4523b03456SIngo Weinhold status_t Defragment(); 4623b03456SIngo Weinhold status_t Repair(bool checkOnly); 4723b03456SIngo Weinhold 4823b03456SIngo Weinhold status_t ValidateResize(off_t* size) const; 4923b03456SIngo Weinhold status_t ValidateResizeChild(Delegate* child, 5023b03456SIngo Weinhold off_t* size) const; 5123b03456SIngo Weinhold status_t Resize(off_t size); 5223b03456SIngo Weinhold status_t ResizeChild(Delegate* child, off_t size); 5323b03456SIngo Weinhold 5423b03456SIngo Weinhold status_t ValidateMove(off_t* offset) const; 5523b03456SIngo Weinhold status_t ValidateMoveChild(Delegate* child, 5623b03456SIngo Weinhold off_t* offset) const; 5723b03456SIngo Weinhold status_t Move(off_t offset); 5823b03456SIngo Weinhold status_t MoveChild(Delegate* child, off_t offset); 5923b03456SIngo Weinhold 6023b03456SIngo Weinhold status_t ValidateSetContentName(BString* name) const; 6123b03456SIngo Weinhold status_t ValidateSetName(Delegate* child, 6223b03456SIngo Weinhold BString* name) const; 6323b03456SIngo Weinhold status_t SetContentName(const char* name); 6423b03456SIngo Weinhold status_t SetName(Delegate* child, const char* name); 6523b03456SIngo Weinhold 6623b03456SIngo Weinhold status_t ValidateSetType(Delegate* child, 6723b03456SIngo Weinhold const char* type) const; 6823b03456SIngo Weinhold status_t SetType(Delegate* child, const char* type); 6923b03456SIngo Weinhold 7023b03456SIngo Weinhold status_t SetContentParameters(const char* parameters); 7123b03456SIngo Weinhold status_t SetParameters(Delegate* child, 7223b03456SIngo Weinhold const char* parameters); 7323b03456SIngo Weinhold 74*2f3ce2bfSBryce Groff status_t GetParameterEditor( 75*2f3ce2bfSBryce Groff B_PARAMETER_EDITOR_TYPE type, 76*2f3ce2bfSBryce Groff BPartitionParameterEditor** editor) const; 7723b03456SIngo Weinhold status_t GetNextSupportedChildType(Delegate* child, 7823b03456SIngo Weinhold int32* cookie, BString* type) const; 7923b03456SIngo Weinhold bool IsSubSystem(Delegate* child, 8023b03456SIngo Weinhold const char* diskSystem) const; 8123b03456SIngo Weinhold 8223b03456SIngo Weinhold bool CanInitialize(const char* diskSystem) const; 8323b03456SIngo Weinhold status_t ValidateInitialize(const char* diskSystem, 8423b03456SIngo Weinhold BString* name, const char* parameters); 8523b03456SIngo Weinhold status_t Initialize(const char* diskSystem, 8623b03456SIngo Weinhold const char* name, 8723b03456SIngo Weinhold const char* parameters); 8823b03456SIngo Weinhold status_t Uninitialize(); 8923b03456SIngo Weinhold 9023b03456SIngo Weinhold // Modification of child partitions 9123b03456SIngo Weinhold 9223b03456SIngo Weinhold status_t GetPartitioningInfo(BPartitioningInfo* info); 9323b03456SIngo Weinhold 9423b03456SIngo Weinhold status_t ValidateCreateChild(off_t* start, off_t* size, 9523b03456SIngo Weinhold const char* type, BString* name, 9623b03456SIngo Weinhold const char* parameters) const; 9723b03456SIngo Weinhold status_t CreateChild(off_t start, off_t size, 9823b03456SIngo Weinhold const char* type, const char* name, 9923b03456SIngo Weinhold const char* parameters, BPartition** child); 10023b03456SIngo Weinhold 10123b03456SIngo Weinhold status_t DeleteChild(Delegate* child); 10223b03456SIngo Weinhold 10323b03456SIngo Weinhold private: 10423b03456SIngo Weinhold void _FreeHandle(); 10523b03456SIngo Weinhold 10623b03456SIngo Weinhold private: 10723b03456SIngo Weinhold BPartition* fPartition; 10823b03456SIngo Weinhold BMutablePartition fMutablePartition; 10923b03456SIngo Weinhold BDiskSystemAddOn* fDiskSystem; 11023b03456SIngo Weinhold BPartitionHandle* fPartitionHandle; 11123b03456SIngo Weinhold }; 11223b03456SIngo Weinhold 11323b03456SIngo Weinhold 11423b03456SIngo Weinhold #endif // _PARTITION_DELEGATE_H 115*2f3ce2bfSBryce Groff 116