2 * Copyright 2007, Ingo Weinhold, bonefish@users.sf.net.
3 * Distributed under the terms of the MIT License.
5 #ifndef _DISK_SYSTEM_ADD_ON_H
6 #define _DISK_SYSTEM_ADD_ON_H
8 #include <DiskDeviceDefs.h>
10 #include <SupportDefs.h>
13 class BPartitionParameterEditor
;
15 class BMutablePartition
;
16 class BPartitionHandle
;
17 class BPartitioningInfo
;
20 class BDiskSystemAddOn
{
22 BDiskSystemAddOn(const char* name
,
24 virtual ~BDiskSystemAddOn();
26 const char* Name() const;
29 virtual status_t
CreatePartitionHandle(
30 BMutablePartition
* partition
,
31 BPartitionHandle
** handle
) = 0;
33 virtual bool CanInitialize(
34 const BMutablePartition
* partition
);
35 virtual status_t
ValidateInitialize(
36 const BMutablePartition
* partition
,
37 BString
* name
, const char* parameters
);
38 virtual status_t
Initialize(BMutablePartition
* partition
,
39 const char* name
, const char* parameters
,
40 BPartitionHandle
** handle
);
42 virtual status_t
GetParameterEditor(
43 B_PARAMETER_EDITOR_TYPE type
,
44 BPartitionParameterEditor
** editor
);
45 virtual status_t
GetTypeForContentType(const char* contentType
,
47 virtual bool IsSubSystemFor(const BMutablePartition
* child
);
55 class BPartitionHandle
{
57 BPartitionHandle(BMutablePartition
* partition
);
58 virtual ~BPartitionHandle();
60 BMutablePartition
* Partition() const;
62 virtual uint32
SupportedOperations(uint32 mask
);
63 virtual uint32
SupportedChildOperations(
64 const BMutablePartition
* child
,
67 virtual bool SupportsInitializingChild(
68 const BMutablePartition
* child
,
69 const char* diskSystem
);
71 virtual status_t
GetNextSupportedType(
72 const BMutablePartition
* child
,
73 int32
* cookie
, BString
* type
);
76 virtual status_t
GetPartitioningInfo(BPartitioningInfo
* info
);
79 virtual status_t
Defragment();
80 virtual status_t
Repair(bool checkOnly
);
82 virtual status_t
ValidateResize(off_t
* size
);
83 virtual status_t
ValidateResizeChild(
84 const BMutablePartition
* child
,
86 virtual status_t
Resize(off_t size
);
87 virtual status_t
ResizeChild(BMutablePartition
* child
,
90 virtual status_t
ValidateMove(off_t
* offset
);
91 virtual status_t
ValidateMoveChild(
92 const BMutablePartition
* child
,
94 virtual status_t
Move(off_t offset
);
95 virtual status_t
MoveChild(BMutablePartition
* child
,
98 virtual status_t
ValidateSetContentName(BString
* name
);
99 virtual status_t
ValidateSetName(const BMutablePartition
* child
,
101 virtual status_t
SetContentName(const char* name
);
102 virtual status_t
SetName(BMutablePartition
* child
,
105 virtual status_t
ValidateSetType(const BMutablePartition
* child
,
107 virtual status_t
SetType(BMutablePartition
* child
,
110 virtual status_t
GetContentParameterEditor(
111 BPartitionParameterEditor
** editor
);
113 virtual status_t
ValidateSetContentParameters(
114 const char* parameters
);
115 virtual status_t
ValidateSetParameters(
116 const BMutablePartition
* child
,
117 const char* parameters
);
118 virtual status_t
SetContentParameters(const char* parameters
);
119 virtual status_t
SetParameters(BMutablePartition
* child
,
120 const char* parameters
);
122 virtual status_t
GetParameterEditor(
123 B_PARAMETER_EDITOR_TYPE type
,
124 BPartitionParameterEditor
** editor
);
125 virtual status_t
ValidateCreateChild(off_t
* offset
,
126 off_t
* size
, const char* type
,
127 BString
* name
, const char* parameters
);
128 virtual status_t
CreateChild(off_t offset
, off_t size
,
129 const char* type
, const char* name
,
130 const char* parameters
,
131 BMutablePartition
** child
);
133 virtual status_t
DeleteChild(BMutablePartition
* child
);
136 BMutablePartition
* fPartition
;
140 extern "C" status_t
get_disk_system_add_ons(BList
* addOns
);
141 // Implemented in the add-on
143 #endif // _DISK_SYSTEM_ADD_ON_H