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 ValidateSetParameters( 53 const BMutablePartition* child, 54 const char* parameters); 55 virtual status_t SetParameters( 56 BMutablePartition* child, 57 const char* parameters); 58 59 virtual status_t GetParameterEditor( 60 B_PARAMETER_EDITOR_TYPE type, 61 BPartitionParameterEditor** editor); 62 virtual status_t ValidateCreateChild(off_t* offset, 63 off_t* size, const char* type, 64 BString* name, const char* parameters); 65 virtual status_t CreateChild(off_t offset, off_t size, 66 const char* type, const char* name, 67 const char* parameters, 68 BMutablePartition** child); 69 virtual status_t DeleteChild(BMutablePartition* child); 70 71 private: 72 PartitionMap fPartitionMap; 73 }; 74 75 76 #endif // _PARTITION_MAP_ADD_ON_H 77