sl@0: /* sl@0: * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: * All rights reserved. sl@0: * This component and the accompanying materials are made available sl@0: * under the terms of "Eclipse Public License v1.0" sl@0: * which accompanies this distribution, and is available sl@0: * at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: * sl@0: * Initial Contributors: sl@0: * Nokia Corporation - initial contribution. sl@0: * sl@0: * Contributors: sl@0: * sl@0: * Description: sl@0: * sl@0: */ sl@0: sl@0: sl@0: /** sl@0: @test sl@0: @internalComponent sl@0: sl@0: This contains CT_FsData sl@0: */ sl@0: sl@0: // User includes sl@0: #include "T_FsData.h" sl@0: sl@0: // EPOC includes sl@0: #include sl@0: sl@0: /*@{*/ sl@0: /// Enumerations sl@0: _LIT(KDriveA, "EDriveA"); sl@0: _LIT(KDriveB, "EDriveB"); sl@0: _LIT(KDriveC, "EDriveC"); sl@0: _LIT(KDriveD, "EDriveD"); sl@0: _LIT(KDriveE, "EDriveE"); sl@0: _LIT(KDriveF, "EDriveF"); sl@0: _LIT(KDriveG, "EDriveG"); sl@0: _LIT(KDriveH, "EDriveH"); sl@0: _LIT(KDriveI, "EDriveI"); sl@0: _LIT(KDriveJ, "EDriveJ"); sl@0: _LIT(KDriveK, "EDriveK"); sl@0: _LIT(KDriveL, "EDriveL"); sl@0: _LIT(KDriveM, "EDriveM"); sl@0: _LIT(KDriveN, "EDriveN"); sl@0: _LIT(KDriveO, "EDriveO"); sl@0: _LIT(KDriveP, "EDriveP"); sl@0: _LIT(KDriveQ, "EDriveQ"); sl@0: _LIT(KDriveR, "EDriveR"); sl@0: _LIT(KDriveS, "EDriveS"); sl@0: _LIT(KDriveT, "EDriveT"); sl@0: _LIT(KDriveU, "EDriveU"); sl@0: _LIT(KDriveV, "EDriveV"); sl@0: _LIT(KDriveW, "EDriveW"); sl@0: _LIT(KDriveX, "EDriveX"); sl@0: _LIT(KDriveY, "EDriveY"); sl@0: _LIT(KDriveZ, "EDriveZ"); sl@0: sl@0: _LIT(KWriteMappingsAndSet, "EWriteMappingsAndSet"); sl@0: _LIT(KWriteMappingsNoSet, "EWriteMappingsNoSet"); sl@0: _LIT(KSwapIntMappingAndSet, "ESwapIntMappingAndSet"); sl@0: sl@0: sl@0: /// Parameters sl@0: _LIT(KDrive, "drive"); sl@0: _LIT(KDriveMappingElement, "drive_mapping_element_"); sl@0: _LIT(KDriveMappingSize, "drive_mapping_size"); sl@0: _LIT(KDriveMappingOperation, "drive_mapping_operation"); sl@0: _LIT(KFileName, "file_name"); sl@0: _LIT(KFileSystemName, "file_system_name"); sl@0: _LIT(KNewFileSystemName, "new_file_system_name"); sl@0: _LIT(KFlags, "flags"); sl@0: _LIT(KIsSync, "is_sync"); sl@0: _LIT(KExtensionName, "extension_name"); sl@0: _LIT(KPosition, "position"); sl@0: _LIT(KMode, "mode"); sl@0: _LIT(KAll, "all"); sl@0: _LIT(KCommandNum, "command_num"); sl@0: _LIT(KSaveInInstance, "save_in_instance"); sl@0: _LIT(KLocalDrive, "local_drive"); sl@0: _LIT(KCompositeDrive, "composite_drive"); sl@0: _LIT(KIsMountSuccess, "is_mount_success"); sl@0: _LIT(KParam1, "param1"); sl@0: _LIT(KParam2, "param2"); sl@0: _LIT(KIndex, "index"); sl@0: _LIT(KSubTypeName, "sub_type_name"); sl@0: sl@0: sl@0: /// Commands sl@0: _LIT(KCmdAddFileSystem, "AddFileSystem"); sl@0: _LIT(KCmdDismountFileSystem, "DismountFileSystem"); sl@0: _LIT(KCmdFileSystemName, "FileSystemName"); sl@0: _LIT(KCmdMountFileSystem, "MountFileSystem"); sl@0: _LIT(KCmdMountFileSystemAndScan, "MountFileSystemAndScan"); sl@0: _LIT(KCmdRemountDrive, "RemountDrive"); sl@0: _LIT(KCmdRemoveFileSystem, "RemoveFileSystem"); sl@0: _LIT(KCmdAddExtension, "AddExtension"); sl@0: _LIT(KCmdMountExtension, "MountExtension"); sl@0: _LIT(KCmdRemoveExtension, "RemoveExtension"); sl@0: _LIT(KCmdExtensionName, "ExtensionName"); sl@0: _LIT(KCmdAddCompositeMount, "AddCompositeMount"); sl@0: _LIT(KCmdAllowDismount, "AllowDismount"); sl@0: _LIT(KCmdNotifyDismount, "NotifyDismount"); sl@0: _LIT(KCmdNotifyDismountCancel, "NotifyDismountCancel"); sl@0: _LIT(KCmdStartupInitComplete, "StartupInitComplete"); sl@0: _LIT(KCmdSwapFileSystem, "SwapFileSystem"); sl@0: _LIT(KCmdSetStartupConfiguration, "SetStartupConfiguration"); sl@0: _LIT(KCmdDismountExtension, "DismountExtension"); sl@0: _LIT(KCmdSetLocalDriveMapping, "SetLocalDriveMapping"); sl@0: _LIT(KCmdFinaliseDrives, "FinaliseDrives"); sl@0: _LIT(KCmdFileSystemSubType, "FileSystemSubType"); sl@0: /*@}*/ sl@0: sl@0: sl@0: TBool CT_FsData::DoCommandMountsL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex) sl@0: /** sl@0: * Process a mounts related command read from the ini file sl@0: * sl@0: * @param aCommand the command to process sl@0: * @param aSection the entry in the ini file requiring the command to be processed sl@0: * sl@0: * @return ETrue if the command is processed sl@0: */ sl@0: { sl@0: TBool retVal = ETrue; sl@0: sl@0: if (aCommand == KCmdAddFileSystem) sl@0: { sl@0: DoCmdAddFileSystem(aSection); sl@0: } sl@0: else if (aCommand == KCmdDismountFileSystem) sl@0: { sl@0: DoCmdDismountFileSystem(aSection); sl@0: } sl@0: else if (aCommand == KCmdFileSystemName) sl@0: { sl@0: DoCmdFileSystemName(aSection); sl@0: } sl@0: else if (aCommand == KCmdMountFileSystem) sl@0: { sl@0: DoCmdMountFileSystem(aSection); sl@0: } sl@0: else if (aCommand == KCmdMountFileSystemAndScan) sl@0: { sl@0: DoCmdMountFileSystemAndScan(aSection); sl@0: } sl@0: else if (aCommand == KCmdRemoveFileSystem) sl@0: { sl@0: DoCmdRemoveFileSystem(aSection); sl@0: } sl@0: else if (aCommand == KCmdRemountDrive) sl@0: { sl@0: DoCmdRemountDriveL(aSection); sl@0: } sl@0: else if (aCommand == KCmdAddExtension) sl@0: { sl@0: DoCmdAddExtension(aSection); sl@0: } sl@0: else if (aCommand == KCmdRemoveExtension) sl@0: { sl@0: DoCmdRemoveExtension(aSection); sl@0: } sl@0: else if (aCommand == KCmdExtensionName) sl@0: { sl@0: DoCmdExtensionName(aSection); sl@0: } sl@0: else if (aCommand == KCmdMountExtension) sl@0: { sl@0: DoCmdMountExtension(aSection); sl@0: } sl@0: else if (aCommand == KCmdAllowDismount) sl@0: { sl@0: DoCmdAllowDismount(aSection); sl@0: } sl@0: else if (aCommand == KCmdNotifyDismount) sl@0: { sl@0: DoCmdNotifyDismountL(aSection, aAsyncErrorIndex); sl@0: } sl@0: else if (aCommand == KCmdNotifyDismountCancel) sl@0: { sl@0: DoCmdNotifyDismountCancel(aSection); sl@0: } sl@0: else if (aCommand == KCmdStartupInitComplete) sl@0: { sl@0: DoCmdStartupInitCompleteL(aAsyncErrorIndex); sl@0: } sl@0: else if (aCommand == KCmdSwapFileSystem) sl@0: { sl@0: DoCmdSwapFileSystem(aSection); sl@0: } sl@0: else if (aCommand == KCmdSetStartupConfiguration) sl@0: { sl@0: DoCmdSetStartupConfigurationL(aSection); sl@0: } sl@0: else if (aCommand == KCmdFinaliseDrives) sl@0: { sl@0: DoCmdFinaliseDrives(); sl@0: } sl@0: else if (aCommand == KCmdAddCompositeMount) sl@0: { sl@0: DoCmdAddCompositeMount(aSection); sl@0: } sl@0: else if (aCommand == KCmdDismountExtension) sl@0: { sl@0: DoCmdDismountExtension(aSection); sl@0: } sl@0: else if (aCommand == KCmdSetLocalDriveMapping) sl@0: { sl@0: DoCmdSetLocalDriveMappingL(aSection); sl@0: } sl@0: else if (aCommand == KCmdFileSystemSubType) sl@0: { sl@0: DoCmdFileSystemSubType(aSection); sl@0: } sl@0: else sl@0: { sl@0: retVal = EFalse; sl@0: } sl@0: sl@0: return retVal; sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdAddFileSystem(const TDesC& aSection) sl@0: /** Calls RFs::AddFileSystem() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::AddFileSystem()")); sl@0: sl@0: // get file name from parameters sl@0: TPtrC fileName; sl@0: if ( GET_MANDATORY_STRING_PARAMETER(KFileName(), aSection, fileName)) sl@0: { sl@0: // call AddFileSystem() sl@0: TInt err = iFs->AddFileSystem(fileName); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("AddFileSystem error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CT_FsData::DoCmdMountFileSystem(const TDesC& aSection) sl@0: /** Calls RFs::MountFileSystem() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::MountFileSystem()")); sl@0: sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: // get file system name from parameters sl@0: TPtrC fileSystemName; sl@0: if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) ) sl@0: { sl@0: fileSystemName.Set(iFileSystemName); sl@0: } sl@0: sl@0: if(dataOk) sl@0: { sl@0: // get file system name from parameters sl@0: TBool isSync = EFalse; sl@0: TInt err = KErrNone; sl@0: sl@0: TPtrC extensionName; sl@0: TBool hasExtensionName=GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extensionName); sl@0: if (GET_OPTIONAL_BOOL_PARAMETER(KIsSync(), aSection, isSync)) sl@0: { sl@0: if ( hasExtensionName ) sl@0: { sl@0: // call MountFileSystem() sl@0: INFO_PRINTF5(_L("MountFileSystem(%S, %S, %d, %d)"), &fileSystemName, &extensionName, driveNumber, isSync); sl@0: err = iFs->MountFileSystem(fileSystemName, extensionName, driveNumber, isSync); sl@0: } sl@0: else sl@0: { sl@0: // call MountFileSystem() sl@0: INFO_PRINTF4(_L("MountFileSystem(%S, %d, %d)"), &fileSystemName, driveNumber, isSync); sl@0: err = iFs->MountFileSystem(fileSystemName, driveNumber, isSync); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: if ( hasExtensionName ) sl@0: { sl@0: // call MountFileSystem() sl@0: INFO_PRINTF4(_L("MountFileSystem(%S, %S, %d)"), &fileSystemName, &extensionName, driveNumber); sl@0: err = iFs->MountFileSystem(fileSystemName, extensionName, driveNumber); sl@0: } sl@0: else sl@0: { sl@0: // call MountFileSystem() sl@0: INFO_PRINTF3(_L("MountFileSystem(%S, %d)"), &fileSystemName, driveNumber); sl@0: err = iFs->MountFileSystem(fileSystemName, driveNumber); sl@0: } sl@0: } sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("MountFileSystem error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdMountFileSystemAndScan(const TDesC& aSection) sl@0: /** Calls RFs::MountFileSystemAndScan() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::MountFileSystemAndScan()")); sl@0: sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: // get file system name from parameters sl@0: TPtrC fileSystemName; sl@0: if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) ) sl@0: { sl@0: fileSystemName.Set(iFileSystemName); sl@0: } sl@0: sl@0: if(dataOk) sl@0: { sl@0: TInt err=KErrNone; sl@0: TBool isMountSuccess = EFalse; sl@0: // get extension name from parameters sl@0: TPtrC extensionName; sl@0: if (GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extensionName)) sl@0: { sl@0: //call MountFileSystemAndScan sl@0: INFO_PRINTF4(_L("MountFileSystemAndScan(%S, %S, %d, isMountSuccess)"), &fileSystemName, &extensionName, driveNumber); sl@0: err = iFs->MountFileSystemAndScan(fileSystemName, extensionName, driveNumber, isMountSuccess); sl@0: } sl@0: else sl@0: { sl@0: //call MountFileSystemAndScan sl@0: INFO_PRINTF3(_L("MountFileSystemAndScan(%S, %d, isMountSuccess)"), &fileSystemName, driveNumber); sl@0: err = iFs->MountFileSystemAndScan(fileSystemName, driveNumber, isMountSuccess); sl@0: } sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("MountFileSystemAndScan error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: sl@0: //Only for info sl@0: if(isMountSuccess) sl@0: { sl@0: INFO_PRINTF1(_L("MountFileSystemAndScan() successfully mounted")); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF1(_L("MountFileSystemAndScan() not mounted")); sl@0: } sl@0: sl@0: //check if mount was successful sl@0: TBool expected = EFalse; sl@0: if ( GET_OPTIONAL_BOOL_PARAMETER(KIsMountSuccess(), aSection, expected) ) sl@0: { sl@0: if ( isMountSuccess!=expected ) sl@0: { sl@0: ERR_PRINTF1(_L("MountFileSystemAndScan() does not match expected value")); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdDismountFileSystem(const TDesC& aSection) sl@0: /** Calls RFs::DismountFileSystem() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::DismountFileSystem()")); sl@0: sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: // get file system name from parameters sl@0: TPtrC fileSystemName; sl@0: if (!GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName)) sl@0: { sl@0: fileSystemName.Set(iFileSystemName); sl@0: } sl@0: sl@0: if(dataOk) sl@0: { sl@0: // call DismountFileSystem() sl@0: TInt err = iFs->DismountFileSystem(fileSystemName, driveNumber); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DismountFileSystem error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdRemoveFileSystem(const TDesC& aSection) sl@0: /** Calls RFs::RemoveFileSystem() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::RemoveFileSystem()")); sl@0: sl@0: // get file name from parameters sl@0: TPtrC fileSystemName; sl@0: if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) ) sl@0: { sl@0: fileSystemName.Set(iFileSystemName); sl@0: } sl@0: sl@0: // call RemoveFileSystem() sl@0: TInt err = iFs->RemoveFileSystem(fileSystemName); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("RemoveFileSystem error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdFileSystemName(const TDesC& aSection) sl@0: /** Calls RFs::FileSystemName() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::FileSystemName()")); sl@0: sl@0: // get a flag if we need to remember the file system name in an instance variable sl@0: TBool save=ETrue; sl@0: GET_OPTIONAL_BOOL_PARAMETER(KSaveInInstance(), aSection, save); sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: // call FileSystemName() sl@0: TFullName fileSystemName; sl@0: TInt err = iFs->FileSystemName(fileSystemName, driveNumber); sl@0: INFO_PRINTF2(_L("File system name: %S"), &fileSystemName); sl@0: sl@0: // check error code sl@0: if (err == KErrNone) sl@0: { sl@0: if ( save ) sl@0: { sl@0: iFileSystemName=fileSystemName; sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("FileSystemName error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: sl@0: //Check expected result sl@0: TPtrC fsNameExpect; sl@0: if (GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fsNameExpect)) sl@0: { sl@0: if ( fsNameExpect != fileSystemName) sl@0: { sl@0: ERR_PRINTF1(_L("File system name != expected name")); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdAddExtension(const TDesC& aSection) sl@0: /** Calls RFs::AddExtension() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::AddExtension()")); sl@0: TPtrC fileName; sl@0: if ( GET_MANDATORY_STRING_PARAMETER(KFileName(), aSection, fileName) ) sl@0: { sl@0: //call AddExtension sl@0: TInt err = iFs->AddExtension(fileName); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("AddExtension error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdMountExtension(const TDesC& aSection) sl@0: /** Calls RFs::MountExtension() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::MountExtension()")); sl@0: sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: // get extension name from parameters sl@0: TPtrC extensionName; sl@0: if (!GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName)) sl@0: { sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: if(dataOk) sl@0: { sl@0: TInt err = iFs->MountExtension(extensionName, driveNumber); sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("MountExtension error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CT_FsData::DoCmdDismountExtension(const TDesC& aSection) sl@0: /** Calls RFs::DismountExtension() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::DismountExtension()")); sl@0: sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: TPtrC extensionName; sl@0: if (!GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName)) sl@0: { sl@0: dataOk = EFalse; sl@0: } sl@0: if(dataOk) sl@0: { sl@0: //call DismountExtension sl@0: TInt err = iFs->DismountExtension(extensionName, driveNumber); sl@0: sl@0: //check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("DismountExtension error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdRemoveExtension(const TDesC& aSection) sl@0: /** Calls RFs::RemoveExtension() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::RemoveExtension()")); sl@0: sl@0: TPtrC extensionName; sl@0: if (GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName)) sl@0: { sl@0: //call RemoveExtension sl@0: TInt err = iFs->RemoveExtension(extensionName); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("RemoveExtension error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdExtensionName(const TDesC& aSection) sl@0: /** Calls RFs::ExtensionName() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::ExtensionName()")); sl@0: sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: //get position of the extension in the extension hierarchy. sl@0: TInt pos = 0; sl@0: if (!GET_MANDATORY_INT_PARAMETER(KPosition(), aSection, pos)) sl@0: { sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: if(dataOk) sl@0: { sl@0: sl@0: TInt err = iFs->ExtensionName(iExtensionName, driveNumber, pos); sl@0: sl@0: if(err == KErrNone) sl@0: { sl@0: TPtrC extNameExpect; sl@0: if (GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extNameExpect)) sl@0: { sl@0: if(extNameExpect != iExtensionName) sl@0: { sl@0: ERR_PRINTF3(_L("ExtensionName: %S != %S expected name"), &iExtensionName, &extNameExpect); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("ExtensionName: %S"), &iExtensionName); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("ExtensionName: %S"), &iExtensionName); sl@0: } sl@0: } sl@0: // check error code sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("ExtensionName error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdRemountDriveL(const TDesC& aSection) sl@0: /** Calls RFs::RemountDrive() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::RemountDrive()")); sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: // get flags from parameters can be in hex(0x00000001) or in decimal(1) sl@0: TUint flags = 0; sl@0: TInt tempVal = 0; sl@0: sl@0: if(GetHexFromConfig(aSection, KFlags, tempVal)) sl@0: { sl@0: flags = tempVal; sl@0: } sl@0: else if(GET_OPTIONAL_INT_PARAMETER(KFlags(), aSection, tempVal)) sl@0: { sl@0: flags = tempVal; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("No parameter %S"), &KFlags()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: RFile file; sl@0: HBufC8* fileDataBuff = NULL; sl@0: sl@0: // get file name from parameters sl@0: TPtrC fileName; sl@0: TBool useMountInfo = GET_OPTIONAL_STRING_PARAMETER(KFileName(), aSection, fileName); sl@0: if ( useMountInfo ) sl@0: { sl@0: // open file sl@0: TInt error = file.Open(FileServer(), fileName, EFileRead | EFileShareAny); sl@0: if(error == KErrNone) sl@0: { sl@0: CleanupClosePushL(file); sl@0: INFO_PRINTF1(_L("File Opened.")); sl@0: // get size sl@0: TInt size = 0; sl@0: error = file.Size(size); sl@0: INFO_PRINTF2(_L("File Size=%d."), size); sl@0: if(error == KErrNone) sl@0: { sl@0: // read file sl@0: fileDataBuff = HBufC8::NewL(size); sl@0: INFO_PRINTF1(_L("Buffer created.")); sl@0: sl@0: CleanupStack::PushL(fileDataBuff); sl@0: TPtr8 fileData = fileDataBuff->Des(); sl@0: error = file.Read(fileData); sl@0: if(error != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("Reading File, Error: %d"), error); sl@0: dataOk = EFalse; sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("File Size, Error: %d."), error); sl@0: dataOk = EFalse; sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("File Open, Error: %d"), error); sl@0: dataOk = EFalse; sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: sl@0: if ( dataOk ) sl@0: { sl@0: // call RemountDrive() sl@0: TInt err = iFs->RemountDrive(driveNumber, fileDataBuff, flags); sl@0: INFO_PRINTF2(_L("RemountDrive Flags: %u"), flags); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("RemountDrive error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: sl@0: // cleanup if mountInfo was used sl@0: if (useMountInfo) sl@0: { sl@0: CleanupStack::PopAndDestroy(2, &file); // file, fileDataBuff sl@0: } sl@0: sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdNotifyDismountL(const TDesC& aSection, const TInt aAsyncErrorIndex) sl@0: /** Calls RFs::NotifyDismount() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::NotifyDismount()")); sl@0: sl@0: TNotifyDismountMode mode = EFsDismountRegisterClient; sl@0: TPtrC modeStr; sl@0: //get NotifyDismountMode from parameters sl@0: if(GET_MANDATORY_STRING_PARAMETER(KMode(), aSection, modeStr)) sl@0: { sl@0: if(modeStr == _L("EFsDismountRegisterClient")) sl@0: { sl@0: mode = EFsDismountRegisterClient; sl@0: } sl@0: else if(modeStr == _L("EFsDismountNotifyClients")) sl@0: { sl@0: mode = EFsDismountNotifyClients; sl@0: } sl@0: else if(modeStr == _L("EFsDismountForceDismount")) sl@0: { sl@0: mode = EFsDismountForceDismount; sl@0: } sl@0: else sl@0: { sl@0: TInt modeNumber; sl@0: if(GET_OPTIONAL_INT_PARAMETER(KMode, aSection, modeNumber)) sl@0: { sl@0: mode = (TNotifyDismountMode)modeNumber; sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF3(_L("NotifyDismount() incorrect parameter %S in %S"), &modeStr, &KMode()); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: // call NotifyDismount() sl@0: CActiveCallback* active = CActiveCallback::NewLC(*this); sl@0: iNotifyDismount.AppendL(active); sl@0: CleanupStack::Pop(active); sl@0: sl@0: iFs->NotifyDismount(driveNumber, active->iStatus, mode); sl@0: active->Activate(aAsyncErrorIndex); sl@0: IncOutstanding(); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdNotifyDismountCancel(const TDesC& aSection) sl@0: /** Calls RFs::NotifyDismountCancel() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::NotifyDismountCancel()")); sl@0: sl@0: TBool all = ETrue; sl@0: sl@0: if(GET_MANDATORY_BOOL_PARAMETER(KAll(), aSection, all)) sl@0: { sl@0: if(all) sl@0: { sl@0: //Cancels all outstanding requests. sl@0: iFs->NotifyDismountCancel(); sl@0: INFO_PRINTF1(_L("NotifyDismountCancel()")); sl@0: } sl@0: else sl@0: { sl@0: // Cancels a specific outstanding request sl@0: TInt index=0; sl@0: GET_OPTIONAL_INT_PARAMETER(KIndex, aSection, index); sl@0: sl@0: //Cancels a specific outstanding request sl@0: iFs->NotifyDismountCancel(iNotifyDismount[index]->iStatus); sl@0: INFO_PRINTF1(_L("NotifyDismountCancel(TRequestStatus)")); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdAllowDismount(const TDesC& aSection) sl@0: /** Calls RFs::AllowDismount() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::AllowDismount()")); sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if(!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: } sl@0: else sl@0: { sl@0: //call AllowDismount sl@0: TInt err = iFs->AllowDismount(driveNumber); sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("AllowDismount error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdSetStartupConfigurationL(const TDesC& aSection) sl@0: /** Calls RFs::SetStartupConfiguration() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::SetStartupConfiguration()")); sl@0: sl@0: //get Command from parameters sl@0: TPtrC commandNum; sl@0: TStartupConfigurationCmd configCommand = ELoaderPriority; sl@0: if(GET_MANDATORY_STRING_PARAMETER(KCommandNum(), aSection, commandNum)) sl@0: { sl@0: //Converting from string to TStartupConfigurationCmd sl@0: if(commandNum == _L("ELoaderPriority")) sl@0: { sl@0: configCommand = ELoaderPriority; sl@0: } sl@0: else if(commandNum == _L("ESetRugged")) sl@0: { sl@0: configCommand = ESetRugged; sl@0: } sl@0: else if(commandNum == _L("EMaxStartupConfigurationCmd")) sl@0: { sl@0: configCommand = EMaxStartupConfigurationCmd; sl@0: } sl@0: TAny* param1 = NULL; sl@0: TPtrC name; sl@0: if(GET_OPTIONAL_STRING_PARAMETER(KParam1(), aSection, name)) sl@0: { sl@0: param1 = GetDataObjectL(name); sl@0: } sl@0: TAny* param2 = NULL; sl@0: sl@0: if(GET_OPTIONAL_STRING_PARAMETER(KParam2(), aSection, name)) sl@0: { sl@0: param2 = GetDataObjectL(name); sl@0: } sl@0: //call SetStartupConfiguration sl@0: TInt err = iFs->SetStartupConfiguration(configCommand, param1, param2); sl@0: INFO_PRINTF2(_L("RFs::SetStartupConfiguration() %S"), &commandNum); sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("SetStartupConfiguration() error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: sl@0: void CT_FsData::DoCmdAddCompositeMount(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::AddCompositeMount()")); sl@0: sl@0: TBool dataOk = ETrue; sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber localDriveToMount = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KLocalDrive(), localDriveToMount)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KLocalDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: // get composite drive number from parameters sl@0: TDriveNumber compositeDrive = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KCompositeDrive(), compositeDrive)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KCompositeDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: // get Sync from parameters sl@0: TBool sync = EFalse; sl@0: if(!GET_MANDATORY_BOOL_PARAMETER(KIsSync(), aSection, sync)) sl@0: { sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: // get fileSystemName from parameters sl@0: TPtrC fileSystemName; sl@0: if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) ) sl@0: { sl@0: fileSystemName.Set(iFileSystemName); sl@0: } sl@0: sl@0: if(dataOk) sl@0: { sl@0: TInt err = iFs->AddCompositeMount(fileSystemName, localDriveToMount, compositeDrive, sync); sl@0: INFO_PRINTF1(_L("Calls RFs::AddCompositeMount()")); sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("AddCompositeMount() error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: } sl@0: void CT_FsData::DoCmdStartupInitCompleteL(TInt aAsyncErrorIndex) sl@0: /** Calls RFs::StartupInitComplete() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::StartupInitComplete()")); sl@0: sl@0: // call StartupInitComplete() sl@0: CActiveCallback* active = CActiveCallback::NewLC(*this); sl@0: iStartupInitComplete.AppendL(active); sl@0: CleanupStack::Pop(active); sl@0: sl@0: iFs->StartupInitComplete(active->iStatus); sl@0: active->Activate(aAsyncErrorIndex); sl@0: IncOutstanding(); sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdFinaliseDrives() sl@0: /** Calls RFs::FinaliseDrives() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::FinaliseDrives()")); sl@0: sl@0: TInt err = iFs->FinaliseDrives(); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("FinaliseDrives() error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdSetLocalDriveMappingL(const TDesC& aSection) sl@0: /** Calls RFs::SetLocalDriveMapping() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::SetLocalDriveMapping()")); sl@0: sl@0: // get operation from config sl@0: TLocalDriveMappingInfo::TDrvMapOperation operation = TLocalDriveMappingInfo::EWriteMappingsAndSet; sl@0: if (!GetDrvMapOperationFromConfig(aSection, KDriveMappingOperation(), operation)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDriveMappingOperation()); sl@0: SetBlockResult(EFail); sl@0: } sl@0: sl@0: // create an info buffer and set the operation sl@0: TLocalDriveMappingInfoBuf infoBuf; sl@0: TLocalDriveMappingInfo& info = infoBuf(); sl@0: info.iOperation = operation; sl@0: sl@0: // get drive mapping array from config sl@0: TInt driveMappingSize = 0; sl@0: if (GET_MANDATORY_INT_PARAMETER(KDriveMappingSize(), aSection, driveMappingSize)) sl@0: { sl@0: for(TInt i = 0; i < driveMappingSize; i++) sl@0: { sl@0: TBuf tmpBuff; sl@0: sl@0: tmpBuff.Append(KDriveMappingElement); sl@0: tmpBuff.AppendNum(i); sl@0: sl@0: TDriveNumber driveNumber; sl@0: if (GetDriveNumberFromConfig(aSection, tmpBuff, driveNumber)) sl@0: { sl@0: info.iDriveMapping[i] = driveNumber; sl@0: INFO_PRINTF3(_L("Drive mapping element[%d] = %d"), i, driveNumber); sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &tmpBuff); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: } sl@0: sl@0: // call SetLocalDriveMapping() sl@0: TInt err = iFs->SetLocalDriveMapping(infoBuf); sl@0: sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("SetLocalDriveMapping() error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: sl@0: sl@0: void CT_FsData::DoCmdSwapFileSystem(const TDesC& aSection) sl@0: /** Calls RFs::SwapFileSystem() */ sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::SwapFileSystem()")); sl@0: sl@0: //get OldFileSystemName sl@0: // get fileSystemName from parameters sl@0: TPtrC fileSystemName; sl@0: if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) ) sl@0: { sl@0: fileSystemName.Set(iFileSystemName); sl@0: } sl@0: sl@0: //get NewFileSystemName sl@0: TPtrC newFsName; sl@0: if(!GET_OPTIONAL_STRING_PARAMETER(KNewFileSystemName(), aSection, newFsName)) sl@0: { sl@0: newFsName.Set(iFileSystemName); sl@0: } sl@0: sl@0: // get drive number from parameters sl@0: TBool dataOk = ETrue; sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: dataOk = EFalse; sl@0: } sl@0: sl@0: if(dataOk) sl@0: { sl@0: TInt err = iFs->SwapFileSystem(fileSystemName, newFsName, driveNumber); sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("SwapFileSystem() error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: } sl@0: sl@0: } sl@0: sl@0: void CT_FsData::DoCmdFileSystemSubType(const TDesC& aSection) sl@0: { sl@0: INFO_PRINTF1(_L("Calls RFs::FileSystemSubType()")); sl@0: sl@0: // get drive number from parameters sl@0: TDriveNumber driveNumber = EDriveA; sl@0: if (GetDriveNumberFromConfig(aSection, KDrive(), driveNumber)) sl@0: { sl@0: TFSName subTypeName; sl@0: TInt err = iFs->FileSystemSubType(driveNumber, subTypeName); sl@0: // check error code sl@0: if (err != KErrNone) sl@0: { sl@0: ERR_PRINTF2(_L("FileSystemSubType() error: %d"), err); sl@0: SetError(err); sl@0: } sl@0: else sl@0: { sl@0: INFO_PRINTF2(_L("FileSystemSubType() subTypeName = %S"), &subTypeName); sl@0: //Check expected result sl@0: TPtrC subTypeNameExpect; sl@0: if (GET_OPTIONAL_STRING_PARAMETER(KSubTypeName(), aSection, subTypeNameExpect)) sl@0: { sl@0: if ( subTypeNameExpect != subTypeName) sl@0: { sl@0: ERR_PRINTF1(_L("File system name != expected name")); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: } sl@0: } sl@0: else sl@0: { sl@0: ERR_PRINTF2(_L("No %S"), &KDrive()); sl@0: SetBlockResult(EFail); sl@0: } sl@0: } sl@0: sl@0: TBool CT_FsData::GetDriveNumberFromConfig(const TDesC& aSection, const TDesC& aParameterName, TDriveNumber& aDriveNumber) sl@0: /** Reads drive number from INI-file */ sl@0: { sl@0: // Read drive number from INI file sl@0: TPtrC driveNumberStr; sl@0: TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, driveNumberStr); sl@0: if (ret) sl@0: { sl@0: if (driveNumberStr == KDriveA) sl@0: { sl@0: aDriveNumber = EDriveA; sl@0: } sl@0: else if (driveNumberStr == KDriveB) sl@0: { sl@0: aDriveNumber = EDriveB; sl@0: } sl@0: else if (driveNumberStr == KDriveC) sl@0: { sl@0: aDriveNumber = EDriveC; sl@0: } sl@0: else if (driveNumberStr == KDriveD) sl@0: { sl@0: aDriveNumber = EDriveD; sl@0: } sl@0: else if (driveNumberStr == KDriveE) sl@0: { sl@0: aDriveNumber = EDriveE; sl@0: } sl@0: else if (driveNumberStr == KDriveF) sl@0: { sl@0: aDriveNumber = EDriveF; sl@0: } sl@0: else if (driveNumberStr == KDriveG) sl@0: { sl@0: aDriveNumber = EDriveG; sl@0: } sl@0: else if (driveNumberStr == KDriveH) sl@0: { sl@0: aDriveNumber = EDriveH; sl@0: } sl@0: else if (driveNumberStr == KDriveI) sl@0: { sl@0: aDriveNumber = EDriveI; sl@0: } sl@0: else if (driveNumberStr == KDriveJ) sl@0: { sl@0: aDriveNumber = EDriveJ; sl@0: } sl@0: else if (driveNumberStr == KDriveK) sl@0: { sl@0: aDriveNumber = EDriveK; sl@0: } sl@0: else if (driveNumberStr == KDriveL) sl@0: { sl@0: aDriveNumber = EDriveL; sl@0: } sl@0: else if (driveNumberStr == KDriveM) sl@0: { sl@0: aDriveNumber = EDriveM; sl@0: } sl@0: else if (driveNumberStr == KDriveN) sl@0: { sl@0: aDriveNumber = EDriveN; sl@0: } sl@0: else if (driveNumberStr == KDriveO) sl@0: { sl@0: aDriveNumber = EDriveO; sl@0: } sl@0: else if (driveNumberStr == KDriveP) // Sorry, it's a bit long. But looks nice! sl@0: { sl@0: aDriveNumber = EDriveP; sl@0: } sl@0: else if (driveNumberStr == KDriveQ) sl@0: { sl@0: aDriveNumber = EDriveQ; sl@0: } sl@0: else if (driveNumberStr == KDriveR) sl@0: { sl@0: aDriveNumber = EDriveR; sl@0: } sl@0: else if (driveNumberStr == KDriveS) sl@0: { sl@0: aDriveNumber = EDriveS; sl@0: } sl@0: else if (driveNumberStr == KDriveT) sl@0: { sl@0: aDriveNumber = EDriveT; sl@0: } sl@0: else if (driveNumberStr == KDriveU) sl@0: { sl@0: aDriveNumber = EDriveU; sl@0: } sl@0: else if (driveNumberStr == KDriveV) sl@0: { sl@0: aDriveNumber = EDriveV; sl@0: } sl@0: else if (driveNumberStr == KDriveW) sl@0: { sl@0: aDriveNumber = EDriveW; sl@0: } sl@0: else if (driveNumberStr == KDriveX) sl@0: { sl@0: aDriveNumber = EDriveX; sl@0: } sl@0: else if (driveNumberStr == KDriveY) sl@0: { sl@0: aDriveNumber = EDriveY; sl@0: } sl@0: else if (driveNumberStr == KDriveZ) sl@0: { sl@0: aDriveNumber = EDriveZ; sl@0: } sl@0: else sl@0: { sl@0: TInt driveNumber = 0; sl@0: ret = GET_OPTIONAL_INT_PARAMETER(aParameterName, aSection, driveNumber); sl@0: if (ret) sl@0: { sl@0: aDriveNumber = (TDriveNumber) driveNumber; sl@0: } sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: sl@0: sl@0: TBool CT_FsData::GetDrvMapOperationFromConfig(const TDesC& aSection, const TDesC& aParameterName, TLocalDriveMappingInfo::TDrvMapOperation& aOperation) sl@0: /** Reads drive mapping operation name from INI-file */ sl@0: { sl@0: // Read drives mapping operation name from INI file sl@0: TPtrC operationStr; sl@0: TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, operationStr); sl@0: if (ret) sl@0: { sl@0: if (operationStr == KWriteMappingsAndSet) sl@0: { sl@0: aOperation = TLocalDriveMappingInfo::EWriteMappingsAndSet; sl@0: } sl@0: else if (operationStr == KWriteMappingsNoSet) sl@0: { sl@0: aOperation = TLocalDriveMappingInfo::EWriteMappingsNoSet; sl@0: } sl@0: else if (operationStr == KSwapIntMappingAndSet) sl@0: { sl@0: aOperation = TLocalDriveMappingInfo::ESwapIntMappingAndSet; sl@0: } sl@0: else sl@0: { sl@0: TInt operation = 0; sl@0: ret = GET_OPTIONAL_INT_PARAMETER(aParameterName, aSection, operation); sl@0: if (ret) sl@0: { sl@0: aOperation = (TLocalDriveMappingInfo::TDrvMapOperation) operation; sl@0: } sl@0: } sl@0: } sl@0: sl@0: return ret; sl@0: } sl@0: