xref: /haiku/src/kits/storage/disk_device/DiskSystemAddOn.cpp (revision 25a7b01d15612846f332751841da3579db313082)
1 /*
2  * Copyright 2007, Ingo Weinhold, bonefish@users.sf.net.
3  * Distributed under the terms of the MIT License.
4  */
5 
6 #include <DiskSystemAddOn.h>
7 
8 #include <DiskDeviceDefs.h>
9 #include <Errors.h>
10 
11 
12 // #pragma mark - BDiskSystemAddOn
13 
14 
BDiskSystemAddOn(const char * name,uint32 flags)15 BDiskSystemAddOn::BDiskSystemAddOn(const char* name, uint32 flags)
16 	:
17 	fName(name),
18 	fFlags(flags)
19 {
20 }
21 
22 
~BDiskSystemAddOn()23 BDiskSystemAddOn::~BDiskSystemAddOn()
24 {
25 }
26 
27 
28 const char*
Name() const29 BDiskSystemAddOn::Name() const
30 {
31 	return fName.String();
32 }
33 
34 
35 uint32
Flags() const36 BDiskSystemAddOn::Flags() const
37 {
38 	return fFlags;
39 }
40 
41 
42 bool
CanInitialize(const BMutablePartition * partition)43 BDiskSystemAddOn::CanInitialize(const BMutablePartition* partition)
44 {
45 	return false;
46 }
47 
48 
49 status_t
GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,BPartitionParameterEditor ** editor)50 BDiskSystemAddOn::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
51 	BPartitionParameterEditor** editor)
52 {
53 	return B_NOT_SUPPORTED;
54 }
55 
56 
57 status_t
ValidateInitialize(const BMutablePartition * partition,BString * name,const char * parameters)58 BDiskSystemAddOn::ValidateInitialize(const BMutablePartition* partition,
59 	BString* name, const char* parameters)
60 {
61 	return B_BAD_VALUE;
62 }
63 
64 
65 status_t
Initialize(BMutablePartition * partition,const char * name,const char * parameters,BPartitionHandle ** handle)66 BDiskSystemAddOn::Initialize(BMutablePartition* partition, const char* name,
67 	const char* parameters, BPartitionHandle** handle)
68 {
69 	return B_NOT_SUPPORTED;
70 }
71 
72 
73 status_t
GetTypeForContentType(const char * contentType,BString * type)74 BDiskSystemAddOn::GetTypeForContentType(const char* contentType, BString* type)
75 {
76 	return B_NOT_SUPPORTED;
77 }
78 
79 
80 bool
IsSubSystemFor(const BMutablePartition * child)81 BDiskSystemAddOn::IsSubSystemFor(const BMutablePartition* child)
82 {
83 	return false;
84 }
85 
86 
87 // #pragma mark - BPartitionHandle
88 
89 
BPartitionHandle(BMutablePartition * partition)90 BPartitionHandle::BPartitionHandle(BMutablePartition* partition)
91 	:
92 	fPartition(partition)
93 {
94 }
95 
96 
~BPartitionHandle()97 BPartitionHandle::~BPartitionHandle()
98 {
99 }
100 
101 
102 BMutablePartition*
Partition() const103 BPartitionHandle::Partition() const
104 {
105 	return fPartition;
106 }
107 
108 
109 uint32
SupportedOperations(uint32 mask)110 BPartitionHandle::SupportedOperations(uint32 mask)
111 {
112 	return 0;
113 }
114 
115 
116 uint32
SupportedChildOperations(const BMutablePartition * child,uint32 mask)117 BPartitionHandle::SupportedChildOperations(const BMutablePartition* child,
118 	uint32 mask)
119 {
120 	return 0;
121 }
122 
123 
124 bool
SupportsInitializingChild(const BMutablePartition * child,const char * diskSystem)125 BPartitionHandle::SupportsInitializingChild(const BMutablePartition* child,
126 	const char* diskSystem)
127 {
128 	return false;
129 }
130 
131 
132 status_t
GetNextSupportedType(const BMutablePartition * child,int32 * cookie,BString * type)133 BPartitionHandle::GetNextSupportedType(const BMutablePartition* child,
134 	int32* cookie, BString* type)
135 {
136 	return B_ENTRY_NOT_FOUND;
137 }
138 
139 
140 status_t
GetPartitioningInfo(BPartitioningInfo * info)141 BPartitionHandle::GetPartitioningInfo(BPartitioningInfo* info)
142 {
143 	return B_NOT_SUPPORTED;
144 }
145 
146 
147 status_t
Defragment()148 BPartitionHandle::Defragment()
149 {
150 	return B_NOT_SUPPORTED;
151 }
152 
153 
154 status_t
Repair(bool checkOnly)155 BPartitionHandle::Repair(bool checkOnly)
156 {
157 	return B_NOT_SUPPORTED;
158 }
159 
160 
161 status_t
ValidateResize(off_t * size)162 BPartitionHandle::ValidateResize(off_t* size)
163 {
164 	return B_BAD_VALUE;
165 }
166 
167 
168 status_t
ValidateResizeChild(const BMutablePartition * child,off_t * size)169 BPartitionHandle::ValidateResizeChild(const BMutablePartition* child,
170 	off_t* size)
171 {
172 	return B_BAD_VALUE;
173 }
174 
175 
176 status_t
Resize(off_t size)177 BPartitionHandle::Resize(off_t size)
178 {
179 	return B_NOT_SUPPORTED;
180 }
181 
182 
183 status_t
ResizeChild(BMutablePartition * child,off_t size)184 BPartitionHandle::ResizeChild(BMutablePartition* child, off_t size)
185 {
186 	return B_NOT_SUPPORTED;
187 }
188 
189 
190 status_t
ValidateMove(off_t * offset)191 BPartitionHandle::ValidateMove(off_t* offset)
192 {
193 	// Usually moving a disk system is a no-op for the content disk system,
194 	// so we default to true here.
195 	return B_OK;
196 }
197 
198 
199 status_t
ValidateMoveChild(const BMutablePartition * child,off_t * offset)200 BPartitionHandle::ValidateMoveChild(const BMutablePartition* child,
201 	off_t* offset)
202 {
203 	return B_BAD_VALUE;
204 }
205 
206 
207 status_t
Move(off_t offset)208 BPartitionHandle::Move(off_t offset)
209 {
210 	// Usually moving a disk system is a no-op for the content disk system,
211 	// so we default to OK here.
212 	return B_OK;
213 }
214 
215 
216 status_t
MoveChild(BMutablePartition * child,off_t offset)217 BPartitionHandle::MoveChild(BMutablePartition* child, off_t offset)
218 {
219 	return B_NOT_SUPPORTED;
220 }
221 
222 
223 status_t
ValidateSetContentName(BString * name)224 BPartitionHandle::ValidateSetContentName(BString* name)
225 {
226 	return B_BAD_VALUE;
227 }
228 
229 
230 status_t
ValidateSetName(const BMutablePartition * child,BString * name)231 BPartitionHandle::ValidateSetName(const BMutablePartition* child,
232 	BString* name)
233 {
234 	return B_BAD_VALUE;
235 }
236 
237 
238 status_t
SetContentName(const char * name)239 BPartitionHandle::SetContentName(const char* name)
240 {
241 	return B_NOT_SUPPORTED;
242 }
243 
244 
245 status_t
SetName(BMutablePartition * child,const char * name)246 BPartitionHandle::SetName(BMutablePartition* child, const char* name)
247 {
248 	return B_NOT_SUPPORTED;
249 }
250 
251 
252 status_t
ValidateSetType(const BMutablePartition * child,const char * type)253 BPartitionHandle::ValidateSetType(const BMutablePartition* child,
254 	const char* type)
255 {
256 	return B_BAD_VALUE;
257 }
258 
259 
260 status_t
SetType(BMutablePartition * child,const char * type)261 BPartitionHandle::SetType(BMutablePartition* child, const char* type)
262 {
263 	return B_NOT_SUPPORTED;
264 }
265 
266 
267 status_t
GetContentParameterEditor(BPartitionParameterEditor ** editor)268 BPartitionHandle::GetContentParameterEditor(BPartitionParameterEditor** editor)
269 {
270 	return B_NOT_SUPPORTED;
271 }
272 
273 
274 status_t
GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,BPartitionParameterEditor ** editor)275 BPartitionHandle::GetParameterEditor(B_PARAMETER_EDITOR_TYPE type,
276 	BPartitionParameterEditor** editor)
277 {
278 	return B_NOT_SUPPORTED;
279 }
280 
281 
282 status_t
ValidateSetContentParameters(const char * parameters)283 BPartitionHandle::ValidateSetContentParameters(const char* parameters)
284 {
285 	return B_BAD_VALUE;
286 }
287 
288 
289 status_t
ValidateSetParameters(const BMutablePartition * child,const char * parameters)290 BPartitionHandle::ValidateSetParameters(const BMutablePartition* child,
291 	const char* parameters)
292 {
293 	return B_BAD_VALUE;
294 }
295 
296 
297 status_t
SetContentParameters(const char * parameters)298 BPartitionHandle::SetContentParameters(const char* parameters)
299 {
300 	return B_NOT_SUPPORTED;
301 }
302 
303 
304 status_t
SetParameters(BMutablePartition * child,const char * parameters)305 BPartitionHandle::SetParameters(BMutablePartition* child,
306 	const char* parameters)
307 {
308 	return B_NOT_SUPPORTED;
309 }
310 
311 
312 status_t
ValidateCreateChild(off_t * offset,off_t * size,const char * type,BString * name,const char * parameters)313 BPartitionHandle::ValidateCreateChild(off_t* offset, off_t* size,
314 	const char* type, BString* name, const char* parameters)
315 {
316 	return B_BAD_VALUE;
317 }
318 
319 
320 status_t
CreateChild(off_t offset,off_t size,const char * type,const char * name,const char * parameters,BMutablePartition ** child)321 BPartitionHandle::CreateChild(off_t offset, off_t size, const char* type,
322 	const char* name, const char* parameters, BMutablePartition** child)
323 {
324 	return B_NOT_SUPPORTED;
325 }
326 
327 
328 status_t
DeleteChild(BMutablePartition * child)329 BPartitionHandle::DeleteChild(BMutablePartition* child)
330 {
331 	return B_NOT_SUPPORTED;
332 }
333