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