1 /* 2 * Copyright 2007, Ingo Weinhold, bonefish@users.sf.net. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _PARTITION_MAP_ADD_ON_H 6 #define _PARTITION_MAP_ADD_ON_H 7 8 #include <DiskSystemAddOn.h> 9 10 #include "PartitionMap.h" 11 12 13 class PartitionMapAddOn : public BDiskSystemAddOn { 14 public: 15 PartitionMapAddOn(); 16 virtual ~PartitionMapAddOn(); 17 18 virtual status_t CreatePartitionHandle( 19 BMutablePartition* partition, 20 BPartitionHandle** handle); 21 22 virtual bool CanInitialize( 23 const BMutablePartition* partition); 24 virtual status_t ValidateInitialize( 25 const BMutablePartition* partition, 26 BString* name, const char* parameters); 27 virtual status_t Initialize(BMutablePartition* partition, 28 const char* name, const char* parameters, 29 BPartitionHandle** handle); 30 }; 31 32 33 class PartitionMapHandle : public BPartitionHandle { 34 public: 35 PartitionMapHandle( 36 BMutablePartition* partition); 37 virtual ~PartitionMapHandle(); 38 39 status_t Init(); 40 41 virtual uint32 SupportedOperations(uint32 mask); 42 virtual uint32 SupportedChildOperations( 43 const BMutablePartition* child, 44 uint32 mask); 45 46 virtual status_t GetNextSupportedType( 47 const BMutablePartition* child, 48 int32* cookie, BString* type); 49 50 virtual status_t GetPartitioningInfo(BPartitioningInfo* info); 51 52 virtual status_t GetParameterEditor( 53 B_PARAMETER_EDITOR_TYPE type, 54 BPartitionParameterEditor** editor); 55 virtual status_t ValidateCreateChild(off_t* offset, 56 off_t* size, const char* type, 57 BString* name, const char* parameters); 58 virtual status_t CreateChild(off_t offset, off_t size, 59 const char* type, const char* name, 60 const char* parameters, 61 BMutablePartition** child); 62 virtual status_t DeleteChild(BMutablePartition* child); 63 64 private: 65 PartitionMap fPartitionMap; 66 }; 67 68 69 #endif // _PARTITION_MAP_ADD_ON_H 70