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