sl@0
|
1 |
/*
|
sl@0
|
2 |
* Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
3 |
* All rights reserved.
|
sl@0
|
4 |
* This component and the accompanying materials are made available
|
sl@0
|
5 |
* under the terms of "Eclipse Public License v1.0"
|
sl@0
|
6 |
* which accompanies this distribution, and is available
|
sl@0
|
7 |
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
8 |
*
|
sl@0
|
9 |
* Initial Contributors:
|
sl@0
|
10 |
* Nokia Corporation - initial contribution.
|
sl@0
|
11 |
*
|
sl@0
|
12 |
* Contributors:
|
sl@0
|
13 |
*
|
sl@0
|
14 |
* Description:
|
sl@0
|
15 |
*
|
sl@0
|
16 |
*/
|
sl@0
|
17 |
|
sl@0
|
18 |
|
sl@0
|
19 |
/**
|
sl@0
|
20 |
@test
|
sl@0
|
21 |
@internalComponent
|
sl@0
|
22 |
|
sl@0
|
23 |
This contains CT_FsData
|
sl@0
|
24 |
*/
|
sl@0
|
25 |
|
sl@0
|
26 |
// User includes
|
sl@0
|
27 |
#include "T_FsData.h"
|
sl@0
|
28 |
|
sl@0
|
29 |
// EPOC includes
|
sl@0
|
30 |
#include <f32fsys.h>
|
sl@0
|
31 |
|
sl@0
|
32 |
/*@{*/
|
sl@0
|
33 |
/// Enumerations
|
sl@0
|
34 |
_LIT(KDriveA, "EDriveA");
|
sl@0
|
35 |
_LIT(KDriveB, "EDriveB");
|
sl@0
|
36 |
_LIT(KDriveC, "EDriveC");
|
sl@0
|
37 |
_LIT(KDriveD, "EDriveD");
|
sl@0
|
38 |
_LIT(KDriveE, "EDriveE");
|
sl@0
|
39 |
_LIT(KDriveF, "EDriveF");
|
sl@0
|
40 |
_LIT(KDriveG, "EDriveG");
|
sl@0
|
41 |
_LIT(KDriveH, "EDriveH");
|
sl@0
|
42 |
_LIT(KDriveI, "EDriveI");
|
sl@0
|
43 |
_LIT(KDriveJ, "EDriveJ");
|
sl@0
|
44 |
_LIT(KDriveK, "EDriveK");
|
sl@0
|
45 |
_LIT(KDriveL, "EDriveL");
|
sl@0
|
46 |
_LIT(KDriveM, "EDriveM");
|
sl@0
|
47 |
_LIT(KDriveN, "EDriveN");
|
sl@0
|
48 |
_LIT(KDriveO, "EDriveO");
|
sl@0
|
49 |
_LIT(KDriveP, "EDriveP");
|
sl@0
|
50 |
_LIT(KDriveQ, "EDriveQ");
|
sl@0
|
51 |
_LIT(KDriveR, "EDriveR");
|
sl@0
|
52 |
_LIT(KDriveS, "EDriveS");
|
sl@0
|
53 |
_LIT(KDriveT, "EDriveT");
|
sl@0
|
54 |
_LIT(KDriveU, "EDriveU");
|
sl@0
|
55 |
_LIT(KDriveV, "EDriveV");
|
sl@0
|
56 |
_LIT(KDriveW, "EDriveW");
|
sl@0
|
57 |
_LIT(KDriveX, "EDriveX");
|
sl@0
|
58 |
_LIT(KDriveY, "EDriveY");
|
sl@0
|
59 |
_LIT(KDriveZ, "EDriveZ");
|
sl@0
|
60 |
|
sl@0
|
61 |
_LIT(KWriteMappingsAndSet, "EWriteMappingsAndSet");
|
sl@0
|
62 |
_LIT(KWriteMappingsNoSet, "EWriteMappingsNoSet");
|
sl@0
|
63 |
_LIT(KSwapIntMappingAndSet, "ESwapIntMappingAndSet");
|
sl@0
|
64 |
|
sl@0
|
65 |
|
sl@0
|
66 |
/// Parameters
|
sl@0
|
67 |
_LIT(KDrive, "drive");
|
sl@0
|
68 |
_LIT(KDriveMappingElement, "drive_mapping_element_");
|
sl@0
|
69 |
_LIT(KDriveMappingSize, "drive_mapping_size");
|
sl@0
|
70 |
_LIT(KDriveMappingOperation, "drive_mapping_operation");
|
sl@0
|
71 |
_LIT(KFileName, "file_name");
|
sl@0
|
72 |
_LIT(KFileSystemName, "file_system_name");
|
sl@0
|
73 |
_LIT(KNewFileSystemName, "new_file_system_name");
|
sl@0
|
74 |
_LIT(KFlags, "flags");
|
sl@0
|
75 |
_LIT(KIsSync, "is_sync");
|
sl@0
|
76 |
_LIT(KExtensionName, "extension_name");
|
sl@0
|
77 |
_LIT(KPosition, "position");
|
sl@0
|
78 |
_LIT(KMode, "mode");
|
sl@0
|
79 |
_LIT(KAll, "all");
|
sl@0
|
80 |
_LIT(KCommandNum, "command_num");
|
sl@0
|
81 |
_LIT(KSaveInInstance, "save_in_instance");
|
sl@0
|
82 |
_LIT(KLocalDrive, "local_drive");
|
sl@0
|
83 |
_LIT(KCompositeDrive, "composite_drive");
|
sl@0
|
84 |
_LIT(KIsMountSuccess, "is_mount_success");
|
sl@0
|
85 |
_LIT(KParam1, "param1");
|
sl@0
|
86 |
_LIT(KParam2, "param2");
|
sl@0
|
87 |
_LIT(KIndex, "index");
|
sl@0
|
88 |
_LIT(KSubTypeName, "sub_type_name");
|
sl@0
|
89 |
|
sl@0
|
90 |
|
sl@0
|
91 |
/// Commands
|
sl@0
|
92 |
_LIT(KCmdAddFileSystem, "AddFileSystem");
|
sl@0
|
93 |
_LIT(KCmdDismountFileSystem, "DismountFileSystem");
|
sl@0
|
94 |
_LIT(KCmdFileSystemName, "FileSystemName");
|
sl@0
|
95 |
_LIT(KCmdMountFileSystem, "MountFileSystem");
|
sl@0
|
96 |
_LIT(KCmdMountFileSystemAndScan, "MountFileSystemAndScan");
|
sl@0
|
97 |
_LIT(KCmdRemountDrive, "RemountDrive");
|
sl@0
|
98 |
_LIT(KCmdRemoveFileSystem, "RemoveFileSystem");
|
sl@0
|
99 |
_LIT(KCmdAddExtension, "AddExtension");
|
sl@0
|
100 |
_LIT(KCmdMountExtension, "MountExtension");
|
sl@0
|
101 |
_LIT(KCmdRemoveExtension, "RemoveExtension");
|
sl@0
|
102 |
_LIT(KCmdExtensionName, "ExtensionName");
|
sl@0
|
103 |
_LIT(KCmdAddCompositeMount, "AddCompositeMount");
|
sl@0
|
104 |
_LIT(KCmdAllowDismount, "AllowDismount");
|
sl@0
|
105 |
_LIT(KCmdNotifyDismount, "NotifyDismount");
|
sl@0
|
106 |
_LIT(KCmdNotifyDismountCancel, "NotifyDismountCancel");
|
sl@0
|
107 |
_LIT(KCmdStartupInitComplete, "StartupInitComplete");
|
sl@0
|
108 |
_LIT(KCmdSwapFileSystem, "SwapFileSystem");
|
sl@0
|
109 |
_LIT(KCmdSetStartupConfiguration, "SetStartupConfiguration");
|
sl@0
|
110 |
_LIT(KCmdDismountExtension, "DismountExtension");
|
sl@0
|
111 |
_LIT(KCmdSetLocalDriveMapping, "SetLocalDriveMapping");
|
sl@0
|
112 |
_LIT(KCmdFinaliseDrives, "FinaliseDrives");
|
sl@0
|
113 |
_LIT(KCmdFileSystemSubType, "FileSystemSubType");
|
sl@0
|
114 |
/*@}*/
|
sl@0
|
115 |
|
sl@0
|
116 |
|
sl@0
|
117 |
TBool CT_FsData::DoCommandMountsL(const TTEFFunction& aCommand, const TTEFSectionName& aSection, const TInt aAsyncErrorIndex)
|
sl@0
|
118 |
/**
|
sl@0
|
119 |
* Process a mounts related command read from the ini file
|
sl@0
|
120 |
*
|
sl@0
|
121 |
* @param aCommand the command to process
|
sl@0
|
122 |
* @param aSection the entry in the ini file requiring the command to be processed
|
sl@0
|
123 |
*
|
sl@0
|
124 |
* @return ETrue if the command is processed
|
sl@0
|
125 |
*/
|
sl@0
|
126 |
{
|
sl@0
|
127 |
TBool retVal = ETrue;
|
sl@0
|
128 |
|
sl@0
|
129 |
if (aCommand == KCmdAddFileSystem)
|
sl@0
|
130 |
{
|
sl@0
|
131 |
DoCmdAddFileSystem(aSection);
|
sl@0
|
132 |
}
|
sl@0
|
133 |
else if (aCommand == KCmdDismountFileSystem)
|
sl@0
|
134 |
{
|
sl@0
|
135 |
DoCmdDismountFileSystem(aSection);
|
sl@0
|
136 |
}
|
sl@0
|
137 |
else if (aCommand == KCmdFileSystemName)
|
sl@0
|
138 |
{
|
sl@0
|
139 |
DoCmdFileSystemName(aSection);
|
sl@0
|
140 |
}
|
sl@0
|
141 |
else if (aCommand == KCmdMountFileSystem)
|
sl@0
|
142 |
{
|
sl@0
|
143 |
DoCmdMountFileSystem(aSection);
|
sl@0
|
144 |
}
|
sl@0
|
145 |
else if (aCommand == KCmdMountFileSystemAndScan)
|
sl@0
|
146 |
{
|
sl@0
|
147 |
DoCmdMountFileSystemAndScan(aSection);
|
sl@0
|
148 |
}
|
sl@0
|
149 |
else if (aCommand == KCmdRemoveFileSystem)
|
sl@0
|
150 |
{
|
sl@0
|
151 |
DoCmdRemoveFileSystem(aSection);
|
sl@0
|
152 |
}
|
sl@0
|
153 |
else if (aCommand == KCmdRemountDrive)
|
sl@0
|
154 |
{
|
sl@0
|
155 |
DoCmdRemountDriveL(aSection);
|
sl@0
|
156 |
}
|
sl@0
|
157 |
else if (aCommand == KCmdAddExtension)
|
sl@0
|
158 |
{
|
sl@0
|
159 |
DoCmdAddExtension(aSection);
|
sl@0
|
160 |
}
|
sl@0
|
161 |
else if (aCommand == KCmdRemoveExtension)
|
sl@0
|
162 |
{
|
sl@0
|
163 |
DoCmdRemoveExtension(aSection);
|
sl@0
|
164 |
}
|
sl@0
|
165 |
else if (aCommand == KCmdExtensionName)
|
sl@0
|
166 |
{
|
sl@0
|
167 |
DoCmdExtensionName(aSection);
|
sl@0
|
168 |
}
|
sl@0
|
169 |
else if (aCommand == KCmdMountExtension)
|
sl@0
|
170 |
{
|
sl@0
|
171 |
DoCmdMountExtension(aSection);
|
sl@0
|
172 |
}
|
sl@0
|
173 |
else if (aCommand == KCmdAllowDismount)
|
sl@0
|
174 |
{
|
sl@0
|
175 |
DoCmdAllowDismount(aSection);
|
sl@0
|
176 |
}
|
sl@0
|
177 |
else if (aCommand == KCmdNotifyDismount)
|
sl@0
|
178 |
{
|
sl@0
|
179 |
DoCmdNotifyDismountL(aSection, aAsyncErrorIndex);
|
sl@0
|
180 |
}
|
sl@0
|
181 |
else if (aCommand == KCmdNotifyDismountCancel)
|
sl@0
|
182 |
{
|
sl@0
|
183 |
DoCmdNotifyDismountCancel(aSection);
|
sl@0
|
184 |
}
|
sl@0
|
185 |
else if (aCommand == KCmdStartupInitComplete)
|
sl@0
|
186 |
{
|
sl@0
|
187 |
DoCmdStartupInitCompleteL(aAsyncErrorIndex);
|
sl@0
|
188 |
}
|
sl@0
|
189 |
else if (aCommand == KCmdSwapFileSystem)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
DoCmdSwapFileSystem(aSection);
|
sl@0
|
192 |
}
|
sl@0
|
193 |
else if (aCommand == KCmdSetStartupConfiguration)
|
sl@0
|
194 |
{
|
sl@0
|
195 |
DoCmdSetStartupConfigurationL(aSection);
|
sl@0
|
196 |
}
|
sl@0
|
197 |
else if (aCommand == KCmdFinaliseDrives)
|
sl@0
|
198 |
{
|
sl@0
|
199 |
DoCmdFinaliseDrives();
|
sl@0
|
200 |
}
|
sl@0
|
201 |
else if (aCommand == KCmdAddCompositeMount)
|
sl@0
|
202 |
{
|
sl@0
|
203 |
DoCmdAddCompositeMount(aSection);
|
sl@0
|
204 |
}
|
sl@0
|
205 |
else if (aCommand == KCmdDismountExtension)
|
sl@0
|
206 |
{
|
sl@0
|
207 |
DoCmdDismountExtension(aSection);
|
sl@0
|
208 |
}
|
sl@0
|
209 |
else if (aCommand == KCmdSetLocalDriveMapping)
|
sl@0
|
210 |
{
|
sl@0
|
211 |
DoCmdSetLocalDriveMappingL(aSection);
|
sl@0
|
212 |
}
|
sl@0
|
213 |
else if (aCommand == KCmdFileSystemSubType)
|
sl@0
|
214 |
{
|
sl@0
|
215 |
DoCmdFileSystemSubType(aSection);
|
sl@0
|
216 |
}
|
sl@0
|
217 |
else
|
sl@0
|
218 |
{
|
sl@0
|
219 |
retVal = EFalse;
|
sl@0
|
220 |
}
|
sl@0
|
221 |
|
sl@0
|
222 |
return retVal;
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
|
sl@0
|
226 |
void CT_FsData::DoCmdAddFileSystem(const TDesC& aSection)
|
sl@0
|
227 |
/** Calls RFs::AddFileSystem() */
|
sl@0
|
228 |
{
|
sl@0
|
229 |
INFO_PRINTF1(_L("Calls RFs::AddFileSystem()"));
|
sl@0
|
230 |
|
sl@0
|
231 |
// get file name from parameters
|
sl@0
|
232 |
TPtrC fileName;
|
sl@0
|
233 |
if ( GET_MANDATORY_STRING_PARAMETER(KFileName(), aSection, fileName))
|
sl@0
|
234 |
{
|
sl@0
|
235 |
// call AddFileSystem()
|
sl@0
|
236 |
TInt err = iFs->AddFileSystem(fileName);
|
sl@0
|
237 |
|
sl@0
|
238 |
// check error code
|
sl@0
|
239 |
if (err != KErrNone)
|
sl@0
|
240 |
{
|
sl@0
|
241 |
ERR_PRINTF2(_L("AddFileSystem error: %d"), err);
|
sl@0
|
242 |
SetError(err);
|
sl@0
|
243 |
}
|
sl@0
|
244 |
}
|
sl@0
|
245 |
}
|
sl@0
|
246 |
|
sl@0
|
247 |
void CT_FsData::DoCmdMountFileSystem(const TDesC& aSection)
|
sl@0
|
248 |
/** Calls RFs::MountFileSystem() */
|
sl@0
|
249 |
{
|
sl@0
|
250 |
INFO_PRINTF1(_L("Calls RFs::MountFileSystem()"));
|
sl@0
|
251 |
|
sl@0
|
252 |
TBool dataOk = ETrue;
|
sl@0
|
253 |
|
sl@0
|
254 |
// get drive number from parameters
|
sl@0
|
255 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
256 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
257 |
{
|
sl@0
|
258 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
259 |
SetBlockResult(EFail);
|
sl@0
|
260 |
dataOk = EFalse;
|
sl@0
|
261 |
}
|
sl@0
|
262 |
|
sl@0
|
263 |
// get file system name from parameters
|
sl@0
|
264 |
TPtrC fileSystemName;
|
sl@0
|
265 |
if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
|
sl@0
|
266 |
{
|
sl@0
|
267 |
fileSystemName.Set(iFileSystemName);
|
sl@0
|
268 |
}
|
sl@0
|
269 |
|
sl@0
|
270 |
if(dataOk)
|
sl@0
|
271 |
{
|
sl@0
|
272 |
// get file system name from parameters
|
sl@0
|
273 |
TBool isSync = EFalse;
|
sl@0
|
274 |
TInt err = KErrNone;
|
sl@0
|
275 |
|
sl@0
|
276 |
TPtrC extensionName;
|
sl@0
|
277 |
TBool hasExtensionName=GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extensionName);
|
sl@0
|
278 |
if (GET_OPTIONAL_BOOL_PARAMETER(KIsSync(), aSection, isSync))
|
sl@0
|
279 |
{
|
sl@0
|
280 |
if ( hasExtensionName )
|
sl@0
|
281 |
{
|
sl@0
|
282 |
// call MountFileSystem()
|
sl@0
|
283 |
INFO_PRINTF5(_L("MountFileSystem(%S, %S, %d, %d)"), &fileSystemName, &extensionName, driveNumber, isSync);
|
sl@0
|
284 |
err = iFs->MountFileSystem(fileSystemName, extensionName, driveNumber, isSync);
|
sl@0
|
285 |
}
|
sl@0
|
286 |
else
|
sl@0
|
287 |
{
|
sl@0
|
288 |
// call MountFileSystem()
|
sl@0
|
289 |
INFO_PRINTF4(_L("MountFileSystem(%S, %d, %d)"), &fileSystemName, driveNumber, isSync);
|
sl@0
|
290 |
err = iFs->MountFileSystem(fileSystemName, driveNumber, isSync);
|
sl@0
|
291 |
}
|
sl@0
|
292 |
}
|
sl@0
|
293 |
else
|
sl@0
|
294 |
{
|
sl@0
|
295 |
if ( hasExtensionName )
|
sl@0
|
296 |
{
|
sl@0
|
297 |
// call MountFileSystem()
|
sl@0
|
298 |
INFO_PRINTF4(_L("MountFileSystem(%S, %S, %d)"), &fileSystemName, &extensionName, driveNumber);
|
sl@0
|
299 |
err = iFs->MountFileSystem(fileSystemName, extensionName, driveNumber);
|
sl@0
|
300 |
}
|
sl@0
|
301 |
else
|
sl@0
|
302 |
{
|
sl@0
|
303 |
// call MountFileSystem()
|
sl@0
|
304 |
INFO_PRINTF3(_L("MountFileSystem(%S, %d)"), &fileSystemName, driveNumber);
|
sl@0
|
305 |
err = iFs->MountFileSystem(fileSystemName, driveNumber);
|
sl@0
|
306 |
}
|
sl@0
|
307 |
}
|
sl@0
|
308 |
// check error code
|
sl@0
|
309 |
if (err != KErrNone)
|
sl@0
|
310 |
{
|
sl@0
|
311 |
ERR_PRINTF2(_L("MountFileSystem error: %d"), err);
|
sl@0
|
312 |
SetError(err);
|
sl@0
|
313 |
}
|
sl@0
|
314 |
}
|
sl@0
|
315 |
}
|
sl@0
|
316 |
|
sl@0
|
317 |
|
sl@0
|
318 |
void CT_FsData::DoCmdMountFileSystemAndScan(const TDesC& aSection)
|
sl@0
|
319 |
/** Calls RFs::MountFileSystemAndScan() */
|
sl@0
|
320 |
{
|
sl@0
|
321 |
INFO_PRINTF1(_L("Calls RFs::MountFileSystemAndScan()"));
|
sl@0
|
322 |
|
sl@0
|
323 |
TBool dataOk = ETrue;
|
sl@0
|
324 |
|
sl@0
|
325 |
// get drive number from parameters
|
sl@0
|
326 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
327 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
328 |
{
|
sl@0
|
329 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
330 |
SetBlockResult(EFail);
|
sl@0
|
331 |
dataOk = EFalse;
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
// get file system name from parameters
|
sl@0
|
335 |
TPtrC fileSystemName;
|
sl@0
|
336 |
if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
|
sl@0
|
337 |
{
|
sl@0
|
338 |
fileSystemName.Set(iFileSystemName);
|
sl@0
|
339 |
}
|
sl@0
|
340 |
|
sl@0
|
341 |
if(dataOk)
|
sl@0
|
342 |
{
|
sl@0
|
343 |
TInt err=KErrNone;
|
sl@0
|
344 |
TBool isMountSuccess = EFalse;
|
sl@0
|
345 |
// get extension name from parameters
|
sl@0
|
346 |
TPtrC extensionName;
|
sl@0
|
347 |
if (GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
|
sl@0
|
348 |
{
|
sl@0
|
349 |
//call MountFileSystemAndScan
|
sl@0
|
350 |
INFO_PRINTF4(_L("MountFileSystemAndScan(%S, %S, %d, isMountSuccess)"), &fileSystemName, &extensionName, driveNumber);
|
sl@0
|
351 |
err = iFs->MountFileSystemAndScan(fileSystemName, extensionName, driveNumber, isMountSuccess);
|
sl@0
|
352 |
}
|
sl@0
|
353 |
else
|
sl@0
|
354 |
{
|
sl@0
|
355 |
//call MountFileSystemAndScan
|
sl@0
|
356 |
INFO_PRINTF3(_L("MountFileSystemAndScan(%S, %d, isMountSuccess)"), &fileSystemName, driveNumber);
|
sl@0
|
357 |
err = iFs->MountFileSystemAndScan(fileSystemName, driveNumber, isMountSuccess);
|
sl@0
|
358 |
}
|
sl@0
|
359 |
|
sl@0
|
360 |
// check error code
|
sl@0
|
361 |
if (err != KErrNone)
|
sl@0
|
362 |
{
|
sl@0
|
363 |
ERR_PRINTF2(_L("MountFileSystemAndScan error: %d"), err);
|
sl@0
|
364 |
SetError(err);
|
sl@0
|
365 |
}
|
sl@0
|
366 |
|
sl@0
|
367 |
//Only for info
|
sl@0
|
368 |
if(isMountSuccess)
|
sl@0
|
369 |
{
|
sl@0
|
370 |
INFO_PRINTF1(_L("MountFileSystemAndScan() successfully mounted"));
|
sl@0
|
371 |
}
|
sl@0
|
372 |
else
|
sl@0
|
373 |
{
|
sl@0
|
374 |
INFO_PRINTF1(_L("MountFileSystemAndScan() not mounted"));
|
sl@0
|
375 |
}
|
sl@0
|
376 |
|
sl@0
|
377 |
//check if mount was successful
|
sl@0
|
378 |
TBool expected = EFalse;
|
sl@0
|
379 |
if ( GET_OPTIONAL_BOOL_PARAMETER(KIsMountSuccess(), aSection, expected) )
|
sl@0
|
380 |
{
|
sl@0
|
381 |
if ( isMountSuccess!=expected )
|
sl@0
|
382 |
{
|
sl@0
|
383 |
ERR_PRINTF1(_L("MountFileSystemAndScan() does not match expected value"));
|
sl@0
|
384 |
SetBlockResult(EFail);
|
sl@0
|
385 |
}
|
sl@0
|
386 |
}
|
sl@0
|
387 |
}
|
sl@0
|
388 |
}
|
sl@0
|
389 |
|
sl@0
|
390 |
|
sl@0
|
391 |
void CT_FsData::DoCmdDismountFileSystem(const TDesC& aSection)
|
sl@0
|
392 |
/** Calls RFs::DismountFileSystem() */
|
sl@0
|
393 |
{
|
sl@0
|
394 |
INFO_PRINTF1(_L("Calls RFs::DismountFileSystem()"));
|
sl@0
|
395 |
|
sl@0
|
396 |
TBool dataOk = ETrue;
|
sl@0
|
397 |
|
sl@0
|
398 |
// get drive number from parameters
|
sl@0
|
399 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
400 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
401 |
{
|
sl@0
|
402 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
403 |
SetBlockResult(EFail);
|
sl@0
|
404 |
dataOk = EFalse;
|
sl@0
|
405 |
}
|
sl@0
|
406 |
// get file system name from parameters
|
sl@0
|
407 |
TPtrC fileSystemName;
|
sl@0
|
408 |
if (!GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName))
|
sl@0
|
409 |
{
|
sl@0
|
410 |
fileSystemName.Set(iFileSystemName);
|
sl@0
|
411 |
}
|
sl@0
|
412 |
|
sl@0
|
413 |
if(dataOk)
|
sl@0
|
414 |
{
|
sl@0
|
415 |
// call DismountFileSystem()
|
sl@0
|
416 |
TInt err = iFs->DismountFileSystem(fileSystemName, driveNumber);
|
sl@0
|
417 |
|
sl@0
|
418 |
// check error code
|
sl@0
|
419 |
if (err != KErrNone)
|
sl@0
|
420 |
{
|
sl@0
|
421 |
ERR_PRINTF2(_L("DismountFileSystem error: %d"), err);
|
sl@0
|
422 |
SetError(err);
|
sl@0
|
423 |
}
|
sl@0
|
424 |
}
|
sl@0
|
425 |
}
|
sl@0
|
426 |
|
sl@0
|
427 |
|
sl@0
|
428 |
void CT_FsData::DoCmdRemoveFileSystem(const TDesC& aSection)
|
sl@0
|
429 |
/** Calls RFs::RemoveFileSystem() */
|
sl@0
|
430 |
{
|
sl@0
|
431 |
INFO_PRINTF1(_L("Calls RFs::RemoveFileSystem()"));
|
sl@0
|
432 |
|
sl@0
|
433 |
// get file name from parameters
|
sl@0
|
434 |
TPtrC fileSystemName;
|
sl@0
|
435 |
if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
|
sl@0
|
436 |
{
|
sl@0
|
437 |
fileSystemName.Set(iFileSystemName);
|
sl@0
|
438 |
}
|
sl@0
|
439 |
|
sl@0
|
440 |
// call RemoveFileSystem()
|
sl@0
|
441 |
TInt err = iFs->RemoveFileSystem(fileSystemName);
|
sl@0
|
442 |
|
sl@0
|
443 |
// check error code
|
sl@0
|
444 |
if (err != KErrNone)
|
sl@0
|
445 |
{
|
sl@0
|
446 |
ERR_PRINTF2(_L("RemoveFileSystem error: %d"), err);
|
sl@0
|
447 |
SetError(err);
|
sl@0
|
448 |
}
|
sl@0
|
449 |
}
|
sl@0
|
450 |
|
sl@0
|
451 |
|
sl@0
|
452 |
void CT_FsData::DoCmdFileSystemName(const TDesC& aSection)
|
sl@0
|
453 |
/** Calls RFs::FileSystemName() */
|
sl@0
|
454 |
{
|
sl@0
|
455 |
INFO_PRINTF1(_L("Calls RFs::FileSystemName()"));
|
sl@0
|
456 |
|
sl@0
|
457 |
// get a flag if we need to remember the file system name in an instance variable
|
sl@0
|
458 |
TBool save=ETrue;
|
sl@0
|
459 |
GET_OPTIONAL_BOOL_PARAMETER(KSaveInInstance(), aSection, save);
|
sl@0
|
460 |
|
sl@0
|
461 |
// get drive number from parameters
|
sl@0
|
462 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
463 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
464 |
{
|
sl@0
|
465 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
466 |
SetBlockResult(EFail);
|
sl@0
|
467 |
}
|
sl@0
|
468 |
else
|
sl@0
|
469 |
{
|
sl@0
|
470 |
// call FileSystemName()
|
sl@0
|
471 |
TFullName fileSystemName;
|
sl@0
|
472 |
TInt err = iFs->FileSystemName(fileSystemName, driveNumber);
|
sl@0
|
473 |
INFO_PRINTF2(_L("File system name: %S"), &fileSystemName);
|
sl@0
|
474 |
|
sl@0
|
475 |
// check error code
|
sl@0
|
476 |
if (err == KErrNone)
|
sl@0
|
477 |
{
|
sl@0
|
478 |
if ( save )
|
sl@0
|
479 |
{
|
sl@0
|
480 |
iFileSystemName=fileSystemName;
|
sl@0
|
481 |
}
|
sl@0
|
482 |
}
|
sl@0
|
483 |
else
|
sl@0
|
484 |
{
|
sl@0
|
485 |
ERR_PRINTF2(_L("FileSystemName error: %d"), err);
|
sl@0
|
486 |
SetError(err);
|
sl@0
|
487 |
}
|
sl@0
|
488 |
|
sl@0
|
489 |
//Check expected result
|
sl@0
|
490 |
TPtrC fsNameExpect;
|
sl@0
|
491 |
if (GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fsNameExpect))
|
sl@0
|
492 |
{
|
sl@0
|
493 |
if ( fsNameExpect != fileSystemName)
|
sl@0
|
494 |
{
|
sl@0
|
495 |
ERR_PRINTF1(_L("File system name != expected name"));
|
sl@0
|
496 |
SetBlockResult(EFail);
|
sl@0
|
497 |
}
|
sl@0
|
498 |
}
|
sl@0
|
499 |
}
|
sl@0
|
500 |
}
|
sl@0
|
501 |
|
sl@0
|
502 |
|
sl@0
|
503 |
void CT_FsData::DoCmdAddExtension(const TDesC& aSection)
|
sl@0
|
504 |
/** Calls RFs::AddExtension() */
|
sl@0
|
505 |
{
|
sl@0
|
506 |
INFO_PRINTF1(_L("Calls RFs::AddExtension()"));
|
sl@0
|
507 |
TPtrC fileName;
|
sl@0
|
508 |
if ( GET_MANDATORY_STRING_PARAMETER(KFileName(), aSection, fileName) )
|
sl@0
|
509 |
{
|
sl@0
|
510 |
//call AddExtension
|
sl@0
|
511 |
TInt err = iFs->AddExtension(fileName);
|
sl@0
|
512 |
|
sl@0
|
513 |
// check error code
|
sl@0
|
514 |
if (err != KErrNone)
|
sl@0
|
515 |
{
|
sl@0
|
516 |
ERR_PRINTF2(_L("AddExtension error: %d"), err);
|
sl@0
|
517 |
SetError(err);
|
sl@0
|
518 |
}
|
sl@0
|
519 |
}
|
sl@0
|
520 |
}
|
sl@0
|
521 |
|
sl@0
|
522 |
|
sl@0
|
523 |
void CT_FsData::DoCmdMountExtension(const TDesC& aSection)
|
sl@0
|
524 |
/** Calls RFs::MountExtension() */
|
sl@0
|
525 |
{
|
sl@0
|
526 |
INFO_PRINTF1(_L("Calls RFs::MountExtension()"));
|
sl@0
|
527 |
|
sl@0
|
528 |
TBool dataOk = ETrue;
|
sl@0
|
529 |
|
sl@0
|
530 |
// get drive number from parameters
|
sl@0
|
531 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
532 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
533 |
{
|
sl@0
|
534 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
535 |
SetBlockResult(EFail);
|
sl@0
|
536 |
dataOk = EFalse;
|
sl@0
|
537 |
}
|
sl@0
|
538 |
|
sl@0
|
539 |
// get extension name from parameters
|
sl@0
|
540 |
TPtrC extensionName;
|
sl@0
|
541 |
if (!GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
|
sl@0
|
542 |
{
|
sl@0
|
543 |
dataOk = EFalse;
|
sl@0
|
544 |
}
|
sl@0
|
545 |
|
sl@0
|
546 |
if(dataOk)
|
sl@0
|
547 |
{
|
sl@0
|
548 |
TInt err = iFs->MountExtension(extensionName, driveNumber);
|
sl@0
|
549 |
if (err != KErrNone)
|
sl@0
|
550 |
{
|
sl@0
|
551 |
ERR_PRINTF2(_L("MountExtension error: %d"), err);
|
sl@0
|
552 |
SetError(err);
|
sl@0
|
553 |
}
|
sl@0
|
554 |
}
|
sl@0
|
555 |
}
|
sl@0
|
556 |
|
sl@0
|
557 |
void CT_FsData::DoCmdDismountExtension(const TDesC& aSection)
|
sl@0
|
558 |
/** Calls RFs::DismountExtension() */
|
sl@0
|
559 |
{
|
sl@0
|
560 |
INFO_PRINTF1(_L("Calls RFs::DismountExtension()"));
|
sl@0
|
561 |
|
sl@0
|
562 |
TBool dataOk = ETrue;
|
sl@0
|
563 |
|
sl@0
|
564 |
// get drive number from parameters
|
sl@0
|
565 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
566 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
567 |
{
|
sl@0
|
568 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
569 |
SetBlockResult(EFail);
|
sl@0
|
570 |
dataOk = EFalse;
|
sl@0
|
571 |
}
|
sl@0
|
572 |
|
sl@0
|
573 |
TPtrC extensionName;
|
sl@0
|
574 |
if (!GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
|
sl@0
|
575 |
{
|
sl@0
|
576 |
dataOk = EFalse;
|
sl@0
|
577 |
}
|
sl@0
|
578 |
if(dataOk)
|
sl@0
|
579 |
{
|
sl@0
|
580 |
//call DismountExtension
|
sl@0
|
581 |
TInt err = iFs->DismountExtension(extensionName, driveNumber);
|
sl@0
|
582 |
|
sl@0
|
583 |
//check error code
|
sl@0
|
584 |
if (err != KErrNone)
|
sl@0
|
585 |
{
|
sl@0
|
586 |
ERR_PRINTF2(_L("DismountExtension error: %d"), err);
|
sl@0
|
587 |
SetError(err);
|
sl@0
|
588 |
}
|
sl@0
|
589 |
}
|
sl@0
|
590 |
|
sl@0
|
591 |
}
|
sl@0
|
592 |
|
sl@0
|
593 |
|
sl@0
|
594 |
void CT_FsData::DoCmdRemoveExtension(const TDesC& aSection)
|
sl@0
|
595 |
/** Calls RFs::RemoveExtension() */
|
sl@0
|
596 |
{
|
sl@0
|
597 |
INFO_PRINTF1(_L("Calls RFs::RemoveExtension()"));
|
sl@0
|
598 |
|
sl@0
|
599 |
TPtrC extensionName;
|
sl@0
|
600 |
if (GET_MANDATORY_STRING_PARAMETER(KExtensionName(), aSection, extensionName))
|
sl@0
|
601 |
{
|
sl@0
|
602 |
//call RemoveExtension
|
sl@0
|
603 |
TInt err = iFs->RemoveExtension(extensionName);
|
sl@0
|
604 |
|
sl@0
|
605 |
// check error code
|
sl@0
|
606 |
if (err != KErrNone)
|
sl@0
|
607 |
{
|
sl@0
|
608 |
ERR_PRINTF2(_L("RemoveExtension error: %d"), err);
|
sl@0
|
609 |
SetError(err);
|
sl@0
|
610 |
}
|
sl@0
|
611 |
}
|
sl@0
|
612 |
}
|
sl@0
|
613 |
|
sl@0
|
614 |
|
sl@0
|
615 |
void CT_FsData::DoCmdExtensionName(const TDesC& aSection)
|
sl@0
|
616 |
/** Calls RFs::ExtensionName() */
|
sl@0
|
617 |
{
|
sl@0
|
618 |
INFO_PRINTF1(_L("Calls RFs::ExtensionName()"));
|
sl@0
|
619 |
|
sl@0
|
620 |
TBool dataOk = ETrue;
|
sl@0
|
621 |
|
sl@0
|
622 |
// get drive number from parameters
|
sl@0
|
623 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
624 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
625 |
{
|
sl@0
|
626 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
627 |
SetBlockResult(EFail);
|
sl@0
|
628 |
dataOk = EFalse;
|
sl@0
|
629 |
}
|
sl@0
|
630 |
//get position of the extension in the extension hierarchy.
|
sl@0
|
631 |
TInt pos = 0;
|
sl@0
|
632 |
if (!GET_MANDATORY_INT_PARAMETER(KPosition(), aSection, pos))
|
sl@0
|
633 |
{
|
sl@0
|
634 |
dataOk = EFalse;
|
sl@0
|
635 |
}
|
sl@0
|
636 |
|
sl@0
|
637 |
if(dataOk)
|
sl@0
|
638 |
{
|
sl@0
|
639 |
|
sl@0
|
640 |
TInt err = iFs->ExtensionName(iExtensionName, driveNumber, pos);
|
sl@0
|
641 |
|
sl@0
|
642 |
if(err == KErrNone)
|
sl@0
|
643 |
{
|
sl@0
|
644 |
TPtrC extNameExpect;
|
sl@0
|
645 |
if (GET_OPTIONAL_STRING_PARAMETER(KExtensionName(), aSection, extNameExpect))
|
sl@0
|
646 |
{
|
sl@0
|
647 |
if(extNameExpect != iExtensionName)
|
sl@0
|
648 |
{
|
sl@0
|
649 |
ERR_PRINTF3(_L("ExtensionName: %S != %S expected name"), &iExtensionName, &extNameExpect);
|
sl@0
|
650 |
SetBlockResult(EFail);
|
sl@0
|
651 |
}
|
sl@0
|
652 |
else
|
sl@0
|
653 |
{
|
sl@0
|
654 |
INFO_PRINTF2(_L("ExtensionName: %S"), &iExtensionName);
|
sl@0
|
655 |
}
|
sl@0
|
656 |
}
|
sl@0
|
657 |
else
|
sl@0
|
658 |
{
|
sl@0
|
659 |
INFO_PRINTF2(_L("ExtensionName: %S"), &iExtensionName);
|
sl@0
|
660 |
}
|
sl@0
|
661 |
}
|
sl@0
|
662 |
// check error code
|
sl@0
|
663 |
else
|
sl@0
|
664 |
{
|
sl@0
|
665 |
ERR_PRINTF2(_L("ExtensionName error: %d"), err);
|
sl@0
|
666 |
SetError(err);
|
sl@0
|
667 |
}
|
sl@0
|
668 |
}
|
sl@0
|
669 |
}
|
sl@0
|
670 |
|
sl@0
|
671 |
|
sl@0
|
672 |
void CT_FsData::DoCmdRemountDriveL(const TDesC& aSection)
|
sl@0
|
673 |
/** Calls RFs::RemountDrive() */
|
sl@0
|
674 |
{
|
sl@0
|
675 |
INFO_PRINTF1(_L("Calls RFs::RemountDrive()"));
|
sl@0
|
676 |
TBool dataOk = ETrue;
|
sl@0
|
677 |
|
sl@0
|
678 |
// get drive number from parameters
|
sl@0
|
679 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
680 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
681 |
{
|
sl@0
|
682 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
683 |
SetBlockResult(EFail);
|
sl@0
|
684 |
dataOk = EFalse;
|
sl@0
|
685 |
}
|
sl@0
|
686 |
|
sl@0
|
687 |
// get flags from parameters can be in hex(0x00000001) or in decimal(1)
|
sl@0
|
688 |
TUint flags = 0;
|
sl@0
|
689 |
TInt tempVal = 0;
|
sl@0
|
690 |
|
sl@0
|
691 |
if(GetHexFromConfig(aSection, KFlags, tempVal))
|
sl@0
|
692 |
{
|
sl@0
|
693 |
flags = tempVal;
|
sl@0
|
694 |
}
|
sl@0
|
695 |
else if(GET_OPTIONAL_INT_PARAMETER(KFlags(), aSection, tempVal))
|
sl@0
|
696 |
{
|
sl@0
|
697 |
flags = tempVal;
|
sl@0
|
698 |
}
|
sl@0
|
699 |
else
|
sl@0
|
700 |
{
|
sl@0
|
701 |
ERR_PRINTF2(_L("No parameter %S"), &KFlags());
|
sl@0
|
702 |
SetBlockResult(EFail);
|
sl@0
|
703 |
dataOk = EFalse;
|
sl@0
|
704 |
}
|
sl@0
|
705 |
|
sl@0
|
706 |
RFile file;
|
sl@0
|
707 |
HBufC8* fileDataBuff = NULL;
|
sl@0
|
708 |
|
sl@0
|
709 |
// get file name from parameters
|
sl@0
|
710 |
TPtrC fileName;
|
sl@0
|
711 |
TBool useMountInfo = GET_OPTIONAL_STRING_PARAMETER(KFileName(), aSection, fileName);
|
sl@0
|
712 |
if ( useMountInfo )
|
sl@0
|
713 |
{
|
sl@0
|
714 |
// open file
|
sl@0
|
715 |
TInt error = file.Open(FileServer(), fileName, EFileRead | EFileShareAny);
|
sl@0
|
716 |
if(error == KErrNone)
|
sl@0
|
717 |
{
|
sl@0
|
718 |
CleanupClosePushL(file);
|
sl@0
|
719 |
INFO_PRINTF1(_L("File Opened."));
|
sl@0
|
720 |
// get size
|
sl@0
|
721 |
TInt size = 0;
|
sl@0
|
722 |
error = file.Size(size);
|
sl@0
|
723 |
INFO_PRINTF2(_L("File Size=%d."), size);
|
sl@0
|
724 |
if(error == KErrNone)
|
sl@0
|
725 |
{
|
sl@0
|
726 |
// read file
|
sl@0
|
727 |
fileDataBuff = HBufC8::NewL(size);
|
sl@0
|
728 |
INFO_PRINTF1(_L("Buffer created."));
|
sl@0
|
729 |
|
sl@0
|
730 |
CleanupStack::PushL(fileDataBuff);
|
sl@0
|
731 |
TPtr8 fileData = fileDataBuff->Des();
|
sl@0
|
732 |
error = file.Read(fileData);
|
sl@0
|
733 |
if(error != KErrNone)
|
sl@0
|
734 |
{
|
sl@0
|
735 |
ERR_PRINTF2(_L("Reading File, Error: %d"), error);
|
sl@0
|
736 |
dataOk = EFalse;
|
sl@0
|
737 |
SetBlockResult(EFail);
|
sl@0
|
738 |
}
|
sl@0
|
739 |
}
|
sl@0
|
740 |
else
|
sl@0
|
741 |
{
|
sl@0
|
742 |
ERR_PRINTF2(_L("File Size, Error: %d."), error);
|
sl@0
|
743 |
dataOk = EFalse;
|
sl@0
|
744 |
SetBlockResult(EFail);
|
sl@0
|
745 |
}
|
sl@0
|
746 |
}
|
sl@0
|
747 |
else
|
sl@0
|
748 |
{
|
sl@0
|
749 |
ERR_PRINTF2(_L("File Open, Error: %d"), error);
|
sl@0
|
750 |
dataOk = EFalse;
|
sl@0
|
751 |
SetBlockResult(EFail);
|
sl@0
|
752 |
}
|
sl@0
|
753 |
}
|
sl@0
|
754 |
|
sl@0
|
755 |
if ( dataOk )
|
sl@0
|
756 |
{
|
sl@0
|
757 |
// call RemountDrive()
|
sl@0
|
758 |
TInt err = iFs->RemountDrive(driveNumber, fileDataBuff, flags);
|
sl@0
|
759 |
INFO_PRINTF2(_L("RemountDrive Flags: %u"), flags);
|
sl@0
|
760 |
|
sl@0
|
761 |
// check error code
|
sl@0
|
762 |
if (err != KErrNone)
|
sl@0
|
763 |
{
|
sl@0
|
764 |
ERR_PRINTF2(_L("RemountDrive error: %d"), err);
|
sl@0
|
765 |
SetError(err);
|
sl@0
|
766 |
}
|
sl@0
|
767 |
}
|
sl@0
|
768 |
|
sl@0
|
769 |
// cleanup if mountInfo was used
|
sl@0
|
770 |
if (useMountInfo)
|
sl@0
|
771 |
{
|
sl@0
|
772 |
CleanupStack::PopAndDestroy(2, &file); // file, fileDataBuff
|
sl@0
|
773 |
}
|
sl@0
|
774 |
|
sl@0
|
775 |
}
|
sl@0
|
776 |
|
sl@0
|
777 |
|
sl@0
|
778 |
void CT_FsData::DoCmdNotifyDismountL(const TDesC& aSection, const TInt aAsyncErrorIndex)
|
sl@0
|
779 |
/** Calls RFs::NotifyDismount() */
|
sl@0
|
780 |
{
|
sl@0
|
781 |
INFO_PRINTF1(_L("Calls RFs::NotifyDismount()"));
|
sl@0
|
782 |
|
sl@0
|
783 |
TNotifyDismountMode mode = EFsDismountRegisterClient;
|
sl@0
|
784 |
TPtrC modeStr;
|
sl@0
|
785 |
//get NotifyDismountMode from parameters
|
sl@0
|
786 |
if(GET_MANDATORY_STRING_PARAMETER(KMode(), aSection, modeStr))
|
sl@0
|
787 |
{
|
sl@0
|
788 |
if(modeStr == _L("EFsDismountRegisterClient"))
|
sl@0
|
789 |
{
|
sl@0
|
790 |
mode = EFsDismountRegisterClient;
|
sl@0
|
791 |
}
|
sl@0
|
792 |
else if(modeStr == _L("EFsDismountNotifyClients"))
|
sl@0
|
793 |
{
|
sl@0
|
794 |
mode = EFsDismountNotifyClients;
|
sl@0
|
795 |
}
|
sl@0
|
796 |
else if(modeStr == _L("EFsDismountForceDismount"))
|
sl@0
|
797 |
{
|
sl@0
|
798 |
mode = EFsDismountForceDismount;
|
sl@0
|
799 |
}
|
sl@0
|
800 |
else
|
sl@0
|
801 |
{
|
sl@0
|
802 |
TInt modeNumber;
|
sl@0
|
803 |
if(GET_OPTIONAL_INT_PARAMETER(KMode, aSection, modeNumber))
|
sl@0
|
804 |
{
|
sl@0
|
805 |
mode = (TNotifyDismountMode)modeNumber;
|
sl@0
|
806 |
}
|
sl@0
|
807 |
else
|
sl@0
|
808 |
{
|
sl@0
|
809 |
ERR_PRINTF3(_L("NotifyDismount() incorrect parameter %S in %S"), &modeStr, &KMode());
|
sl@0
|
810 |
SetBlockResult(EFail);
|
sl@0
|
811 |
}
|
sl@0
|
812 |
}
|
sl@0
|
813 |
}
|
sl@0
|
814 |
|
sl@0
|
815 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
816 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
817 |
{
|
sl@0
|
818 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
819 |
SetBlockResult(EFail);
|
sl@0
|
820 |
}
|
sl@0
|
821 |
else
|
sl@0
|
822 |
{
|
sl@0
|
823 |
// call NotifyDismount()
|
sl@0
|
824 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
825 |
iNotifyDismount.AppendL(active);
|
sl@0
|
826 |
CleanupStack::Pop(active);
|
sl@0
|
827 |
|
sl@0
|
828 |
iFs->NotifyDismount(driveNumber, active->iStatus, mode);
|
sl@0
|
829 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
830 |
IncOutstanding();
|
sl@0
|
831 |
}
|
sl@0
|
832 |
}
|
sl@0
|
833 |
|
sl@0
|
834 |
|
sl@0
|
835 |
void CT_FsData::DoCmdNotifyDismountCancel(const TDesC& aSection)
|
sl@0
|
836 |
/** Calls RFs::NotifyDismountCancel() */
|
sl@0
|
837 |
{
|
sl@0
|
838 |
INFO_PRINTF1(_L("Calls RFs::NotifyDismountCancel()"));
|
sl@0
|
839 |
|
sl@0
|
840 |
TBool all = ETrue;
|
sl@0
|
841 |
|
sl@0
|
842 |
if(GET_MANDATORY_BOOL_PARAMETER(KAll(), aSection, all))
|
sl@0
|
843 |
{
|
sl@0
|
844 |
if(all)
|
sl@0
|
845 |
{
|
sl@0
|
846 |
//Cancels all outstanding requests.
|
sl@0
|
847 |
iFs->NotifyDismountCancel();
|
sl@0
|
848 |
INFO_PRINTF1(_L("NotifyDismountCancel()"));
|
sl@0
|
849 |
}
|
sl@0
|
850 |
else
|
sl@0
|
851 |
{
|
sl@0
|
852 |
// Cancels a specific outstanding request
|
sl@0
|
853 |
TInt index=0;
|
sl@0
|
854 |
GET_OPTIONAL_INT_PARAMETER(KIndex, aSection, index);
|
sl@0
|
855 |
|
sl@0
|
856 |
//Cancels a specific outstanding request
|
sl@0
|
857 |
iFs->NotifyDismountCancel(iNotifyDismount[index]->iStatus);
|
sl@0
|
858 |
INFO_PRINTF1(_L("NotifyDismountCancel(TRequestStatus)"));
|
sl@0
|
859 |
}
|
sl@0
|
860 |
}
|
sl@0
|
861 |
}
|
sl@0
|
862 |
|
sl@0
|
863 |
|
sl@0
|
864 |
void CT_FsData::DoCmdAllowDismount(const TDesC& aSection)
|
sl@0
|
865 |
/** Calls RFs::AllowDismount() */
|
sl@0
|
866 |
{
|
sl@0
|
867 |
INFO_PRINTF1(_L("Calls RFs::AllowDismount()"));
|
sl@0
|
868 |
|
sl@0
|
869 |
// get drive number from parameters
|
sl@0
|
870 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
871 |
if(!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
872 |
{
|
sl@0
|
873 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
874 |
SetBlockResult(EFail);
|
sl@0
|
875 |
}
|
sl@0
|
876 |
else
|
sl@0
|
877 |
{
|
sl@0
|
878 |
//call AllowDismount
|
sl@0
|
879 |
TInt err = iFs->AllowDismount(driveNumber);
|
sl@0
|
880 |
// check error code
|
sl@0
|
881 |
if (err != KErrNone)
|
sl@0
|
882 |
{
|
sl@0
|
883 |
ERR_PRINTF2(_L("AllowDismount error: %d"), err);
|
sl@0
|
884 |
SetError(err);
|
sl@0
|
885 |
}
|
sl@0
|
886 |
}
|
sl@0
|
887 |
}
|
sl@0
|
888 |
|
sl@0
|
889 |
|
sl@0
|
890 |
void CT_FsData::DoCmdSetStartupConfigurationL(const TDesC& aSection)
|
sl@0
|
891 |
/** Calls RFs::SetStartupConfiguration() */
|
sl@0
|
892 |
{
|
sl@0
|
893 |
INFO_PRINTF1(_L("Calls RFs::SetStartupConfiguration()"));
|
sl@0
|
894 |
|
sl@0
|
895 |
//get Command from parameters
|
sl@0
|
896 |
TPtrC commandNum;
|
sl@0
|
897 |
TStartupConfigurationCmd configCommand = ELoaderPriority;
|
sl@0
|
898 |
if(GET_MANDATORY_STRING_PARAMETER(KCommandNum(), aSection, commandNum))
|
sl@0
|
899 |
{
|
sl@0
|
900 |
//Converting from string to TStartupConfigurationCmd
|
sl@0
|
901 |
if(commandNum == _L("ELoaderPriority"))
|
sl@0
|
902 |
{
|
sl@0
|
903 |
configCommand = ELoaderPriority;
|
sl@0
|
904 |
}
|
sl@0
|
905 |
else if(commandNum == _L("ESetRugged"))
|
sl@0
|
906 |
{
|
sl@0
|
907 |
configCommand = ESetRugged;
|
sl@0
|
908 |
}
|
sl@0
|
909 |
else if(commandNum == _L("EMaxStartupConfigurationCmd"))
|
sl@0
|
910 |
{
|
sl@0
|
911 |
configCommand = EMaxStartupConfigurationCmd;
|
sl@0
|
912 |
}
|
sl@0
|
913 |
TAny* param1 = NULL;
|
sl@0
|
914 |
TPtrC name;
|
sl@0
|
915 |
if(GET_OPTIONAL_STRING_PARAMETER(KParam1(), aSection, name))
|
sl@0
|
916 |
{
|
sl@0
|
917 |
param1 = GetDataObjectL(name);
|
sl@0
|
918 |
}
|
sl@0
|
919 |
TAny* param2 = NULL;
|
sl@0
|
920 |
|
sl@0
|
921 |
if(GET_OPTIONAL_STRING_PARAMETER(KParam2(), aSection, name))
|
sl@0
|
922 |
{
|
sl@0
|
923 |
param2 = GetDataObjectL(name);
|
sl@0
|
924 |
}
|
sl@0
|
925 |
//call SetStartupConfiguration
|
sl@0
|
926 |
TInt err = iFs->SetStartupConfiguration(configCommand, param1, param2);
|
sl@0
|
927 |
INFO_PRINTF2(_L("RFs::SetStartupConfiguration() %S"), &commandNum);
|
sl@0
|
928 |
// check error code
|
sl@0
|
929 |
if (err != KErrNone)
|
sl@0
|
930 |
{
|
sl@0
|
931 |
ERR_PRINTF2(_L("SetStartupConfiguration() error: %d"), err);
|
sl@0
|
932 |
SetError(err);
|
sl@0
|
933 |
}
|
sl@0
|
934 |
}
|
sl@0
|
935 |
}
|
sl@0
|
936 |
|
sl@0
|
937 |
void CT_FsData::DoCmdAddCompositeMount(const TDesC& aSection)
|
sl@0
|
938 |
{
|
sl@0
|
939 |
INFO_PRINTF1(_L("Calls RFs::AddCompositeMount()"));
|
sl@0
|
940 |
|
sl@0
|
941 |
TBool dataOk = ETrue;
|
sl@0
|
942 |
|
sl@0
|
943 |
// get drive number from parameters
|
sl@0
|
944 |
TDriveNumber localDriveToMount = EDriveA;
|
sl@0
|
945 |
if (!GetDriveNumberFromConfig(aSection, KLocalDrive(), localDriveToMount))
|
sl@0
|
946 |
{
|
sl@0
|
947 |
ERR_PRINTF2(_L("No %S"), &KLocalDrive());
|
sl@0
|
948 |
SetBlockResult(EFail);
|
sl@0
|
949 |
dataOk = EFalse;
|
sl@0
|
950 |
}
|
sl@0
|
951 |
|
sl@0
|
952 |
// get composite drive number from parameters
|
sl@0
|
953 |
TDriveNumber compositeDrive = EDriveA;
|
sl@0
|
954 |
if (!GetDriveNumberFromConfig(aSection, KCompositeDrive(), compositeDrive))
|
sl@0
|
955 |
{
|
sl@0
|
956 |
ERR_PRINTF2(_L("No %S"), &KCompositeDrive());
|
sl@0
|
957 |
SetBlockResult(EFail);
|
sl@0
|
958 |
dataOk = EFalse;
|
sl@0
|
959 |
}
|
sl@0
|
960 |
|
sl@0
|
961 |
// get Sync from parameters
|
sl@0
|
962 |
TBool sync = EFalse;
|
sl@0
|
963 |
if(!GET_MANDATORY_BOOL_PARAMETER(KIsSync(), aSection, sync))
|
sl@0
|
964 |
{
|
sl@0
|
965 |
dataOk = EFalse;
|
sl@0
|
966 |
}
|
sl@0
|
967 |
|
sl@0
|
968 |
// get fileSystemName from parameters
|
sl@0
|
969 |
TPtrC fileSystemName;
|
sl@0
|
970 |
if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
|
sl@0
|
971 |
{
|
sl@0
|
972 |
fileSystemName.Set(iFileSystemName);
|
sl@0
|
973 |
}
|
sl@0
|
974 |
|
sl@0
|
975 |
if(dataOk)
|
sl@0
|
976 |
{
|
sl@0
|
977 |
TInt err = iFs->AddCompositeMount(fileSystemName, localDriveToMount, compositeDrive, sync);
|
sl@0
|
978 |
INFO_PRINTF1(_L("Calls RFs::AddCompositeMount()"));
|
sl@0
|
979 |
// check error code
|
sl@0
|
980 |
if (err != KErrNone)
|
sl@0
|
981 |
{
|
sl@0
|
982 |
ERR_PRINTF2(_L("AddCompositeMount() error: %d"), err);
|
sl@0
|
983 |
SetError(err);
|
sl@0
|
984 |
}
|
sl@0
|
985 |
}
|
sl@0
|
986 |
}
|
sl@0
|
987 |
void CT_FsData::DoCmdStartupInitCompleteL(TInt aAsyncErrorIndex)
|
sl@0
|
988 |
/** Calls RFs::StartupInitComplete() */
|
sl@0
|
989 |
{
|
sl@0
|
990 |
INFO_PRINTF1(_L("Calls RFs::StartupInitComplete()"));
|
sl@0
|
991 |
|
sl@0
|
992 |
// call StartupInitComplete()
|
sl@0
|
993 |
CActiveCallback* active = CActiveCallback::NewLC(*this);
|
sl@0
|
994 |
iStartupInitComplete.AppendL(active);
|
sl@0
|
995 |
CleanupStack::Pop(active);
|
sl@0
|
996 |
|
sl@0
|
997 |
iFs->StartupInitComplete(active->iStatus);
|
sl@0
|
998 |
active->Activate(aAsyncErrorIndex);
|
sl@0
|
999 |
IncOutstanding();
|
sl@0
|
1000 |
}
|
sl@0
|
1001 |
|
sl@0
|
1002 |
|
sl@0
|
1003 |
void CT_FsData::DoCmdFinaliseDrives()
|
sl@0
|
1004 |
/** Calls RFs::FinaliseDrives() */
|
sl@0
|
1005 |
{
|
sl@0
|
1006 |
INFO_PRINTF1(_L("Calls RFs::FinaliseDrives()"));
|
sl@0
|
1007 |
|
sl@0
|
1008 |
TInt err = iFs->FinaliseDrives();
|
sl@0
|
1009 |
|
sl@0
|
1010 |
// check error code
|
sl@0
|
1011 |
if (err != KErrNone)
|
sl@0
|
1012 |
{
|
sl@0
|
1013 |
ERR_PRINTF2(_L("FinaliseDrives() error: %d"), err);
|
sl@0
|
1014 |
SetError(err);
|
sl@0
|
1015 |
}
|
sl@0
|
1016 |
}
|
sl@0
|
1017 |
|
sl@0
|
1018 |
|
sl@0
|
1019 |
void CT_FsData::DoCmdSetLocalDriveMappingL(const TDesC& aSection)
|
sl@0
|
1020 |
/** Calls RFs::SetLocalDriveMapping() */
|
sl@0
|
1021 |
{
|
sl@0
|
1022 |
INFO_PRINTF1(_L("Calls RFs::SetLocalDriveMapping()"));
|
sl@0
|
1023 |
|
sl@0
|
1024 |
// get operation from config
|
sl@0
|
1025 |
TLocalDriveMappingInfo::TDrvMapOperation operation = TLocalDriveMappingInfo::EWriteMappingsAndSet;
|
sl@0
|
1026 |
if (!GetDrvMapOperationFromConfig(aSection, KDriveMappingOperation(), operation))
|
sl@0
|
1027 |
{
|
sl@0
|
1028 |
ERR_PRINTF2(_L("No %S"), &KDriveMappingOperation());
|
sl@0
|
1029 |
SetBlockResult(EFail);
|
sl@0
|
1030 |
}
|
sl@0
|
1031 |
|
sl@0
|
1032 |
// create an info buffer and set the operation
|
sl@0
|
1033 |
TLocalDriveMappingInfoBuf infoBuf;
|
sl@0
|
1034 |
TLocalDriveMappingInfo& info = infoBuf();
|
sl@0
|
1035 |
info.iOperation = operation;
|
sl@0
|
1036 |
|
sl@0
|
1037 |
// get drive mapping array from config
|
sl@0
|
1038 |
TInt driveMappingSize = 0;
|
sl@0
|
1039 |
if (GET_MANDATORY_INT_PARAMETER(KDriveMappingSize(), aSection, driveMappingSize))
|
sl@0
|
1040 |
{
|
sl@0
|
1041 |
for(TInt i = 0; i < driveMappingSize; i++)
|
sl@0
|
1042 |
{
|
sl@0
|
1043 |
TBuf<KBufferStringLength> tmpBuff;
|
sl@0
|
1044 |
|
sl@0
|
1045 |
tmpBuff.Append(KDriveMappingElement);
|
sl@0
|
1046 |
tmpBuff.AppendNum(i);
|
sl@0
|
1047 |
|
sl@0
|
1048 |
TDriveNumber driveNumber;
|
sl@0
|
1049 |
if (GetDriveNumberFromConfig(aSection, tmpBuff, driveNumber))
|
sl@0
|
1050 |
{
|
sl@0
|
1051 |
info.iDriveMapping[i] = driveNumber;
|
sl@0
|
1052 |
INFO_PRINTF3(_L("Drive mapping element[%d] = %d"), i, driveNumber);
|
sl@0
|
1053 |
}
|
sl@0
|
1054 |
else
|
sl@0
|
1055 |
{
|
sl@0
|
1056 |
ERR_PRINTF2(_L("No %S"), &tmpBuff);
|
sl@0
|
1057 |
SetBlockResult(EFail);
|
sl@0
|
1058 |
}
|
sl@0
|
1059 |
}
|
sl@0
|
1060 |
}
|
sl@0
|
1061 |
|
sl@0
|
1062 |
// call SetLocalDriveMapping()
|
sl@0
|
1063 |
TInt err = iFs->SetLocalDriveMapping(infoBuf);
|
sl@0
|
1064 |
|
sl@0
|
1065 |
// check error code
|
sl@0
|
1066 |
if (err != KErrNone)
|
sl@0
|
1067 |
{
|
sl@0
|
1068 |
ERR_PRINTF2(_L("SetLocalDriveMapping() error: %d"), err);
|
sl@0
|
1069 |
SetError(err);
|
sl@0
|
1070 |
}
|
sl@0
|
1071 |
}
|
sl@0
|
1072 |
|
sl@0
|
1073 |
|
sl@0
|
1074 |
void CT_FsData::DoCmdSwapFileSystem(const TDesC& aSection)
|
sl@0
|
1075 |
/** Calls RFs::SwapFileSystem() */
|
sl@0
|
1076 |
{
|
sl@0
|
1077 |
INFO_PRINTF1(_L("Calls RFs::SwapFileSystem()"));
|
sl@0
|
1078 |
|
sl@0
|
1079 |
//get OldFileSystemName
|
sl@0
|
1080 |
// get fileSystemName from parameters
|
sl@0
|
1081 |
TPtrC fileSystemName;
|
sl@0
|
1082 |
if ( !GET_OPTIONAL_STRING_PARAMETER(KFileSystemName(), aSection, fileSystemName) )
|
sl@0
|
1083 |
{
|
sl@0
|
1084 |
fileSystemName.Set(iFileSystemName);
|
sl@0
|
1085 |
}
|
sl@0
|
1086 |
|
sl@0
|
1087 |
//get NewFileSystemName
|
sl@0
|
1088 |
TPtrC newFsName;
|
sl@0
|
1089 |
if(!GET_OPTIONAL_STRING_PARAMETER(KNewFileSystemName(), aSection, newFsName))
|
sl@0
|
1090 |
{
|
sl@0
|
1091 |
newFsName.Set(iFileSystemName);
|
sl@0
|
1092 |
}
|
sl@0
|
1093 |
|
sl@0
|
1094 |
// get drive number from parameters
|
sl@0
|
1095 |
TBool dataOk = ETrue;
|
sl@0
|
1096 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
1097 |
if (!GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
1098 |
{
|
sl@0
|
1099 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
1100 |
SetBlockResult(EFail);
|
sl@0
|
1101 |
dataOk = EFalse;
|
sl@0
|
1102 |
}
|
sl@0
|
1103 |
|
sl@0
|
1104 |
if(dataOk)
|
sl@0
|
1105 |
{
|
sl@0
|
1106 |
TInt err = iFs->SwapFileSystem(fileSystemName, newFsName, driveNumber);
|
sl@0
|
1107 |
// check error code
|
sl@0
|
1108 |
if (err != KErrNone)
|
sl@0
|
1109 |
{
|
sl@0
|
1110 |
ERR_PRINTF2(_L("SwapFileSystem() error: %d"), err);
|
sl@0
|
1111 |
SetError(err);
|
sl@0
|
1112 |
}
|
sl@0
|
1113 |
}
|
sl@0
|
1114 |
|
sl@0
|
1115 |
}
|
sl@0
|
1116 |
|
sl@0
|
1117 |
void CT_FsData::DoCmdFileSystemSubType(const TDesC& aSection)
|
sl@0
|
1118 |
{
|
sl@0
|
1119 |
INFO_PRINTF1(_L("Calls RFs::FileSystemSubType()"));
|
sl@0
|
1120 |
|
sl@0
|
1121 |
// get drive number from parameters
|
sl@0
|
1122 |
TDriveNumber driveNumber = EDriveA;
|
sl@0
|
1123 |
if (GetDriveNumberFromConfig(aSection, KDrive(), driveNumber))
|
sl@0
|
1124 |
{
|
sl@0
|
1125 |
TFSName subTypeName;
|
sl@0
|
1126 |
TInt err = iFs->FileSystemSubType(driveNumber, subTypeName);
|
sl@0
|
1127 |
// check error code
|
sl@0
|
1128 |
if (err != KErrNone)
|
sl@0
|
1129 |
{
|
sl@0
|
1130 |
ERR_PRINTF2(_L("FileSystemSubType() error: %d"), err);
|
sl@0
|
1131 |
SetError(err);
|
sl@0
|
1132 |
}
|
sl@0
|
1133 |
else
|
sl@0
|
1134 |
{
|
sl@0
|
1135 |
INFO_PRINTF2(_L("FileSystemSubType() subTypeName = %S"), &subTypeName);
|
sl@0
|
1136 |
//Check expected result
|
sl@0
|
1137 |
TPtrC subTypeNameExpect;
|
sl@0
|
1138 |
if (GET_OPTIONAL_STRING_PARAMETER(KSubTypeName(), aSection, subTypeNameExpect))
|
sl@0
|
1139 |
{
|
sl@0
|
1140 |
if ( subTypeNameExpect != subTypeName)
|
sl@0
|
1141 |
{
|
sl@0
|
1142 |
ERR_PRINTF1(_L("File system name != expected name"));
|
sl@0
|
1143 |
SetBlockResult(EFail);
|
sl@0
|
1144 |
}
|
sl@0
|
1145 |
}
|
sl@0
|
1146 |
}
|
sl@0
|
1147 |
}
|
sl@0
|
1148 |
else
|
sl@0
|
1149 |
{
|
sl@0
|
1150 |
ERR_PRINTF2(_L("No %S"), &KDrive());
|
sl@0
|
1151 |
SetBlockResult(EFail);
|
sl@0
|
1152 |
}
|
sl@0
|
1153 |
}
|
sl@0
|
1154 |
|
sl@0
|
1155 |
TBool CT_FsData::GetDriveNumberFromConfig(const TDesC& aSection, const TDesC& aParameterName, TDriveNumber& aDriveNumber)
|
sl@0
|
1156 |
/** Reads drive number from INI-file */
|
sl@0
|
1157 |
{
|
sl@0
|
1158 |
// Read drive number from INI file
|
sl@0
|
1159 |
TPtrC driveNumberStr;
|
sl@0
|
1160 |
TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, driveNumberStr);
|
sl@0
|
1161 |
if (ret)
|
sl@0
|
1162 |
{
|
sl@0
|
1163 |
if (driveNumberStr == KDriveA)
|
sl@0
|
1164 |
{
|
sl@0
|
1165 |
aDriveNumber = EDriveA;
|
sl@0
|
1166 |
}
|
sl@0
|
1167 |
else if (driveNumberStr == KDriveB)
|
sl@0
|
1168 |
{
|
sl@0
|
1169 |
aDriveNumber = EDriveB;
|
sl@0
|
1170 |
}
|
sl@0
|
1171 |
else if (driveNumberStr == KDriveC)
|
sl@0
|
1172 |
{
|
sl@0
|
1173 |
aDriveNumber = EDriveC;
|
sl@0
|
1174 |
}
|
sl@0
|
1175 |
else if (driveNumberStr == KDriveD)
|
sl@0
|
1176 |
{
|
sl@0
|
1177 |
aDriveNumber = EDriveD;
|
sl@0
|
1178 |
}
|
sl@0
|
1179 |
else if (driveNumberStr == KDriveE)
|
sl@0
|
1180 |
{
|
sl@0
|
1181 |
aDriveNumber = EDriveE;
|
sl@0
|
1182 |
}
|
sl@0
|
1183 |
else if (driveNumberStr == KDriveF)
|
sl@0
|
1184 |
{
|
sl@0
|
1185 |
aDriveNumber = EDriveF;
|
sl@0
|
1186 |
}
|
sl@0
|
1187 |
else if (driveNumberStr == KDriveG)
|
sl@0
|
1188 |
{
|
sl@0
|
1189 |
aDriveNumber = EDriveG;
|
sl@0
|
1190 |
}
|
sl@0
|
1191 |
else if (driveNumberStr == KDriveH)
|
sl@0
|
1192 |
{
|
sl@0
|
1193 |
aDriveNumber = EDriveH;
|
sl@0
|
1194 |
}
|
sl@0
|
1195 |
else if (driveNumberStr == KDriveI)
|
sl@0
|
1196 |
{
|
sl@0
|
1197 |
aDriveNumber = EDriveI;
|
sl@0
|
1198 |
}
|
sl@0
|
1199 |
else if (driveNumberStr == KDriveJ)
|
sl@0
|
1200 |
{
|
sl@0
|
1201 |
aDriveNumber = EDriveJ;
|
sl@0
|
1202 |
}
|
sl@0
|
1203 |
else if (driveNumberStr == KDriveK)
|
sl@0
|
1204 |
{
|
sl@0
|
1205 |
aDriveNumber = EDriveK;
|
sl@0
|
1206 |
}
|
sl@0
|
1207 |
else if (driveNumberStr == KDriveL)
|
sl@0
|
1208 |
{
|
sl@0
|
1209 |
aDriveNumber = EDriveL;
|
sl@0
|
1210 |
}
|
sl@0
|
1211 |
else if (driveNumberStr == KDriveM)
|
sl@0
|
1212 |
{
|
sl@0
|
1213 |
aDriveNumber = EDriveM;
|
sl@0
|
1214 |
}
|
sl@0
|
1215 |
else if (driveNumberStr == KDriveN)
|
sl@0
|
1216 |
{
|
sl@0
|
1217 |
aDriveNumber = EDriveN;
|
sl@0
|
1218 |
}
|
sl@0
|
1219 |
else if (driveNumberStr == KDriveO)
|
sl@0
|
1220 |
{
|
sl@0
|
1221 |
aDriveNumber = EDriveO;
|
sl@0
|
1222 |
}
|
sl@0
|
1223 |
else if (driveNumberStr == KDriveP) // Sorry, it's a bit long. But looks nice!
|
sl@0
|
1224 |
{
|
sl@0
|
1225 |
aDriveNumber = EDriveP;
|
sl@0
|
1226 |
}
|
sl@0
|
1227 |
else if (driveNumberStr == KDriveQ)
|
sl@0
|
1228 |
{
|
sl@0
|
1229 |
aDriveNumber = EDriveQ;
|
sl@0
|
1230 |
}
|
sl@0
|
1231 |
else if (driveNumberStr == KDriveR)
|
sl@0
|
1232 |
{
|
sl@0
|
1233 |
aDriveNumber = EDriveR;
|
sl@0
|
1234 |
}
|
sl@0
|
1235 |
else if (driveNumberStr == KDriveS)
|
sl@0
|
1236 |
{
|
sl@0
|
1237 |
aDriveNumber = EDriveS;
|
sl@0
|
1238 |
}
|
sl@0
|
1239 |
else if (driveNumberStr == KDriveT)
|
sl@0
|
1240 |
{
|
sl@0
|
1241 |
aDriveNumber = EDriveT;
|
sl@0
|
1242 |
}
|
sl@0
|
1243 |
else if (driveNumberStr == KDriveU)
|
sl@0
|
1244 |
{
|
sl@0
|
1245 |
aDriveNumber = EDriveU;
|
sl@0
|
1246 |
}
|
sl@0
|
1247 |
else if (driveNumberStr == KDriveV)
|
sl@0
|
1248 |
{
|
sl@0
|
1249 |
aDriveNumber = EDriveV;
|
sl@0
|
1250 |
}
|
sl@0
|
1251 |
else if (driveNumberStr == KDriveW)
|
sl@0
|
1252 |
{
|
sl@0
|
1253 |
aDriveNumber = EDriveW;
|
sl@0
|
1254 |
}
|
sl@0
|
1255 |
else if (driveNumberStr == KDriveX)
|
sl@0
|
1256 |
{
|
sl@0
|
1257 |
aDriveNumber = EDriveX;
|
sl@0
|
1258 |
}
|
sl@0
|
1259 |
else if (driveNumberStr == KDriveY)
|
sl@0
|
1260 |
{
|
sl@0
|
1261 |
aDriveNumber = EDriveY;
|
sl@0
|
1262 |
}
|
sl@0
|
1263 |
else if (driveNumberStr == KDriveZ)
|
sl@0
|
1264 |
{
|
sl@0
|
1265 |
aDriveNumber = EDriveZ;
|
sl@0
|
1266 |
}
|
sl@0
|
1267 |
else
|
sl@0
|
1268 |
{
|
sl@0
|
1269 |
TInt driveNumber = 0;
|
sl@0
|
1270 |
ret = GET_OPTIONAL_INT_PARAMETER(aParameterName, aSection, driveNumber);
|
sl@0
|
1271 |
if (ret)
|
sl@0
|
1272 |
{
|
sl@0
|
1273 |
aDriveNumber = (TDriveNumber) driveNumber;
|
sl@0
|
1274 |
}
|
sl@0
|
1275 |
}
|
sl@0
|
1276 |
}
|
sl@0
|
1277 |
|
sl@0
|
1278 |
return ret;
|
sl@0
|
1279 |
}
|
sl@0
|
1280 |
|
sl@0
|
1281 |
|
sl@0
|
1282 |
TBool CT_FsData::GetDrvMapOperationFromConfig(const TDesC& aSection, const TDesC& aParameterName, TLocalDriveMappingInfo::TDrvMapOperation& aOperation)
|
sl@0
|
1283 |
/** Reads drive mapping operation name from INI-file */
|
sl@0
|
1284 |
{
|
sl@0
|
1285 |
// Read drives mapping operation name from INI file
|
sl@0
|
1286 |
TPtrC operationStr;
|
sl@0
|
1287 |
TBool ret = GET_OPTIONAL_STRING_PARAMETER(aParameterName, aSection, operationStr);
|
sl@0
|
1288 |
if (ret)
|
sl@0
|
1289 |
{
|
sl@0
|
1290 |
if (operationStr == KWriteMappingsAndSet)
|
sl@0
|
1291 |
{
|
sl@0
|
1292 |
aOperation = TLocalDriveMappingInfo::EWriteMappingsAndSet;
|
sl@0
|
1293 |
}
|
sl@0
|
1294 |
else if (operationStr == KWriteMappingsNoSet)
|
sl@0
|
1295 |
{
|
sl@0
|
1296 |
aOperation = TLocalDriveMappingInfo::EWriteMappingsNoSet;
|
sl@0
|
1297 |
}
|
sl@0
|
1298 |
else if (operationStr == KSwapIntMappingAndSet)
|
sl@0
|
1299 |
{
|
sl@0
|
1300 |
aOperation = TLocalDriveMappingInfo::ESwapIntMappingAndSet;
|
sl@0
|
1301 |
}
|
sl@0
|
1302 |
else
|
sl@0
|
1303 |
{
|
sl@0
|
1304 |
TInt operation = 0;
|
sl@0
|
1305 |
ret = GET_OPTIONAL_INT_PARAMETER(aParameterName, aSection, operation);
|
sl@0
|
1306 |
if (ret)
|
sl@0
|
1307 |
{
|
sl@0
|
1308 |
aOperation = (TLocalDriveMappingInfo::TDrvMapOperation) operation;
|
sl@0
|
1309 |
}
|
sl@0
|
1310 |
}
|
sl@0
|
1311 |
}
|
sl@0
|
1312 |
|
sl@0
|
1313 |
return ret;
|
sl@0
|
1314 |
}
|
sl@0
|
1315 |
|