// TODO add error messages! bool MParted::MParted_Core::applyOperationToDisk(MParted::Operation * operation) { QMutexLocker locker(&mutex); bool success = false; if (!calibratePartition(operation->partition_original)) return false; switch (operation->type) { case MParted::OPERATION_REMOVE: success = (removeFilesystem(operation->partition_original) && removePartition(operation->partition_original)); break; case MParted::OPERATION_CREATE: success = create(operation->device, operation->partition_new); break; case MParted::OPERATION_FORMAT: success = (removeFilesystem(operation->partition_original) && setPartitionType(operation->partition_new) && createFilesystem(operation->partition_new)); break; case MParted::OPERATION_RESIZE: success = resize(operation->device, operation->partition_original, operation->partition_new); break; default: return false; } return success; }
bool MParted::MParted_Core::create(const MParted::Device & device, MParted::Partition & new_partition) { // Perfom alignment if (!snapToAlignment(device, new_partition)) return false; if (new_partition.type == MParted::TYPE_EXTENDED) { return createPartition(new_partition); } else { MParted::Byte_Value fsMIN = 0; for (int t = 0 ; t < filesystems.size(); t++) { if (filesystems[t]->getFilesystemType() == new_partition.filesystem) { fsMIN = filesystems[t]->getFilesystemMIN(); break; } } if (!createPartition(new_partition, (fsMIN / new_partition.sector_size))) return false; if (new_partition.filesystem == MParted::FS_UNFORMATTED) return true; else return (setPartitionType(new_partition) && createFilesystem(new_partition)); } return false; }
AndroidApplication::AndroidApplication(Context* context) { _context = context; _applicationEnabled = false; callJNI(); createFilesystem(); _dirMap[B_PROFILES_DIR].setPath(_storageDirectory); _dirMap["scripts"].setPath(_storageDirectory); _profileManager = BProfileManager::createProfileManager(_dirMap[B_PROFILES_DIR].path()); context->onAppCmd = application_callback; context->onInputEvent = input_eventcallback; context->userData = this; _readyToLaunch = 0; _soundEngine = BSoundEngine::instance(); _eventManager = new AndroidEventManager(this); _gameEngine = BGameEngine::createInstance(this); _graphicEngine = new AndroidGraphicEngine(this); _networkWrapper = BNetworkWrapper::instance(); _gameEngine->setEventManager(_eventManager); _gameEngine->setProfileManager(_profileManager); _gameEngine->setNetworkWrapper(_networkWrapper); delete _instance; _instance = this; }
int main(int argc, char* argv[]) { time(&mount_time); if(argc < 3) { printf("How to use : ./mount-poi <mount_folder> <filesystem.poi> [-new]\n"); return 0; } if(argc > 3) { if(strcmp("-new", argv[3]) == 0) { createFilesystem(argv[2]); } } int fargc = 2; char* fargv[2] = { argv[0], argv[1] }; loadFilesystem(argv[2]); return fuse_main(fargc, fargv, &rp_oper, NULL); }