1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/baseapitest/basesvs/validation/f32/sfsrv/src/T_FsDataMounts.cpp Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,1315 @@
1.4 +/*
1.5 +* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
1.6 +* All rights reserved.
1.7 +* This component and the accompanying materials are made available
1.8 +* under the terms of "Eclipse Public License v1.0"
1.9 +* which accompanies this distribution, and is available
1.10 +* at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.11 +*
1.12 +* Initial Contributors:
1.13 +* Nokia Corporation - initial contribution.
1.14 +*
1.15 +* Contributors:
1.16 +*
1.17 +* Description:
1.18 +*
1.19 +*/
1.20 +
1.21 +
1.22 +/**
1.23 +@test
1.24 +@internalComponent
1.25 +
1.26 +This contains CT_FsData
1.27 +*/
1.28 +
1.29 +// User includes
1.30 +#include "T_FsData.h"
1.31 +
1.32 +// EPOC includes
1.33 +#include <f32fsys.h>
1.34 +
1.35 +/*@{*/
1.36 +/// Enumerations
1.37 +_LIT(KDriveA, "EDriveA");
1.38 +_LIT(KDriveB, "EDriveB");
1.39 +_LIT(KDriveC, "EDriveC");
1.40 +_LIT(KDriveD, "EDriveD");
1.41 +_LIT(KDriveE, "EDriveE");
1.42 +_LIT(KDriveF, "EDriveF");
1.43 +_LIT(KDriveG, "EDriveG");
1.44 +_LIT(KDriveH, "EDriveH");
1.45 +_LIT(KDriveI, "EDriveI");
1.46 +_LIT(KDriveJ, "EDriveJ");
1.47 +_LIT(KDriveK, "EDriveK");
1.48 +_LIT(KDriveL, "EDriveL");
1.49 +_LIT(KDriveM, "EDriveM");
1.50 +_LIT(KDriveN, "EDriveN");
1.51 +_LIT(KDriveO, "EDriveO");
1.52 +_LIT(KDriveP, "EDriveP");
1.53 +_LIT(KDriveQ, "EDriveQ");
1.54 +_LIT(KDriveR, "EDriveR");
1.55 +_LIT(KDriveS, "EDriveS");
1.56 +_LIT(KDriveT, "EDriveT");
1.57 +_LIT(KDriveU, "EDriveU");
1.58 +_LIT(KDriveV, "EDriveV");
1.59 +_LIT(KDriveW, "EDriveW");
1.60 +_LIT(KDriveX, "EDriveX");
1.61 +_LIT(KDriveY, "EDriveY");
1.62 +_LIT(KDriveZ, "EDriveZ");
1.63 +
1.64 +_LIT(KWriteMappingsAndSet, "EWriteMappingsAndSet");
1.65 +_LIT(KWriteMappingsNoSet, "EWriteMappingsNoSet");
1.66 +_LIT(KSwapIntMappingAndSet, "ESwapIntMappingAndSet");
1.67 +
1.68 +
1.69 +/// Parameters
1.70 +_LIT(KDrive, "drive");
1.71 +_LIT(KDriveMappingElement, "drive_mapping_element_");
1.72 +_LIT(KDriveMappingSize, "drive_mapping_size");
1.73 +_LIT(KDriveMappingOperation, "drive_mapping_operation");
1.74 +_LIT(KFileName, "file_name");
1.75 +_LIT(KFileSystemName, "file_system_name");
1.76 +_LIT(KNewFileSystemName, "new_file_system_name");
1.77 +_LIT(KFlags, "flags");
1.78 +_LIT(KIsSync, "is_sync");
1.79 +_LIT(KExtensionName, "extension_name");
1.80 +_LIT(KPosition, "position");
1.81 +_LIT(KMode, "mode");
1.82 +_LIT(KAll, "all");
1.83 +_LIT(KCommandNum, "command_num");
1.84 +_LIT(KSaveInInstance, "save_in_instance");
1.85 +_LIT(KLocalDrive, "local_drive");
1.86 +_LIT(KCompositeDrive, "composite_drive");
1.87 +_LIT(KIsMountSuccess, "is_mount_success");
1.88 +_LIT(KParam1, "param1");
1.89 +_LIT(KParam2, "param2");
1.90 +_LIT(KIndex, "index");
1.91 +_LIT(KSubTypeName, "sub_type_name");
1.92 +
1.93 +
1.94 +/// Commands
1.95 +_LIT(KCmdAddFileSystem, "AddFileSystem");
1.96 +_LIT(KCmdDismountFileSystem, "DismountFileSystem");
1.97 +_LIT(KCmdFileSystemName, "FileSystemName");
1.98 +_LIT(KCmdMountFileSystem, "MountFileSystem");
1.99 +_LIT(KCmdMountFileSystemAndScan, "MountFileSystemAndScan");
1.100 +_LIT(KCmdRemountDrive, "RemountDrive");
1.101 +_LIT(KCmdRemoveFileSystem, "RemoveFileSystem");
1.102 +_LIT(KCmdAddExtension, "AddExtension");
1.103 +_LIT(KCmdMountExtension, "MountExtension");
1.104 +_LIT(KCmdRemoveExtension, "RemoveExtension");
1.105 +_LIT(KCmdExtensionName, "ExtensionName");
1.106 +_LIT(KCmdAddCompositeMount, "AddCompositeMount");
1.107 +_LIT(KCmdAllowDismount, "AllowDismount");
1.108 +_LIT(KCmdNotifyDismount, "NotifyDismount");
1.109 +_LIT(KCmdNotifyDismountCancel, "NotifyDismountCancel");
1.110 +_LIT(KCmdStartupInitComplete, "StartupInitComplete");
1.111 +_LIT(KCmdSwapFileSystem, "SwapFileSystem");
1.112 +_LIT(KCmdSetStartupConfiguration, "SetStartupConfiguration");
1.113 +_LIT(KCmdDismountExtension, "DismountExtension");
1.114 +_LIT(KCmdSetLocalDriveMapping, "SetLocalDriveMapping");
1.115 +_LIT(KCmdFinaliseDrives, "FinaliseDrives");
1.116 +_LIT(KCmdFileSystemSubType, "FileSystemSubType");
1.117 +/*@}*/
1.118 +
1.119 +
1.120 +TBool CT_FsData::DoCommandMountsL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
1.121 +/**
1.122 + * Process a mounts related command read from the ini file
1.123 + *
1.124 + * @param aCommand the command to process
1.125 + * @param aSection the entry in the ini file requiring the command to be processed
1.126 + *
1.127 + * @return ETrue if the command is processed
1.128 + */
1.129 + {
1.130 + TBool retVal = ETrue;
1.131 +
1.132 + if (aCommand == KCmdAddFileSystem)
1.133 + {
1.134 + DoCmdAddFileSystem(aSection);
1.135 + }
1.136 + else if (aCommand == KCmdDismountFileSystem)
1.137 + {
1.138 + DoCmdDismountFileSystem(aSection);
1.139 + }
1.140 + else if (aCommand == KCmdFileSystemName)
1.141 + {
1.142 + DoCmdFileSystemName(aSection);
1.143 + }
1.144 + else if (aCommand == KCmdMountFileSystem)
1.145 + {
1.146 + DoCmdMountFileSystem(aSection);
1.147 + }
1.148 + else if (aCommand == KCmdMountFileSystemAndScan)
1.149 + {
1.150 + DoCmdMountFileSystemAndScan(aSection);
1.151 + }
1.152 + else if (aCommand == KCmdRemoveFileSystem)
1.153 + {
1.154 + DoCmdRemoveFileSystem(aSection);
1.155 + }
1.156 + else if (aCommand == KCmdRemountDrive)
1.157 + {
1.158 + DoCmdRemountDriveL(aSection);
1.159 + }
1.160 + else if (aCommand == KCmdAddExtension)
1.161 + {
1.162 + DoCmdAddExtension(aSection);
1.163 + }
1.164 + else if (aCommand == KCmdRemoveExtension)
1.165 + {
1.166 + DoCmdRemoveExtension(aSection);
1.167 + }
1.168 + else if (aCommand == KCmdExtensionName)
1.169 + {
1.170 + DoCmdExtensionName(aSection);
1.171 + }
1.172 + else if (aCommand == KCmdMountExtension)
1.173 + {
1.174 + DoCmdMountExtension(aSection);
1.175 + }
1.176 + else if (aCommand == KCmdAllowDismount)
1.177 + {
1.178 + DoCmdAllowDismount(aSection);
1.179 + }
1.180 + else if (aCommand == KCmdNotifyDismount)
1.181 + {
1.182 + DoCmdNotifyDismountL(aSection, aAsyncErrorIndex);
1.183 + }
1.184 + else if (aCommand == KCmdNotifyDismountCancel)
1.185 + {
1.186 + DoCmdNotifyDismountCancel(aSection);
1.187 + }
1.188 + else if (aCommand == KCmdStartupInitComplete)
1.189 + {
1.190 + DoCmdStartupInitCompleteL(aAsyncErrorIndex);
1.191 + }
1.192 + else if (aCommand == KCmdSwapFileSystem)
1.193 + {
1.194 + DoCmdSwapFileSystem(aSection);
1.195 + }
1.196 + else if (aCommand == KCmdSetStartupConfiguration)
1.197 + {
1.198 + DoCmdSetStartupConfigurationL(aSection);
1.199 + }
1.200 + else if (aCommand == KCmdFinaliseDrives)
1.201 + {
1.202 + DoCmdFinaliseDrives();
1.203 + }
1.204 + else if (aCommand == KCmdAddCompositeMount)
1.205 + {
1.206 + DoCmdAddCompositeMount(aSection);
1.207 + }
1.208 + else if (aCommand == KCmdDismountExtension)
1.209 + {
1.210 + DoCmdDismountExtension(aSection);
1.211 + }
1.212 + else if (aCommand == KCmdSetLocalDriveMapping)
1.213 + {
1.214 + DoCmdSetLocalDriveMappingL(aSection);
1.215 + }
1.216 + else if (aCommand == KCmdFileSystemSubType)
1.217 + {
1.218 + DoCmdFileSystemSubType(aSection);
1.219 + }
1.220 + else
1.221 + {
1.222 + retVal = EFalse;
1.223 + }
1.224 +
1.225 + return retVal;
1.226 + }
1.227 +
1.228 +
1.229 +void CT_FsData::DoCmdAddFileSystem(const TDesC& aSection)
1.230 +/** Calls RFs::AddFileSystem() */
1.231 + {
1.232 + INFO_PRINTF1(_L("Calls RFs::AddFileSystem()"));
1.233 +
1.234 + // get file name from parameters
1.235 + TPtrC fileName;
1.236 + if ( GET_MANDATORY_STRING_PARAMETER(KFileName(), aSection, fileName))
1.237 + {
1.238 + // call AddFileSystem()
1.239 + TInt err = iFs->AddFileSystem(fileName);
1.240 +
1.241 + // check error code
1.242 + if (err != KErrNone)
1.243 + {
1.244 + ERR_PRINTF2(_L("AddFileSystem error: %d"), err);
1.245 + SetError(err);
1.246 + }
1.247 + }
1.248 + }
1.249 +
1.250 +void CT_FsData::DoCmdMountFileSystem(const TDesC& aSection)
1.251 +/** Calls RFs::MountFileSystem() */
1.252 + {
1.253 + INFO_PRINTF1(_L("Calls RFs::MountFileSystem()"));
1.254 +
1.255 + TBool dataOk = ETrue;
1.256 +
1.257 + // get drive number from parameters
1.258 + TDriveNumber driveNumber = EDriveA;
1.259 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.260 + {
1.261 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.262 + SetBlockResult(EFail);
1.263 + dataOk = EFalse;
1.264 + }
1.265 +
1.266 + // get file system name from parameters
1.267 + TPtrC fileSystemName;
1.268 + if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
1.269 + {
1.270 + fileSystemName.Set(iFileSystemName);
1.271 + }
1.272 +
1.273 + if(dataOk)
1.274 + {
1.275 + // get file system name from parameters
1.276 + TBool isSync = EFalse;
1.277 + TInt err = KErrNone;
1.278 +
1.279 + TPtrC extensionName;
1.280 + TBool hasExtensionName=GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extensionName);
1.281 + if (GET_OPTIONAL_BOOL_PARAMETER(KIsSync(), aSection, isSync))
1.282 + {
1.283 + if ( hasExtensionName )
1.284 + {
1.285 + // call MountFileSystem()
1.286 + INFO_PRINTF5(_L("MountFileSystem(%S, %S, %d, %d)"), &fileSystemName, &extensionName, driveNumber, isSync);
1.287 + err = iFs->MountFileSystem(fileSystemName, extensionName, driveNumber, isSync);
1.288 + }
1.289 + else
1.290 + {
1.291 + // call MountFileSystem()
1.292 + INFO_PRINTF4(_L("MountFileSystem(%S, %d, %d)"), &fileSystemName, driveNumber, isSync);
1.293 + err = iFs->MountFileSystem(fileSystemName, driveNumber, isSync);
1.294 + }
1.295 + }
1.296 + else
1.297 + {
1.298 + if ( hasExtensionName )
1.299 + {
1.300 + // call MountFileSystem()
1.301 + INFO_PRINTF4(_L("MountFileSystem(%S, %S, %d)"), &fileSystemName, &extensionName, driveNumber);
1.302 + err = iFs->MountFileSystem(fileSystemName, extensionName, driveNumber);
1.303 + }
1.304 + else
1.305 + {
1.306 + // call MountFileSystem()
1.307 + INFO_PRINTF3(_L("MountFileSystem(%S, %d)"), &fileSystemName, driveNumber);
1.308 + err = iFs->MountFileSystem(fileSystemName, driveNumber);
1.309 + }
1.310 + }
1.311 + // check error code
1.312 + if (err != KErrNone)
1.313 + {
1.314 + ERR_PRINTF2(_L("MountFileSystem error: %d"), err);
1.315 + SetError(err);
1.316 + }
1.317 + }
1.318 + }
1.319 +
1.320 +
1.321 +void CT_FsData::DoCmdMountFileSystemAndScan(const TDesC& aSection)
1.322 +/** Calls RFs::MountFileSystemAndScan() */
1.323 + {
1.324 + INFO_PRINTF1(_L("Calls RFs::MountFileSystemAndScan()"));
1.325 +
1.326 + TBool dataOk = ETrue;
1.327 +
1.328 + // get drive number from parameters
1.329 + TDriveNumber driveNumber = EDriveA;
1.330 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.331 + {
1.332 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.333 + SetBlockResult(EFail);
1.334 + dataOk = EFalse;
1.335 + }
1.336 +
1.337 + // get file system name from parameters
1.338 + TPtrC fileSystemName;
1.339 + if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
1.340 + {
1.341 + fileSystemName.Set(iFileSystemName);
1.342 + }
1.343 +
1.344 + if(dataOk)
1.345 + {
1.346 + TInt err=KErrNone;
1.347 + TBool isMountSuccess = EFalse;
1.348 + // get extension name from parameters
1.349 + TPtrC extensionName;
1.350 + if (GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
1.351 + {
1.352 + //call MountFileSystemAndScan
1.353 + INFO_PRINTF4(_L("MountFileSystemAndScan(%S, %S, %d, isMountSuccess)"), &fileSystemName, &extensionName, driveNumber);
1.354 + err = iFs->MountFileSystemAndScan(fileSystemName, extensionName, driveNumber, isMountSuccess);
1.355 + }
1.356 + else
1.357 + {
1.358 + //call MountFileSystemAndScan
1.359 + INFO_PRINTF3(_L("MountFileSystemAndScan(%S, %d, isMountSuccess)"), &fileSystemName, driveNumber);
1.360 + err = iFs->MountFileSystemAndScan(fileSystemName, driveNumber, isMountSuccess);
1.361 + }
1.362 +
1.363 + // check error code
1.364 + if (err != KErrNone)
1.365 + {
1.366 + ERR_PRINTF2(_L("MountFileSystemAndScan error: %d"), err);
1.367 + SetError(err);
1.368 + }
1.369 +
1.370 + //Only for info
1.371 + if(isMountSuccess)
1.372 + {
1.373 + INFO_PRINTF1(_L("MountFileSystemAndScan() successfully mounted"));
1.374 + }
1.375 + else
1.376 + {
1.377 + INFO_PRINTF1(_L("MountFileSystemAndScan() not mounted"));
1.378 + }
1.379 +
1.380 + //check if mount was successful
1.381 + TBool expected = EFalse;
1.382 + if ( GET_OPTIONAL_BOOL_PARAMETER(KIsMountSuccess(), aSection, expected) )
1.383 + {
1.384 + if ( isMountSuccess!=expected )
1.385 + {
1.386 + ERR_PRINTF1(_L("MountFileSystemAndScan() does not match expected value"));
1.387 + SetBlockResult(EFail);
1.388 + }
1.389 + }
1.390 + }
1.391 + }
1.392 +
1.393 +
1.394 +void CT_FsData::DoCmdDismountFileSystem(const TDesC& aSection)
1.395 +/** Calls RFs::DismountFileSystem() */
1.396 + {
1.397 + INFO_PRINTF1(_L("Calls RFs::DismountFileSystem()"));
1.398 +
1.399 + TBool dataOk = ETrue;
1.400 +
1.401 + // get drive number from parameters
1.402 + TDriveNumber driveNumber = EDriveA;
1.403 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.404 + {
1.405 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.406 + SetBlockResult(EFail);
1.407 + dataOk = EFalse;
1.408 + }
1.409 + // get file system name from parameters
1.410 + TPtrC fileSystemName;
1.411 + if (!GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName))
1.412 + {
1.413 + fileSystemName.Set(iFileSystemName);
1.414 + }
1.415 +
1.416 + if(dataOk)
1.417 + {
1.418 + // call DismountFileSystem()
1.419 + TInt err = iFs->DismountFileSystem(fileSystemName, driveNumber);
1.420 +
1.421 + // check error code
1.422 + if (err != KErrNone)
1.423 + {
1.424 + ERR_PRINTF2(_L("DismountFileSystem error: %d"), err);
1.425 + SetError(err);
1.426 + }
1.427 + }
1.428 + }
1.429 +
1.430 +
1.431 +void CT_FsData::DoCmdRemoveFileSystem(const TDesC& aSection)
1.432 +/** Calls RFs::RemoveFileSystem() */
1.433 + {
1.434 + INFO_PRINTF1(_L("Calls RFs::RemoveFileSystem()"));
1.435 +
1.436 + // get file name from parameters
1.437 + TPtrC fileSystemName;
1.438 + if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
1.439 + {
1.440 + fileSystemName.Set(iFileSystemName);
1.441 + }
1.442 +
1.443 + // call RemoveFileSystem()
1.444 + TInt err = iFs->RemoveFileSystem(fileSystemName);
1.445 +
1.446 + // check error code
1.447 + if (err != KErrNone)
1.448 + {
1.449 + ERR_PRINTF2(_L("RemoveFileSystem error: %d"), err);
1.450 + SetError(err);
1.451 + }
1.452 + }
1.453 +
1.454 +
1.455 +void CT_FsData::DoCmdFileSystemName(const TDesC& aSection)
1.456 +/** Calls RFs::FileSystemName() */
1.457 + {
1.458 + INFO_PRINTF1(_L("Calls RFs::FileSystemName()"));
1.459 +
1.460 + // get a flag if we need to remember the file system name in an instance variable
1.461 + TBool save=ETrue;
1.462 + GET_OPTIONAL_BOOL_PARAMETER(KSaveInInstance(), aSection, save);
1.463 +
1.464 + // get drive number from parameters
1.465 + TDriveNumber driveNumber = EDriveA;
1.466 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.467 + {
1.468 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.469 + SetBlockResult(EFail);
1.470 + }
1.471 + else
1.472 + {
1.473 + // call FileSystemName()
1.474 + TFullName fileSystemName;
1.475 + TInt err = iFs->FileSystemName(fileSystemName, driveNumber);
1.476 + INFO_PRINTF2(_L("File system name: %S"), &fileSystemName);
1.477 +
1.478 + // check error code
1.479 + if (err == KErrNone)
1.480 + {
1.481 + if ( save )
1.482 + {
1.483 + iFileSystemName=fileSystemName;
1.484 + }
1.485 + }
1.486 + else
1.487 + {
1.488 + ERR_PRINTF2(_L("FileSystemName error: %d"), err);
1.489 + SetError(err);
1.490 + }
1.491 +
1.492 + //Check expected result
1.493 + TPtrC fsNameExpect;
1.494 + if (GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fsNameExpect))
1.495 + {
1.496 + if ( fsNameExpect != fileSystemName)
1.497 + {
1.498 + ERR_PRINTF1(_L("File system name != expected name"));
1.499 + SetBlockResult(EFail);
1.500 + }
1.501 + }
1.502 + }
1.503 + }
1.504 +
1.505 +
1.506 +void CT_FsData::DoCmdAddExtension(const TDesC& aSection)
1.507 +/** Calls RFs::AddExtension() */
1.508 + {
1.509 + INFO_PRINTF1(_L("Calls RFs::AddExtension()"));
1.510 + TPtrC fileName;
1.511 + if ( GET_MANDATORY_STRING_PARAMETER(KFileName(), aSection, fileName) )
1.512 + {
1.513 + //call AddExtension
1.514 + TInt err = iFs->AddExtension(fileName);
1.515 +
1.516 + // check error code
1.517 + if (err != KErrNone)
1.518 + {
1.519 + ERR_PRINTF2(_L("AddExtension error: %d"), err);
1.520 + SetError(err);
1.521 + }
1.522 + }
1.523 + }
1.524 +
1.525 +
1.526 +void CT_FsData::DoCmdMountExtension(const TDesC& aSection)
1.527 +/** Calls RFs::MountExtension() */
1.528 + {
1.529 + INFO_PRINTF1(_L("Calls RFs::MountExtension()"));
1.530 +
1.531 + TBool dataOk = ETrue;
1.532 +
1.533 + // get drive number from parameters
1.534 + TDriveNumber driveNumber = EDriveA;
1.535 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.536 + {
1.537 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.538 + SetBlockResult(EFail);
1.539 + dataOk = EFalse;
1.540 + }
1.541 +
1.542 + // get extension name from parameters
1.543 + TPtrC extensionName;
1.544 + if (!GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
1.545 + {
1.546 + dataOk = EFalse;
1.547 + }
1.548 +
1.549 + if(dataOk)
1.550 + {
1.551 + TInt err = iFs->MountExtension(extensionName, driveNumber);
1.552 + if (err != KErrNone)
1.553 + {
1.554 + ERR_PRINTF2(_L("MountExtension error: %d"), err);
1.555 + SetError(err);
1.556 + }
1.557 + }
1.558 + }
1.559 +
1.560 +void CT_FsData::DoCmdDismountExtension(const TDesC& aSection)
1.561 +/** Calls RFs::DismountExtension() */
1.562 + {
1.563 + INFO_PRINTF1(_L("Calls RFs::DismountExtension()"));
1.564 +
1.565 + TBool dataOk = ETrue;
1.566 +
1.567 + // get drive number from parameters
1.568 + TDriveNumber driveNumber = EDriveA;
1.569 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.570 + {
1.571 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.572 + SetBlockResult(EFail);
1.573 + dataOk = EFalse;
1.574 + }
1.575 +
1.576 + TPtrC extensionName;
1.577 + if (!GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
1.578 + {
1.579 + dataOk = EFalse;
1.580 + }
1.581 + if(dataOk)
1.582 + {
1.583 + //call DismountExtension
1.584 + TInt err = iFs->DismountExtension(extensionName, driveNumber);
1.585 +
1.586 + //check error code
1.587 + if (err != KErrNone)
1.588 + {
1.589 + ERR_PRINTF2(_L("DismountExtension error: %d"), err);
1.590 + SetError(err);
1.591 + }
1.592 + }
1.593 +
1.594 + }
1.595 +
1.596 +
1.597 +void CT_FsData::DoCmdRemoveExtension(const TDesC& aSection)
1.598 +/** Calls RFs::RemoveExtension() */
1.599 + {
1.600 + INFO_PRINTF1(_L("Calls RFs::RemoveExtension()"));
1.601 +
1.602 + TPtrC extensionName;
1.603 + if (GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
1.604 + {
1.605 + //call RemoveExtension
1.606 + TInt err = iFs->RemoveExtension(extensionName);
1.607 +
1.608 + // check error code
1.609 + if (err != KErrNone)
1.610 + {
1.611 + ERR_PRINTF2(_L("RemoveExtension error: %d"), err);
1.612 + SetError(err);
1.613 + }
1.614 + }
1.615 + }
1.616 +
1.617 +
1.618 +void CT_FsData::DoCmdExtensionName(const TDesC& aSection)
1.619 +/** Calls RFs::ExtensionName() */
1.620 + {
1.621 + INFO_PRINTF1(_L("Calls RFs::ExtensionName()"));
1.622 +
1.623 + TBool dataOk = ETrue;
1.624 +
1.625 + // get drive number from parameters
1.626 + TDriveNumber driveNumber = EDriveA;
1.627 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.628 + {
1.629 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.630 + SetBlockResult(EFail);
1.631 + dataOk = EFalse;
1.632 + }
1.633 + //get position of the extension in the extension hierarchy.
1.634 + TInt pos = 0;
1.635 + if (!GET_MANDATORY_INT_PARAMETER(KPosition(), aSection, pos))
1.636 + {
1.637 + dataOk = EFalse;
1.638 + }
1.639 +
1.640 + if(dataOk)
1.641 + {
1.642 +
1.643 + TInt err = iFs->ExtensionName(iExtensionName, driveNumber, pos);
1.644 +
1.645 + if(err == KErrNone)
1.646 + {
1.647 + TPtrC extNameExpect;
1.648 + if (GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extNameExpect))
1.649 + {
1.650 + if(extNameExpect != iExtensionName)
1.651 + {
1.652 + ERR_PRINTF3(_L("ExtensionName: %S != %S expected name"), &iExtensionName, &extNameExpect);
1.653 + SetBlockResult(EFail);
1.654 + }
1.655 + else
1.656 + {
1.657 + INFO_PRINTF2(_L("ExtensionName: %S"), &iExtensionName);
1.658 + }
1.659 + }
1.660 + else
1.661 + {
1.662 + INFO_PRINTF2(_L("ExtensionName: %S"), &iExtensionName);
1.663 + }
1.664 + }
1.665 + // check error code
1.666 + else
1.667 + {
1.668 + ERR_PRINTF2(_L("ExtensionName error: %d"), err);
1.669 + SetError(err);
1.670 + }
1.671 + }
1.672 + }
1.673 +
1.674 +
1.675 +void CT_FsData::DoCmdRemountDriveL(const TDesC& aSection)
1.676 +/** Calls RFs::RemountDrive() */
1.677 + {
1.678 + INFO_PRINTF1(_L("Calls RFs::RemountDrive()"));
1.679 + TBool dataOk = ETrue;
1.680 +
1.681 + // get drive number from parameters
1.682 + TDriveNumber driveNumber = EDriveA;
1.683 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.684 + {
1.685 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.686 + SetBlockResult(EFail);
1.687 + dataOk = EFalse;
1.688 + }
1.689 +
1.690 + // get flags from parameters can be in hex(0x00000001) or in decimal(1)
1.691 + TUint flags = 0;
1.692 + TInt tempVal = 0;
1.693 +
1.694 + if(GetHexFromConfig(aSection, KFlags, tempVal))
1.695 + {
1.696 + flags = tempVal;
1.697 + }
1.698 + else if(GET_OPTIONAL_INT_PARAMETER(KFlags(), aSection, tempVal))
1.699 + {
1.700 + flags = tempVal;
1.701 + }
1.702 + else
1.703 + {
1.704 + ERR_PRINTF2(_L("No parameter %S"), &KFlags());
1.705 + SetBlockResult(EFail);
1.706 + dataOk = EFalse;
1.707 + }
1.708 +
1.709 + RFile file;
1.710 + HBufC8* fileDataBuff = NULL;
1.711 +
1.712 + // get file name from parameters
1.713 + TPtrC fileName;
1.714 + TBool useMountInfo = GET_OPTIONAL_STRING_PARAMETER(KFileName(), aSection, fileName);
1.715 + if ( useMountInfo )
1.716 + {
1.717 + // open file
1.718 + TInt error = file.Open(FileServer(), fileName, EFileRead | EFileShareAny);
1.719 + if(error == KErrNone)
1.720 + {
1.721 + CleanupClosePushL(file);
1.722 + INFO_PRINTF1(_L("File Opened."));
1.723 + // get size
1.724 + TInt size = 0;
1.725 + error = file.Size(size);
1.726 + INFO_PRINTF2(_L("File Size=%d."), size);
1.727 + if(error == KErrNone)
1.728 + {
1.729 + // read file
1.730 + fileDataBuff = HBufC8::NewL(size);
1.731 + INFO_PRINTF1(_L("Buffer created."));
1.732 +
1.733 + CleanupStack::PushL(fileDataBuff);
1.734 + TPtr8 fileData = fileDataBuff->Des();
1.735 + error = file.Read(fileData);
1.736 + if(error != KErrNone)
1.737 + {
1.738 + ERR_PRINTF2(_L("Reading File, Error: %d"), error);
1.739 + dataOk = EFalse;
1.740 + SetBlockResult(EFail);
1.741 + }
1.742 + }
1.743 + else
1.744 + {
1.745 + ERR_PRINTF2(_L("File Size, Error: %d."), error);
1.746 + dataOk = EFalse;
1.747 + SetBlockResult(EFail);
1.748 + }
1.749 + }
1.750 + else
1.751 + {
1.752 + ERR_PRINTF2(_L("File Open, Error: %d"), error);
1.753 + dataOk = EFalse;
1.754 + SetBlockResult(EFail);
1.755 + }
1.756 + }
1.757 +
1.758 + if ( dataOk )
1.759 + {
1.760 + // call RemountDrive()
1.761 + TInt err = iFs->RemountDrive(driveNumber, fileDataBuff, flags);
1.762 + INFO_PRINTF2(_L("RemountDrive Flags: %u"), flags);
1.763 +
1.764 + // check error code
1.765 + if (err != KErrNone)
1.766 + {
1.767 + ERR_PRINTF2(_L("RemountDrive error: %d"), err);
1.768 + SetError(err);
1.769 + }
1.770 + }
1.771 +
1.772 + // cleanup if mountInfo was used
1.773 + if (useMountInfo)
1.774 + {
1.775 + CleanupStack::PopAndDestroy(2, &file); // file, fileDataBuff
1.776 + }
1.777 +
1.778 + }
1.779 +
1.780 +
1.781 +void CT_FsData::DoCmdNotifyDismountL(const TDesC& aSection, const TInt aAsyncErrorIndex)
1.782 +/** Calls RFs::NotifyDismount() */
1.783 + {
1.784 + INFO_PRINTF1(_L("Calls RFs::NotifyDismount()"));
1.785 +
1.786 + TNotifyDismountMode mode = EFsDismountRegisterClient;
1.787 + TPtrC modeStr;
1.788 + //get NotifyDismountMode from parameters
1.789 + if(GET_MANDATORY_STRING_PARAMETER(KMode(), aSection, modeStr))
1.790 + {
1.791 + if(modeStr == _L("EFsDismountRegisterClient"))
1.792 + {
1.793 + mode = EFsDismountRegisterClient;
1.794 + }
1.795 + else if(modeStr == _L("EFsDismountNotifyClients"))
1.796 + {
1.797 + mode = EFsDismountNotifyClients;
1.798 + }
1.799 + else if(modeStr == _L("EFsDismountForceDismount"))
1.800 + {
1.801 + mode = EFsDismountForceDismount;
1.802 + }
1.803 + else
1.804 + {
1.805 + TInt modeNumber;
1.806 + if(GET_OPTIONAL_INT_PARAMETER(KMode, aSection, modeNumber))
1.807 + {
1.808 + mode = (TNotifyDismountMode)modeNumber;
1.809 + }
1.810 + else
1.811 + {
1.812 + ERR_PRINTF3(_L("NotifyDismount() incorrect parameter %S in %S"), &modeStr, &KMode());
1.813 + SetBlockResult(EFail);
1.814 + }
1.815 + }
1.816 + }
1.817 +
1.818 + TDriveNumber driveNumber = EDriveA;
1.819 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.820 + {
1.821 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.822 + SetBlockResult(EFail);
1.823 + }
1.824 + else
1.825 + {
1.826 + // call NotifyDismount()
1.827 + CActiveCallback* active = CActiveCallback::NewLC(*this);
1.828 + iNotifyDismount.AppendL(active);
1.829 + CleanupStack::Pop(active);
1.830 +
1.831 + iFs->NotifyDismount(driveNumber, active->iStatus, mode);
1.832 + active->Activate(aAsyncErrorIndex);
1.833 + IncOutstanding();
1.834 + }
1.835 + }
1.836 +
1.837 +
1.838 +void CT_FsData::DoCmdNotifyDismountCancel(const TDesC& aSection)
1.839 +/** Calls RFs::NotifyDismountCancel() */
1.840 + {
1.841 + INFO_PRINTF1(_L("Calls RFs::NotifyDismountCancel()"));
1.842 +
1.843 + TBool all = ETrue;
1.844 +
1.845 + if(GET_MANDATORY_BOOL_PARAMETER(KAll(), aSection, all))
1.846 + {
1.847 + if(all)
1.848 + {
1.849 + //Cancels all outstanding requests.
1.850 + iFs->NotifyDismountCancel();
1.851 + INFO_PRINTF1(_L("NotifyDismountCancel()"));
1.852 + }
1.853 + else
1.854 + {
1.855 + // Cancels a specific outstanding request
1.856 + TInt index=0;
1.857 + GET_OPTIONAL_INT_PARAMETER(KIndex, aSection, index);
1.858 +
1.859 + //Cancels a specific outstanding request
1.860 + iFs->NotifyDismountCancel(iNotifyDismount[index]->iStatus);
1.861 + INFO_PRINTF1(_L("NotifyDismountCancel(TRequestStatus)"));
1.862 + }
1.863 + }
1.864 + }
1.865 +
1.866 +
1.867 +void CT_FsData::DoCmdAllowDismount(const TDesC& aSection)
1.868 +/** Calls RFs::AllowDismount() */
1.869 + {
1.870 + INFO_PRINTF1(_L("Calls RFs::AllowDismount()"));
1.871 +
1.872 + // get drive number from parameters
1.873 + TDriveNumber driveNumber = EDriveA;
1.874 + if(!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.875 + {
1.876 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.877 + SetBlockResult(EFail);
1.878 + }
1.879 + else
1.880 + {
1.881 + //call AllowDismount
1.882 + TInt err = iFs->AllowDismount(driveNumber);
1.883 + // check error code
1.884 + if (err != KErrNone)
1.885 + {
1.886 + ERR_PRINTF2(_L("AllowDismount error: %d"), err);
1.887 + SetError(err);
1.888 + }
1.889 + }
1.890 + }
1.891 +
1.892 +
1.893 +void CT_FsData::DoCmdSetStartupConfigurationL(const TDesC& aSection)
1.894 +/** Calls RFs::SetStartupConfiguration() */
1.895 + {
1.896 + INFO_PRINTF1(_L("Calls RFs::SetStartupConfiguration()"));
1.897 +
1.898 + //get Command from parameters
1.899 + TPtrC commandNum;
1.900 + TStartupConfigurationCmd configCommand = ELoaderPriority;
1.901 + if(GET_MANDATORY_STRING_PARAMETER(KCommandNum(), aSection, commandNum))
1.902 + {
1.903 + //Converting from string to TStartupConfigurationCmd
1.904 + if(commandNum == _L("ELoaderPriority"))
1.905 + {
1.906 + configCommand = ELoaderPriority;
1.907 + }
1.908 + else if(commandNum == _L("ESetRugged"))
1.909 + {
1.910 + configCommand = ESetRugged;
1.911 + }
1.912 + else if(commandNum == _L("EMaxStartupConfigurationCmd"))
1.913 + {
1.914 + configCommand = EMaxStartupConfigurationCmd;
1.915 + }
1.916 + TAny* param1 = NULL;
1.917 + TPtrC name;
1.918 + if(GET_OPTIONAL_STRING_PARAMETER(KParam1(), aSection, name))
1.919 + {
1.920 + param1 = GetDataObjectL(name);
1.921 + }
1.922 + TAny* param2 = NULL;
1.923 +
1.924 + if(GET_OPTIONAL_STRING_PARAMETER(KParam2(), aSection, name))
1.925 + {
1.926 + param2 = GetDataObjectL(name);
1.927 + }
1.928 + //call SetStartupConfiguration
1.929 + TInt err = iFs->SetStartupConfiguration(configCommand, param1, param2);
1.930 + INFO_PRINTF2(_L("RFs::SetStartupConfiguration() %S"), &commandNum);
1.931 + // check error code
1.932 + if (err != KErrNone)
1.933 + {
1.934 + ERR_PRINTF2(_L("SetStartupConfiguration() error: %d"), err);
1.935 + SetError(err);
1.936 + }
1.937 + }
1.938 + }
1.939 +
1.940 +void CT_FsData::DoCmdAddCompositeMount(const TDesC& aSection)
1.941 + {
1.942 + INFO_PRINTF1(_L("Calls RFs::AddCompositeMount()"));
1.943 +
1.944 + TBool dataOk = ETrue;
1.945 +
1.946 + // get drive number from parameters
1.947 + TDriveNumber localDriveToMount = EDriveA;
1.948 + if (!GetDriveNumberFromConfig(aSection, KLocalDrive(), localDriveToMount))
1.949 + {
1.950 + ERR_PRINTF2(_L("No %S"), &KLocalDrive());
1.951 + SetBlockResult(EFail);
1.952 + dataOk = EFalse;
1.953 + }
1.954 +
1.955 + // get composite drive number from parameters
1.956 + TDriveNumber compositeDrive = EDriveA;
1.957 + if (!GetDriveNumberFromConfig(aSection, KCompositeDrive(), compositeDrive))
1.958 + {
1.959 + ERR_PRINTF2(_L("No %S"), &KCompositeDrive());
1.960 + SetBlockResult(EFail);
1.961 + dataOk = EFalse;
1.962 + }
1.963 +
1.964 + // get Sync from parameters
1.965 + TBool sync = EFalse;
1.966 + if(!GET_MANDATORY_BOOL_PARAMETER(KIsSync(), aSection, sync))
1.967 + {
1.968 + dataOk = EFalse;
1.969 + }
1.970 +
1.971 + // get fileSystemName from parameters
1.972 + TPtrC fileSystemName;
1.973 + if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
1.974 + {
1.975 + fileSystemName.Set(iFileSystemName);
1.976 + }
1.977 +
1.978 + if(dataOk)
1.979 + {
1.980 + TInt err = iFs->AddCompositeMount(fileSystemName, localDriveToMount, compositeDrive, sync);
1.981 + INFO_PRINTF1(_L("Calls RFs::AddCompositeMount()"));
1.982 + // check error code
1.983 + if (err != KErrNone)
1.984 + {
1.985 + ERR_PRINTF2(_L("AddCompositeMount() error: %d"), err);
1.986 + SetError(err);
1.987 + }
1.988 + }
1.989 + }
1.990 +void CT_FsData::DoCmdStartupInitCompleteL(TInt aAsyncErrorIndex)
1.991 +/** Calls RFs::StartupInitComplete() */
1.992 + {
1.993 + INFO_PRINTF1(_L("Calls RFs::StartupInitComplete()"));
1.994 +
1.995 + // call StartupInitComplete()
1.996 + CActiveCallback* active = CActiveCallback::NewLC(*this);
1.997 + iStartupInitComplete.AppendL(active);
1.998 + CleanupStack::Pop(active);
1.999 +
1.1000 + iFs->StartupInitComplete(active->iStatus);
1.1001 + active->Activate(aAsyncErrorIndex);
1.1002 + IncOutstanding();
1.1003 + }
1.1004 +
1.1005 +
1.1006 +void CT_FsData::DoCmdFinaliseDrives()
1.1007 +/** Calls RFs::FinaliseDrives() */
1.1008 + {
1.1009 + INFO_PRINTF1(_L("Calls RFs::FinaliseDrives()"));
1.1010 +
1.1011 + TInt err = iFs->FinaliseDrives();
1.1012 +
1.1013 + // check error code
1.1014 + if (err != KErrNone)
1.1015 + {
1.1016 + ERR_PRINTF2(_L("FinaliseDrives() error: %d"), err);
1.1017 + SetError(err);
1.1018 + }
1.1019 + }
1.1020 +
1.1021 +
1.1022 +void CT_FsData::DoCmdSetLocalDriveMappingL(const TDesC& aSection)
1.1023 +/** Calls RFs::SetLocalDriveMapping() */
1.1024 + {
1.1025 + INFO_PRINTF1(_L("Calls RFs::SetLocalDriveMapping()"));
1.1026 +
1.1027 + // get operation from config
1.1028 + TLocalDriveMappingInfo::TDrvMapOperation operation = TLocalDriveMappingInfo::EWriteMappingsAndSet;
1.1029 + if (!GetDrvMapOperationFromConfig(aSection, KDriveMappingOperation(), operation))
1.1030 + {
1.1031 + ERR_PRINTF2(_L("No %S"), &KDriveMappingOperation());
1.1032 + SetBlockResult(EFail);
1.1033 + }
1.1034 +
1.1035 + // create an info buffer and set the operation
1.1036 + TLocalDriveMappingInfoBuf infoBuf;
1.1037 + TLocalDriveMappingInfo& info = infoBuf();
1.1038 + info.iOperation = operation;
1.1039 +
1.1040 + // get drive mapping array from config
1.1041 + TInt driveMappingSize = 0;
1.1042 + if (GET_MANDATORY_INT_PARAMETER(KDriveMappingSize(), aSection, driveMappingSize))
1.1043 + {
1.1044 + for(TInt i = 0; i < driveMappingSize; i++)
1.1045 + {
1.1046 + TBuf<KBufferStringLength> tmpBuff;
1.1047 +
1.1048 + tmpBuff.Append(KDriveMappingElement);
1.1049 + tmpBuff.AppendNum(i);
1.1050 +
1.1051 + TDriveNumber driveNumber;
1.1052 + if (GetDriveNumberFromConfig(aSection, tmpBuff, driveNumber))
1.1053 + {
1.1054 + info.iDriveMapping[i] = driveNumber;
1.1055 + INFO_PRINTF3(_L("Drive mapping element[%d] = %d"), i, driveNumber);
1.1056 + }
1.1057 + else
1.1058 + {
1.1059 + ERR_PRINTF2(_L("No %S"), &tmpBuff);
1.1060 + SetBlockResult(EFail);
1.1061 + }
1.1062 + }
1.1063 + }
1.1064 +
1.1065 + // call SetLocalDriveMapping()
1.1066 + TInt err = iFs->SetLocalDriveMapping(infoBuf);
1.1067 +
1.1068 + // check error code
1.1069 + if (err != KErrNone)
1.1070 + {
1.1071 + ERR_PRINTF2(_L("SetLocalDriveMapping() error: %d"), err);
1.1072 + SetError(err);
1.1073 + }
1.1074 + }
1.1075 +
1.1076 +
1.1077 +void CT_FsData::DoCmdSwapFileSystem(const TDesC& aSection)
1.1078 +/** Calls RFs::SwapFileSystem() */
1.1079 + {
1.1080 + INFO_PRINTF1(_L("Calls RFs::SwapFileSystem()"));
1.1081 +
1.1082 + //get OldFileSystemName
1.1083 + // get fileSystemName from parameters
1.1084 + TPtrC fileSystemName;
1.1085 + if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
1.1086 + {
1.1087 + fileSystemName.Set(iFileSystemName);
1.1088 + }
1.1089 +
1.1090 + //get NewFileSystemName
1.1091 + TPtrC newFsName;
1.1092 + if(!GET_OPTIONAL_STRING_PARAMETER(KNewFileSystemName(), aSection, newFsName))
1.1093 + {
1.1094 + newFsName.Set(iFileSystemName);
1.1095 + }
1.1096 +
1.1097 + // get drive number from parameters
1.1098 + TBool dataOk = ETrue;
1.1099 + TDriveNumber driveNumber = EDriveA;
1.1100 + if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.1101 + {
1.1102 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.1103 + SetBlockResult(EFail);
1.1104 + dataOk = EFalse;
1.1105 + }
1.1106 +
1.1107 + if(dataOk)
1.1108 + {
1.1109 + TInt err = iFs->SwapFileSystem(fileSystemName, newFsName, driveNumber);
1.1110 + // check error code
1.1111 + if (err != KErrNone)
1.1112 + {
1.1113 + ERR_PRINTF2(_L("SwapFileSystem() error: %d"), err);
1.1114 + SetError(err);
1.1115 + }
1.1116 + }
1.1117 +
1.1118 + }
1.1119 +
1.1120 +void CT_FsData::DoCmdFileSystemSubType(const TDesC& aSection)
1.1121 + {
1.1122 + INFO_PRINTF1(_L("Calls RFs::FileSystemSubType()"));
1.1123 +
1.1124 + // get drive number from parameters
1.1125 + TDriveNumber driveNumber = EDriveA;
1.1126 + if (GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
1.1127 + {
1.1128 + TFSName subTypeName;
1.1129 + TInt err = iFs->FileSystemSubType(driveNumber, subTypeName);
1.1130 + // check error code
1.1131 + if (err != KErrNone)
1.1132 + {
1.1133 + ERR_PRINTF2(_L("FileSystemSubType() error: %d"), err);
1.1134 + SetError(err);
1.1135 + }
1.1136 + else
1.1137 + {
1.1138 + INFO_PRINTF2(_L("FileSystemSubType() subTypeName = %S"), &subTypeName);
1.1139 + //Check expected result
1.1140 + TPtrC subTypeNameExpect;
1.1141 + if (GET_OPTIONAL_STRING_PARAMETER(KSubTypeName(), aSection, subTypeNameExpect))
1.1142 + {
1.1143 + if ( subTypeNameExpect != subTypeName)
1.1144 + {
1.1145 + ERR_PRINTF1(_L("File system name != expected name"));
1.1146 + SetBlockResult(EFail);
1.1147 + }
1.1148 + }
1.1149 + }
1.1150 + }
1.1151 + else
1.1152 + {
1.1153 + ERR_PRINTF2(_L("No %S"), &KDrive());
1.1154 + SetBlockResult(EFail);
1.1155 + }
1.1156 + }
1.1157 +
1.1158 +TBool CT_FsData::GetDriveNumberFromConfig(const TDesC& aSection, const TDesC& aParameterName, TDriveNumber& aDriveNumber)
1.1159 +/** Reads drive number from INI-file */
1.1160 + {
1.1161 + // Read drive number from INI file
1.1162 + TPtrC driveNumberStr;
1.1163 + TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, driveNumberStr);
1.1164 + if (ret)
1.1165 + {
1.1166 + if (driveNumberStr == KDriveA)
1.1167 + {
1.1168 + aDriveNumber = EDriveA;
1.1169 + }
1.1170 + else if (driveNumberStr == KDriveB)
1.1171 + {
1.1172 + aDriveNumber = EDriveB;
1.1173 + }
1.1174 + else if (driveNumberStr == KDriveC)
1.1175 + {
1.1176 + aDriveNumber = EDriveC;
1.1177 + }
1.1178 + else if (driveNumberStr == KDriveD)
1.1179 + {
1.1180 + aDriveNumber = EDriveD;
1.1181 + }
1.1182 + else if (driveNumberStr == KDriveE)
1.1183 + {
1.1184 + aDriveNumber = EDriveE;
1.1185 + }
1.1186 + else if (driveNumberStr == KDriveF)
1.1187 + {
1.1188 + aDriveNumber = EDriveF;
1.1189 + }
1.1190 + else if (driveNumberStr == KDriveG)
1.1191 + {
1.1192 + aDriveNumber = EDriveG;
1.1193 + }
1.1194 + else if (driveNumberStr == KDriveH)
1.1195 + {
1.1196 + aDriveNumber = EDriveH;
1.1197 + }
1.1198 + else if (driveNumberStr == KDriveI)
1.1199 + {
1.1200 + aDriveNumber = EDriveI;
1.1201 + }
1.1202 + else if (driveNumberStr == KDriveJ)
1.1203 + {
1.1204 + aDriveNumber = EDriveJ;
1.1205 + }
1.1206 + else if (driveNumberStr == KDriveK)
1.1207 + {
1.1208 + aDriveNumber = EDriveK;
1.1209 + }
1.1210 + else if (driveNumberStr == KDriveL)
1.1211 + {
1.1212 + aDriveNumber = EDriveL;
1.1213 + }
1.1214 + else if (driveNumberStr == KDriveM)
1.1215 + {
1.1216 + aDriveNumber = EDriveM;
1.1217 + }
1.1218 + else if (driveNumberStr == KDriveN)
1.1219 + {
1.1220 + aDriveNumber = EDriveN;
1.1221 + }
1.1222 + else if (driveNumberStr == KDriveO)
1.1223 + {
1.1224 + aDriveNumber = EDriveO;
1.1225 + }
1.1226 + else if (driveNumberStr == KDriveP) // Sorry, it's a bit long. But looks nice!
1.1227 + {
1.1228 + aDriveNumber = EDriveP;
1.1229 + }
1.1230 + else if (driveNumberStr == KDriveQ)
1.1231 + {
1.1232 + aDriveNumber = EDriveQ;
1.1233 + }
1.1234 + else if (driveNumberStr == KDriveR)
1.1235 + {
1.1236 + aDriveNumber = EDriveR;
1.1237 + }
1.1238 + else if (driveNumberStr == KDriveS)
1.1239 + {
1.1240 + aDriveNumber = EDriveS;
1.1241 + }
1.1242 + else if (driveNumberStr == KDriveT)
1.1243 + {
1.1244 + aDriveNumber = EDriveT;
1.1245 + }
1.1246 + else if (driveNumberStr == KDriveU)
1.1247 + {
1.1248 + aDriveNumber = EDriveU;
1.1249 + }
1.1250 + else if (driveNumberStr == KDriveV)
1.1251 + {
1.1252 + aDriveNumber = EDriveV;
1.1253 + }
1.1254 + else if (driveNumberStr == KDriveW)
1.1255 + {
1.1256 + aDriveNumber = EDriveW;
1.1257 + }
1.1258 + else if (driveNumberStr == KDriveX)
1.1259 + {
1.1260 + aDriveNumber = EDriveX;
1.1261 + }
1.1262 + else if (driveNumberStr == KDriveY)
1.1263 + {
1.1264 + aDriveNumber = EDriveY;
1.1265 + }
1.1266 + else if (driveNumberStr == KDriveZ)
1.1267 + {
1.1268 + aDriveNumber = EDriveZ;
1.1269 + }
1.1270 + else
1.1271 + {
1.1272 + TInt driveNumber = 0;
1.1273 + ret = GET_OPTIONAL_INT_PARAMETER(aParameterName, aSection, driveNumber);
1.1274 + if (ret)
1.1275 + {
1.1276 + aDriveNumber = (TDriveNumber) driveNumber;
1.1277 + }
1.1278 + }
1.1279 + }
1.1280 +
1.1281 + return ret;
1.1282 + }
1.1283 +
1.1284 +
1.1285 +TBool CT_FsData::GetDrvMapOperationFromConfig(const TDesC& aSection, const TDesC& aParameterName, TLocalDriveMappingInfo::TDrvMapOperation& aOperation)
1.1286 +/** Reads drive mapping operation name from INI-file */
1.1287 + {
1.1288 + // Read drives mapping operation name from INI file
1.1289 + TPtrC operationStr;
1.1290 + TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, operationStr);
1.1291 + if (ret)
1.1292 + {
1.1293 + if (operationStr == KWriteMappingsAndSet)
1.1294 + {
1.1295 + aOperation = TLocalDriveMappingInfo::EWriteMappingsAndSet;
1.1296 + }
1.1297 + else if (operationStr == KWriteMappingsNoSet)
1.1298 + {
1.1299 + aOperation = TLocalDriveMappingInfo::EWriteMappingsNoSet;
1.1300 + }
1.1301 + else if (operationStr == KSwapIntMappingAndSet)
1.1302 + {
1.1303 + aOperation = TLocalDriveMappingInfo::ESwapIntMappingAndSet;
1.1304 + }
1.1305 + else
1.1306 + {
1.1307 + TInt operation = 0;
1.1308 + ret = GET_OPTIONAL_INT_PARAMETER(aParameterName, aSection, operation);
1.1309 + if (ret)
1.1310 + {
1.1311 + aOperation = (TLocalDriveMappingInfo::TDrvMapOperation) operation;
1.1312 + }
1.1313 + }
1.1314 + }
1.1315 +
1.1316 + return ret;
1.1317 + }
1.1318 +