xref: /haiku/src/add-ons/disk_systems/intel/PartitionMapAddOn.h (revision 922e7ba1f3228e6f28db69b0ded8f86eb32dea17)
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			GetInitializationParameterEditor(
25 									const BMutablePartition* partition,
26 									BPartitionParameterEditor** editor);
27 	virtual	status_t			ValidateInitialize(
28 									const BMutablePartition* partition,
29 									BString* name, const char* parameters);
30 	virtual	status_t			Initialize(BMutablePartition* partition,
31 									const char* name, const char* parameters,
32 									BPartitionHandle** handle);
33 };
34 
35 
36 class PartitionMapHandle : public BPartitionHandle {
37 public:
38 								PartitionMapHandle(
39 									BMutablePartition* partition);
40 	virtual						~PartitionMapHandle();
41 
42 			status_t			Init();
43 
44 	virtual	uint32				SupportedOperations(uint32 mask);
45 	virtual	uint32				SupportedChildOperations(
46 									const BMutablePartition* child,
47 									uint32 mask);
48 
49 	virtual	status_t			GetNextSupportedType(
50 									const BMutablePartition* child,
51 									int32* cookie, BString* type);
52 
53 	virtual	status_t			GetPartitioningInfo(BPartitioningInfo* info);
54 
55 	virtual	status_t			GetParameterEditor(
56 									B_PARAMETER_EDITOR_TYPE type,
57 									BPartitionParameterEditor** editor);
58 	virtual	status_t			ValidateCreateChild(off_t* offset,
59 									off_t* size, const char* type,
60 									BString* name, const char* parameters);
61 	virtual	status_t			CreateChild(off_t offset, off_t size,
62 									const char* type, const char* name,
63 									const char* parameters,
64 									BMutablePartition** child);
65 	virtual status_t			DeleteChild(BMutablePartition* child);
66 
67 private:
68 			PartitionMap		fPartitionMap;
69 };
70 
71 
72 #endif	// _PARTITION_MAP_ADD_ON_H
73