author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 06 Jul 2010 15:50:07 +0300 | |
changeset 201 | 43365a9b78a3 |
parent 109 | b3a1d9898418 |
child 247 | d8d70de2bd36 |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). |
2 |
// All rights reserved. |
|
3 |
// This component and the accompanying materials are made available |
|
4 |
// under the terms of the License "Eclipse Public License v1.0" |
|
5 |
// which accompanies this distribution, and is available |
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// f32\sfile\sf_debug.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "sf_std.h" |
|
19 |
#include <f32dbg.h> |
|
20 |
#include "f32image.h" |
|
21 |
#include <F32plugin.h> |
|
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
22 |
#include <filesystem_fat.h> |
0 | 23 |
#include "sf_file_cache.h" |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
24 |
#include "sf_memory_man.h" |
0 | 25 |
|
26 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
27 |
||
28 |
// |
|
29 |
// ONLY INCLUDED IN DEBUG BUILDS |
|
30 |
// |
|
31 |
||
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
32 |
void PrintOpenFiles() |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
33 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
34 |
CCacheManager* manager = CCacheManagerFactory::CacheManager(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
35 |
TInt allocatedSegmentCount = manager ? manager->Stats().iAllocatedSegmentCount : 0; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
36 |
TInt lockedSegmentCount = manager ? manager->Stats().iLockedSegmentCount : 0; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
37 |
TInt fileCount = manager ? manager->Stats().iFileCount : 0; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
38 |
TInt filesOnClosedQueue = manager ? manager->Stats().iFilesOnClosedQueue : 0; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
39 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
40 |
RDebug::Print(_L("TRACE: Open files %d allocatedSegmentCount %d lockedSegmentCount %d fileCount %d filesOnClosedQueue %d\n"), |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
41 |
Files->Count(), allocatedSegmentCount, lockedSegmentCount, fileCount, filesOnClosedQueue); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
42 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
43 |
Files->Lock(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
44 |
TInt count=Files->Count(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
45 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
46 |
for (TInt n=0; n<count; n++) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
47 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
48 |
CFileCB* file=(CFileCB*)(*Files)[n]; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
49 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
50 |
RDebug::Print(_L("%3d: %C:%S fc %x sz %lx\n"), n, file->Drive().DriveNumber() + 'A', &file->FileNameF(), file->FileCache(), file->CachedSize64()); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
51 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
52 |
Files->Unlock(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
53 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
54 |
|
0 | 55 |
void PrintHeapSize(const TDesC& aMessage) |
56 |
// |
|
57 |
// Display the total memory available |
|
58 |
// |
|
59 |
{ |
|
60 |
||
61 |
TInt biggest; |
|
62 |
TInt heapSize = User::Allocator().Available(biggest); |
|
63 |
RDebug::Print(_L("%S size=0x%x largest cell=0x%x"),&aMessage,heapSize,biggest); |
|
64 |
} |
|
65 |
||
66 |
static void SetAllocFailure(const RMessage2* aMessage) |
|
67 |
// |
|
68 |
// Set alloc failure after allocCount allocations |
|
69 |
// |
|
70 |
{ |
|
71 |
||
72 |
UserHeapAllocFailCount=aMessage->Int1(); |
|
73 |
KernHeapAllocFailCount=UserHeapAllocFailCount; |
|
74 |
if (UserHeapAllocFailCount>=0) |
|
75 |
{ |
|
76 |
__UHEAP_FAILNEXT(UserHeapAllocFailCount); |
|
77 |
__KHEAP_FAILNEXT(KernHeapAllocFailCount); |
|
78 |
} |
|
79 |
else |
|
80 |
{ |
|
81 |
__UHEAP_RESET; |
|
82 |
__KHEAP_RESET; |
|
83 |
} |
|
84 |
} |
|
85 |
||
86 |
TInt FsDebugFunction(CFsRequest* aRequest) |
|
87 |
// |
|
88 |
// SetAllocFailure - Set alloc failure after allocCount allocations |
|
89 |
// SetErrorCondition - Set simulated error failure |
|
90 |
// SetDebugRegister - Trigger tracing output |
|
91 |
// DebugNotify - Request notification of a file server event - .FSY specific |
|
92 |
// |
|
93 |
{ |
|
94 |
||
95 |
TInt r=KErrNone; |
|
96 |
const RMessage2* message=&(aRequest->Message()); |
|
97 |
switch (message->Int0()) |
|
98 |
{ |
|
99 |
case EFsSetAllocFailure: |
|
100 |
SetAllocFailure(message); |
|
101 |
break; |
|
102 |
case EFsSetErrorCondition: |
|
103 |
ErrorCondition=message->Int1(); |
|
104 |
ErrorCount=message->Int2(); |
|
105 |
break; |
|
106 |
case EFsSetDebugRegister: |
|
107 |
DebugReg=message->Int1(); |
|
108 |
break; |
|
109 |
case EFsDebugNotify: |
|
110 |
{ |
|
111 |
TUint notifyType=(aRequest->Message().Int2())&KDebugNotifyMask; |
|
112 |
if (notifyType) |
|
113 |
{ |
|
114 |
CDebugChangeInfo* info=new CDebugChangeInfo; |
|
115 |
if(!info) |
|
116 |
return(KErrNoMemory); |
|
117 |
const RMessage2& m=aRequest->Message(); |
|
118 |
info->Initialise(notifyType,(TRequestStatus*)m.Ptr3(),m,aRequest->Session()); |
|
119 |
r=FsNotify::AddDebug(info); |
|
120 |
if(r!=KErrNone) |
|
121 |
delete(info); |
|
122 |
else |
|
123 |
aRequest->SetCompleted(EFalse); |
|
124 |
} |
|
125 |
else |
|
126 |
r=KErrArgument; |
|
127 |
break; |
|
128 |
} |
|
129 |
default: |
|
130 |
break; |
|
131 |
}; |
|
132 |
return(r); |
|
133 |
} |
|
134 |
||
135 |
TBool SimulateError(const RMessage2* aMessage) |
|
136 |
// |
|
137 |
// Return an error message if ErrorCount<=0 |
|
138 |
// |
|
139 |
{ |
|
140 |
TInt function = aMessage->Function() & KIpcFunctionMask; |
|
141 |
||
142 |
if (ErrorCondition!=KErrNone && |
|
143 |
( |
|
144 |
function!=EFsDebugFunction || aMessage->Int0()!=EFsSetErrorCondition) && |
|
145 |
function!=EFsNotifyChangeCancel && |
|
146 |
function!=EFsNotifyChangeCancelEx && |
|
147 |
function!=EFsNotifyDiskSpaceCancel && |
|
148 |
function!=EFsFormatSubClose && |
|
149 |
function!=EFsDirSubClose && |
|
150 |
function!=EFsFileSubClose && |
|
151 |
function!=EFsRawSubClose && |
|
152 |
function!=EFsUnclamp && |
|
153 |
||
154 |
//-- this operation must not fail. It can only fail if the client's thread has died. |
|
155 |
//-- in this case whole session will be cleaned up. |
|
156 |
function!=EFsFileAdopt |
|
157 |
) |
|
158 |
{ |
|
159 |
if (ErrorCount<=0) |
|
160 |
return(ETrue); |
|
161 |
ErrorCount--; |
|
162 |
} |
|
163 |
return(EFalse); |
|
164 |
} |
|
165 |
||
166 |
||
167 |
TPtrC GetFunctionName(TInt aFunction) |
|
168 |
// |
|
169 |
// Print number of alloc fails to complete a given function |
|
170 |
// |
|
171 |
{ |
|
172 |
||
173 |
switch (aFunction) |
|
174 |
{ |
|
175 |
case EFsDebugFunction: return _L("EFsDebugFunction"); |
|
176 |
case EFsAddFileSystem: return _L("EFsAddFileSystem"); |
|
177 |
case EFsRemoveFileSystem: return _L("EFsRemoveFileSystem"); |
|
178 |
case EFsMountFileSystem: return _L("EFsMountFileSystem"); |
|
179 |
case EFsNotifyChange: return _L("EFsNotifyChange"); |
|
180 |
case EFsNotifyChangeCancel: return _L("EFsNotifyChangeCancel"); |
|
181 |
case EFsDriveList: return _L("EFsDriveList"); |
|
182 |
case EFsDrive: return _L("EFsDrive"); |
|
183 |
case EFsVolume: return _L("EFsVolume"); |
|
184 |
case EFsSetVolume: return _L("EFsSetVolume"); |
|
185 |
case EFsSubst: return _L("EFsSubst"); |
|
186 |
case EFsSetSubst: return _L("EFsSetSubst"); |
|
187 |
case EFsRealName: return _L("EFsRealName"); |
|
188 |
case EFsDefaultPath: return _L("EFsDefaultPath"); |
|
189 |
case EFsSetDefaultPath: return _L("EFsSetDefaultPath"); |
|
190 |
case EFsSessionPath: return _L("EFsSessionPath"); |
|
191 |
case EFsSetSessionPath: return _L("EFsSetSessionPath"); |
|
192 |
case EFsMkDir: return _L("EFsMkDir"); |
|
193 |
case EFsRmDir: return _L("EFsRmDir"); |
|
194 |
case EFsParse: return _L("EFsParse"); |
|
195 |
case EFsDelete: return _L("EFsDelete"); |
|
196 |
case EFsRename: return _L("EFsRename"); |
|
197 |
case EFsReplace: return _L("EFsReplace"); |
|
198 |
case EFsEntry: return _L("EFsEntry"); |
|
199 |
case EFsSetEntry: return _L("EFsSetEntry"); |
|
200 |
case EFsGetDriveName: return _L("EFsGetDriveName"); |
|
201 |
case EFsSetDriveName: return _L("EFsSetDriveName"); |
|
202 |
case EFsFormatSubClose: return _L("EFsFormatSubClose"); |
|
203 |
case EFsDirSubClose: return _L("EFsDirSubClose"); |
|
204 |
case EFsFileSubClose: return _L("EFsFileSubClose"); |
|
205 |
case EFsRawSubClose: return _L("EFsRawSubClose"); |
|
206 |
case EFsFileOpen: return _L("EFsFileOpen"); |
|
207 |
case EFsFileCreate: return _L("EFsFileCreate"); |
|
208 |
case EFsFileReplace: return _L("EFsFileReplace"); |
|
209 |
case EFsFileTemp: return _L("EFsFileTemp"); |
|
210 |
case EFsFileRead: return _L("EFsFileRead"); |
|
211 |
case EFsFileWrite: return _L("EFsFileWrite"); |
|
212 |
case EFsFileLock: return _L("EFsFileLock"); |
|
213 |
case EFsFileUnLock: return _L("EFsFileUnLock"); |
|
214 |
case EFsFileSeek: return _L("EFsFileSeek"); |
|
215 |
case EFsFileFlush: return _L("EFsFileFlush"); |
|
216 |
case EFsFileSize: return _L("EFsFileSize"); |
|
217 |
case EFsFileSetSize: return _L("EFsFileSetSize"); |
|
218 |
case EFsFileAtt: return _L("EFsFileAtt"); |
|
219 |
case EFsFileSetAtt: return _L("EFsFileSetAtt"); |
|
220 |
case EFsFileModified: return _L("EFsFileModified"); |
|
221 |
case EFsFileSetModified: return _L("EFsFileSetModified"); |
|
222 |
case EFsFileSet: return _L("EFsFileSet"); |
|
223 |
case EFsFileChangeMode: return _L("EFsFileChangeMode"); |
|
224 |
case EFsFileRename: return _L("EFsFileRename"); |
|
225 |
case EFsDirOpen: return _L("EFsDirOpen"); |
|
226 |
case EFsDirReadOne: return _L("EFsDirReadOne"); |
|
227 |
case EFsDirReadPacked: return _L("EFsDirReadPacked"); |
|
228 |
case EFsFormatOpen: return _L("EFsFormatOpen"); |
|
229 |
case EFsFormatNext: return _L("EFsFormatNext"); |
|
230 |
case EFsRawDiskOpen: return _L("EFsRawDiskOpen"); |
|
231 |
case EFsRawDiskRead: return _L("EFsRawDiskRead"); |
|
232 |
case EFsRawDiskWrite: return _L("EFsRawDiskWrite"); |
|
233 |
case EFsResourceCountMarkStart: return _L("EFsResourceCountMarkStart"); |
|
234 |
case EFsResourceCountMarkEnd: return _L("EFsResourceCountMarkEnd"); |
|
235 |
case EFsResourceCount: return _L("EFsResourceCount"); |
|
236 |
case EFsCheckDisk: return _L("EFsCheckDisk"); |
|
237 |
case EFsGetShortName: return _L("EFsGetShortName"); |
|
238 |
case EFsGetLongName: return _L("EFsGetLongName"); |
|
239 |
case EFsIsFileOpen: return _L("EFsIsFileOpen"); |
|
240 |
case EFsListOpenFiles: return _L("EFsListOpenFiles"); |
|
241 |
case EFsSetNotifyUser: return _L("EFsSetNotifyUser"); |
|
242 |
case EFsIsFileInRom: return _L("EFsIsFileInRom"); |
|
243 |
case EFsGetNotifyUser: return _L("EFsGetNotifyUser"); |
|
244 |
case EFsIsValidName: return _L("EFsIsValidName"); |
|
245 |
case EFsReadFileSection: return _L("EFsReadFileSection"); |
|
246 |
case EFsNotifyChangeEx: return _L("EFsNotifyChangeEx"); |
|
247 |
case EFsNotifyChangeCancelEx: return _L("EFsNotifyChangeCancelEx"); |
|
248 |
case EFsDismountFileSystem: return _L("EFsDismountFileSystem"); |
|
249 |
case EFsFileSystemName: return _L("EFsFileSystemName"); |
|
250 |
case EFsScanDrive: return _L("EFsScanDrive"); |
|
251 |
case EFsControlIo: return _L("EFsControlIo"); |
|
252 |
case EFsLockDrive: return _L("EFsLockDrive"); |
|
253 |
case EFsUnlockDrive: return _L("EFsUnlockDrive"); |
|
254 |
case EFsClearPassword: return _L("EFsClearPassword"); |
|
255 |
case EFsNotifyDiskSpace: return _L("EFsNotifyDiskSpace"); |
|
256 |
case EFsNotifyDiskSpaceCancel: return _L("EFsNotifyDiskSpaceCancel"); |
|
257 |
case EFsMountFileSystemScan: return _L("EFsMountFileSystemScan"); |
|
258 |
case EFsSessionToPrivate: return _L("EFsSessionToPrivate"); |
|
259 |
case EFsPrivatePath: return _L("EFsPrivatePath"); |
|
260 |
case EFsCreatePrivatePath: return _L("EFsCreatePrivatePath"); |
|
261 |
case EFsFileDrive: return _L("EFsFileDrive"); |
|
262 |
case EFsRemountDrive: return _L("EFsRemountDrive"); |
|
263 |
case EFsAddExtension: return _L("EFsAddExtension"); |
|
264 |
case EFsMountExtension: return _L("EFsMountExtension"); |
|
265 |
case EFsDismountExtension: return _L("EFsDismountExtension"); |
|
266 |
case EFsRemoveExtension: return _L("EFsRemoveExtension"); |
|
267 |
case EFsExtensionName: return _L("EFsExtensionName"); |
|
268 |
case EFsStartupInitComplete: return _L("EFsStartupInitComplete"); |
|
269 |
case EFsSetLocalDriveMapping: return _L("EFsSetLocalDriveMapping"); |
|
270 |
case EFsFileDuplicate: return _L("EFsFileDuplicate"); |
|
271 |
case EFsFileAdopt: return _L("EFsFileAdopt"); |
|
272 |
case EFsFinaliseDrive: return _L("EFsFinaliseDrive"); |
|
273 |
case EFsSwapFileSystem: return _L("EFsSwapFileSystem"); |
|
274 |
case EFsErasePassword: return _L("EFsErasePassword"); |
|
275 |
case EFsReserveDriveSpace: return _L("EFsReserveDriveSpace"); |
|
276 |
case EFsGetReserveAccess: return _L("EFsGetReserveAccess"); |
|
277 |
case EFsReleaseReserveAccess: return _L("EFsReleaseReserveAccess"); |
|
278 |
case EFsFileName: return _L("EFsFileName"); |
|
279 |
case EFsGetMediaSerialNumber: return _L("EFsGetMediaSerialNumber"); |
|
280 |
case EFsFileFullName: return _L("EFsFileFullName"); |
|
281 |
case EFsAddPlugin: return _L("EFsAddPlugin"); |
|
282 |
case EFsRemovePlugin: return _L("EFsRemovePlugin"); |
|
283 |
case EFsMountPlugin: return _L("EFsMountPlugin"); |
|
284 |
case EFsDismountPlugin: return _L("EFsDismountPlugin"); |
|
285 |
case EFsPluginName: return _L("EFsPluginName"); |
|
286 |
case EFsPluginOpen: return _L("EFsPluginOpen"); |
|
287 |
case EFsPluginSubClose: return _L("EFsPluginSubClose"); |
|
288 |
case EFsPluginDoRequest: return _L("EFsPluginDoRequest"); |
|
289 |
case EFsPluginDoControl: return _L("EFsPluginDoControl"); |
|
290 |
case EFsPluginDoCancel: return _L("EFsPluginDoCancel"); |
|
291 |
case EFsNotifyDismount: return _L("EFsNotifyDismount"); |
|
292 |
case EFsNotifyDismountCancel: return _L("EFsNotifyDismountCancel"); |
|
293 |
case EFsAllowDismount: return _L("EFsAllowDismount"); |
|
294 |
case EFsSetStartupConfiguration: return _L("EFsSetStartupConfiguration"); |
|
295 |
case EFsFileReadCancel: return _L("EFsFileReadCancel"); |
|
296 |
case EFsAddCompositeMount: return _L("EFsAddCompositeMount"); |
|
297 |
case EFsSetSessionFlags: return _L("EFsSetSessionFlags"); |
|
298 |
case EFsSetSystemDrive: return _L("EFsSetSystemDrive"); |
|
299 |
case EFsBlockMap: return _L("EFsBlockMap"); |
|
300 |
case EFsUnclamp: return _L("EFsUnclamp"); |
|
301 |
case EFsFileClamp: return _L("EFsFileClamp"); |
|
302 |
case EFsQueryVolumeInfoExt: return _L("EFsQueryVolumeInfoExt"); |
|
303 |
case EFsInitialisePropertiesFile: return _L("EFsInitialisePropertiesFile"); |
|
304 |
case EFsFileWriteDirty: return _L("EFsFileWriteDirty"); |
|
305 |
case EFsSynchroniseDriveThread: return _L("EFsSynchroniseDriveThread"); |
|
306 |
case EFsAddProxyDrive: return _L("EFsAddProxyDrive"); |
|
307 |
case EFsRemoveProxyDrive: return _L("EFsRemoveProxyDrive"); |
|
308 |
case EFsMountProxyDrive: return _L("EFsMountProxyDrive"); |
|
309 |
case EFsDismountProxyDrive: return _L("EFsDismountProxyDrive"); |
|
310 |
case EFsNotificationAdd : return _L("EFsNotificationAdd"); |
|
311 |
case EFsNotificationBuffer : return _L("EFsNotificationBuffer"); |
|
312 |
case EFsNotificationCancel : return _L("EFsNotificationCancel"); |
|
313 |
case EFsNotificationOpen : return _L("EFsNotificationOpen"); |
|
314 |
case EFsNotificationRemove : return _L("EFsNotificationRemove"); |
|
315 |
case EFsNotificationRequest : return _L("EFsNotificationRequest"); |
|
316 |
case EFsNotificationSubClose : return _L("EFsNotificationSubClose"); |
|
317 |
case EFsLoadCodePage: return _L("EFsLoadCodePage"); |
|
318 |
default: |
|
319 |
return _L("Error unknown function"); |
|
320 |
} |
|
321 |
} |
|
322 |
||
323 |
||
324 |
void PrintStartUpReason(TMachineStartupType aReason) |
|
325 |
// |
|
326 |
// Print the reason the machine is booting up |
|
327 |
// |
|
328 |
{ |
|
329 |
||
330 |
TBuf<64> nameBuf; |
|
331 |
switch (aReason) |
|
332 |
{ |
|
333 |
case EStartupCold: nameBuf=_L("EStartupCold"); break; |
|
334 |
case EStartupColdReset: nameBuf=_L("EStartupColdReset"); break; |
|
335 |
case EStartupNewOs: nameBuf=_L("EStartupNewOs"); break; |
|
336 |
case EStartupPowerFail: nameBuf=_L("StartupPowerFail"); break; |
|
337 |
case EStartupWarmReset: nameBuf=_L("EStartupWarmReset"); break; |
|
338 |
case EStartupKernelFault: nameBuf=_L("EStartupKernelFault"); break; |
|
339 |
case EStartupSafeReset: nameBuf=_L("EStartupSafeReset"); break; |
|
340 |
default: |
|
341 |
nameBuf=_L("Error unknown startup type"); |
|
342 |
} |
|
343 |
__PRINT1(_L("Machine startup - %S"),&nameBuf); |
|
344 |
}; |
|
345 |
||
346 |
LOCAL_C void AllocPrint(TInt aFunction) |
|
347 |
// |
|
348 |
// Print number of alloc fails to complete a given function |
|
349 |
// |
|
350 |
{ |
|
351 |
if (UserHeapAllocFailCount || KernHeapAllocFailCount) |
|
352 |
{ |
|
353 |
TPtrC funcName=GetFunctionName(aFunction); |
|
354 |
{ |
|
355 |
__PRINTALLOC(_L("Function %S UserAllocs %d KernAllocs %d"),&funcName,UserHeapAllocFailCount,KernHeapAllocFailCount); |
|
356 |
} |
|
357 |
} |
|
358 |
} |
|
359 |
||
360 |
void SimulateAllocFailure(TInt aFunctionReturnValue,TInt aFunction) |
|
361 |
// |
|
362 |
// Simulate alloc failure |
|
363 |
// |
|
364 |
{ |
|
365 |
||
366 |
||
367 |
if (UserHeapAllocFailCount>=0 && (aFunctionReturnValue==KErrDiskFull || aFunctionReturnValue==KErrNoMemory)) |
|
368 |
{ |
|
369 |
if (KernHeapAllocFailCount<20) |
|
370 |
{ |
|
371 |
__KHEAP_FAILNEXT(++KernHeapAllocFailCount); |
|
372 |
__UHEAP_FAILNEXT(UserHeapAllocFailCount); |
|
373 |
} |
|
374 |
else |
|
375 |
{ |
|
376 |
KernHeapAllocFailCount=0; |
|
377 |
__UHEAP_FAILNEXT(++UserHeapAllocFailCount); |
|
378 |
__KHEAP_FAILNEXT(KernHeapAllocFailCount); |
|
379 |
} |
|
380 |
if (UserHeapAllocFailCount<100) |
|
381 |
return; |
|
382 |
} |
|
383 |
if (UserHeapAllocFailCount>=0) |
|
384 |
{ |
|
385 |
AllocPrint(aFunction); |
|
386 |
UserHeapAllocFailCount=0; |
|
387 |
KernHeapAllocFailCount=0; |
|
388 |
__UHEAP_FAILNEXT(UserHeapAllocFailCount); |
|
389 |
__KHEAP_FAILNEXT(KernHeapAllocFailCount); |
|
390 |
} |
|
391 |
} |
|
392 |
||
393 |
#else |
|
394 |
TInt FsDebugFunction(CFsRequest* /*aRequest*/) |
|
395 |
// |
|
396 |
// Not in the release build |
|
397 |
// |
|
398 |
{ |
|
399 |
return KErrNotSupported; |
|
400 |
} |
|
401 |
#endif |
|
402 |
||
403 |
TInt TFsDebugFunc::DoRequestL(CFsRequest* aRequest) |
|
404 |
// |
|
405 |
// Not in the release build |
|
406 |
// |
|
407 |
{ |
|
408 |
return FsDebugFunction(aRequest); |
|
409 |
} |
|
410 |
||
411 |
TInt TFsDebugFunc::Initialise(CFsRequest* /*aRequest*/) |
|
412 |
// |
|
413 |
// Not in the release build |
|
414 |
// |
|
415 |
{ |
|
416 |
return KErrNone; |
|
417 |
} |
|
418 |
||
419 |
TInt TFsControlIo::DoRequestL(CFsRequest* aRequest) |
|
420 |
// |
|
421 |
// General purpose test interface - .FSY specific. |
|
422 |
// Not in the release build |
|
423 |
// |
|
424 |
{ |
|
425 |
TInt command=aRequest->Message().Int1(); |
|
426 |
TAny* param1=(TAny*)aRequest->Message().Ptr2(); |
|
427 |
TAny* param2=(TAny*)aRequest->Message().Ptr3(); |
|
428 |
||
429 |
||
430 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
|
431 |
switch(command) |
|
432 |
{ //These are non-drive commands |
|
433 |
case KControlIoGetCorruptLogRecord: |
|
434 |
{ |
|
435 |
// number of the log record to be retrieved (1-based) |
|
436 |
TInt logRecNum=(TInt)param2; |
|
437 |
TFsDebugCorruptLogRecordBuf logBuf; |
|
438 |
TInt r=TCorruptLogRec::GetLogRecord(logBuf,logRecNum); |
|
439 |
if(r!=KErrNone) |
|
440 |
return r; |
|
441 |
r=aRequest->Write(2,logBuf,0); |
|
442 |
return r; |
|
443 |
} |
|
444 |
case KControlIoGetNumberOfCorruptLogRecords: |
|
445 |
{ |
|
446 |
TPtrC8 ptrHits((TUint8*)&gNumberOfCorruptHits,sizeof(gNumberOfCorruptHits)); |
|
447 |
TInt r=aRequest->Write(2,ptrHits,0); |
|
448 |
||
449 |
return r; |
|
450 |
} |
|
451 |
case KControlIoGetCorruptListFile: |
|
452 |
{ |
|
453 |
// Get name of file that contains the filenames nominated as "corrupt" |
|
454 |
TBuf8<KMaxFileName> fileName8; |
|
455 |
if(gCorruptFileNamesListFile) |
|
456 |
{ |
|
457 |
fileName8.Copy(*gCorruptFileNamesListFile); |
|
458 |
} |
|
459 |
else |
|
460 |
{ |
|
461 |
fileName8.SetLength(0); |
|
462 |
} |
|
463 |
TInt r=aRequest->Write(2,fileName8,0); |
|
464 |
return r; |
|
465 |
} |
|
466 |
case KControlIoCorruptLogRecordReset: |
|
467 |
{ |
|
468 |
TCorruptLogRec::DestroyList(); |
|
469 |
TCorruptNameRec::ResetListConsumed(); |
|
470 |
return KErrNone; |
|
471 |
} |
|
472 |
case KControlIoCacheCount: |
|
473 |
{ |
|
474 |
TIOCacheValues cacheValues; |
|
475 |
cacheValues.iCloseCount= RequestAllocator::CloseCount(); |
|
476 |
cacheValues.iFreeCount= RequestAllocator::FreeCount(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
477 |
cacheValues.iAllocated= 0; // no longer used |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
478 |
cacheValues.iTotalCount= RequestAllocator::RequestCount(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
479 |
cacheValues.iRequestCountPeak = RequestAllocator::RequestCountPeak(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
480 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
481 |
cacheValues.iOpFreeCount= OperationAllocator::FreeCount(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
482 |
cacheValues.iOpRequestCount= OperationAllocator::RequestCount(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
483 |
cacheValues.iOpRequestCountPeak = OperationAllocator::RequestCountPeak(); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
484 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
485 |
|
0 | 486 |
TPckgBuf<TIOCacheValues> pkgBuf(cacheValues); |
487 |
||
488 |
// ensure we only write what the client buffer can hold - |
|
489 |
// this allows TIOCacheValues to increase in size without breaking BC |
|
490 |
pkgBuf.SetLength(Min(pkgBuf.MaxLength(), aRequest->Message().GetDesMaxLengthL(2))); |
|
491 |
||
492 |
TInt r=aRequest->Write(2,pkgBuf); |
|
493 |
return r; |
|
494 |
} |
|
495 |
case KControlIoGetLocalDriveNumber: |
|
496 |
{ |
|
497 |
return DriveNumberToLocalDriveNumber(aRequest->Drive()->DriveNumber()); |
|
498 |
} |
|
499 |
case KControlIoCancelDeferredDismount: |
|
500 |
{ |
|
501 |
// Cancel and clear deferred dismount information |
|
502 |
aRequest->Drive()->ClearDeferredDismount(); |
|
503 |
return KErrNone; |
|
504 |
} |
|
505 |
case KControlIoFileCacheStats: |
|
506 |
{ |
|
507 |
CCacheManager* manager = CCacheManagerFactory::CacheManager(); |
|
508 |
if (manager == NULL) |
|
509 |
return KErrNotSupported; |
|
510 |
||
511 |
TFileCacheStats& stats = manager->Stats(); |
|
512 |
||
513 |
TPckgBuf<TFileCacheStats> pkgBuf(stats); |
|
514 |
TInt r=aRequest->Write(2,pkgBuf); |
|
515 |
return r; |
|
516 |
} |
|
517 |
case KControlIoFileCacheConfig: |
|
518 |
{ |
|
519 |
TInt driveNumber = aRequest->Drive()->DriveNumber(); |
|
520 |
||
521 |
TFileCacheSettings::TFileCacheConfig* driveConfig = NULL; |
|
522 |
TInt r = TFileCacheSettings::GetFileCacheConfig(driveNumber, driveConfig); |
|
523 |
if (( r != KErrNone) || (driveConfig == NULL)) |
|
524 |
return KErrNotSupported; |
|
525 |
||
526 |
TFileCacheConfig config; |
|
527 |
config.iDrive = driveConfig->iDrive; |
|
528 |
config.iFlags = driveConfig->iFlags; |
|
529 |
config.iFileCacheReadAsync = driveConfig->iFileCacheReadAsync; |
|
530 |
config.iFairSchedulingLen = driveConfig->iFairSchedulingLen; |
|
531 |
config.iCacheSize = driveConfig->iCacheSize; |
|
532 |
config.iMaxReadAheadLen = driveConfig->iMaxReadAheadLen; |
|
533 |
config.iClosedFileKeepAliveTime = driveConfig->iClosedFileKeepAliveTime; |
|
534 |
config.iDirtyDataFlushTime = driveConfig->iDirtyDataFlushTime; |
|
535 |
||
536 |
TPckgBuf<TFileCacheConfig> pkgBuf(config); |
|
537 |
r=aRequest->Write(2,pkgBuf); |
|
538 |
return r; |
|
539 |
} |
|
540 |
case KControlIoFileCacheFlagsWrite: |
|
541 |
{ |
|
542 |
TInt drive = aRequest->Message().Int0(); |
|
543 |
||
544 |
TPckgBuf<TFileCacheFlags> driveFlagsPkg; |
|
545 |
TFileCacheFlags& driveFlags = driveFlagsPkg(); |
|
546 |
||
547 |
TInt r = aRequest->Read(2, driveFlagsPkg); |
|
548 |
if (r != KErrNone) |
|
549 |
return r; |
|
550 |
||
551 |
__CACHE_PRINT2(_L("CACHE: TFileCacheFlags %x on drive %d"), driveFlags, drive); |
|
552 |
TFileCacheSettings::SetFlags(drive, driveFlags); |
|
553 |
||
554 |
return r; |
|
555 |
} |
|
556 |
case KControlIoFlushClosedFiles: |
|
557 |
{ |
|
558 |
TClosedFileUtils::Remove(); |
|
559 |
return KErrNone; |
|
560 |
} |
|
561 |
case KControlIoSimulateLockFailureMode: |
|
562 |
{ |
|
563 |
TPckgBuf<TBool> enabledPkg; |
|
564 |
TInt r = aRequest->Read(2, enabledPkg); |
|
565 |
if (r != KErrNone) |
|
566 |
return r; |
|
567 |
||
568 |
CCacheManager* manager = CCacheManagerFactory::CacheManager(); |
|
569 |
if (manager == NULL) |
|
570 |
return KErrNotSupported; |
|
571 |
manager->SimulateLockFailureMode(enabledPkg()); |
|
572 |
return KErrNone; |
|
573 |
} |
|
574 |
case KControlIoSimulateFileCacheWriteFailure: |
|
575 |
{ |
|
576 |
CCacheManager* manager = CCacheManagerFactory::CacheManager(); |
|
577 |
if (manager == NULL) |
|
578 |
return KErrNotSupported; |
|
579 |
manager->SimulateWriteFailure(); |
|
580 |
return KErrNone; |
|
581 |
} |
|
582 |
case KControlIoFileCacheDump: |
|
583 |
{ |
|
584 |
CCacheManager* manager = CCacheManagerFactory::CacheManager(); |
|
585 |
if (manager == NULL) |
|
586 |
return KErrNotSupported; |
|
587 |
manager->DumpCache(); |
|
588 |
return KErrNone; |
|
589 |
} |
|
590 |
case KControlIoAllocateMaxSegments: |
|
591 |
{ |
|
592 |
TPckgBuf<TBool> enabledPkg; |
|
593 |
TInt r = aRequest->Read(2, enabledPkg); |
|
594 |
if (r != KErrNone) |
|
595 |
return r; |
|
596 |
||
597 |
CCacheManager* manager = CCacheManagerFactory::CacheManager(); |
|
598 |
if (manager == NULL) |
|
599 |
return KErrNotSupported; |
|
600 |
manager->AllocateMaxSegments(enabledPkg()); |
|
601 |
return KErrNone; |
|
602 |
} |
|
603 |
case KControlIoDisableFatUtilityFunctions: |
|
604 |
{ |
|
605 |
EnableFatUtilityFunctions = EFalse; |
|
606 |
return KErrNone; |
|
607 |
} |
|
608 |
case KControlIoEnableFatUtilityFunctions: |
|
609 |
{ |
|
610 |
EnableFatUtilityFunctions = ETrue; |
|
611 |
return KErrNone; |
|
612 |
} |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
613 |
case KControlIoSessionCount: |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
614 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
615 |
TPckgBuf<TInt> pkgBuf(SessionCount); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
616 |
TInt r=aRequest->Write(2,pkgBuf); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
617 |
return r; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
618 |
} |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
619 |
case KControlIoObjectCount: |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
620 |
{ |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
621 |
TPckgBuf<TInt> pkgBuf(ObjectCount); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
622 |
TInt r=aRequest->Write(2,pkgBuf); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
623 |
return r; |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
624 |
} |
109
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
625 |
// Check if the file is in 'file sequential/non-rugged file' mode |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
626 |
case KControlIoIsFileSequential: |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
627 |
{ |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
628 |
TDrive* drive = aRequest->Drive(); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
629 |
if(!drive) |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
630 |
return KErrNotSupported; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
631 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
632 |
// RFs::ControlIO uses narrow descriptors, so convert narrow back to wide |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
633 |
TBuf8<KMaxPath> fileNameNarrow; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
634 |
TInt r = aRequest->Read(2, fileNameNarrow); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
635 |
if (r != KErrNone) |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
636 |
return r; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
637 |
TFileName fileNameWide; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
638 |
fileNameWide.Copy(fileNameNarrow); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
639 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
640 |
// Locate the file |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
641 |
CFileCB* file = drive->LocateFile(fileNameWide); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
642 |
if(!file) |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
643 |
return KErrNotFound; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
644 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
645 |
// isFileSequential = 1 or 0 for EFileSequential mode enabled or disabled respectively |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
646 |
TUint8 isFileSequential = (file->IsSequentialMode() != 0); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
647 |
TPtr8 pkgBuf(&isFileSequential,1,1); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
648 |
aRequest->Write(3, pkgBuf); |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
649 |
|
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
650 |
return KErrNone; |
b3a1d9898418
Revision: 201019
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
90
diff
changeset
|
651 |
} |
201
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
652 |
case KControlIoGlobalCacheConfig: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
653 |
// read ESTART.TXT file for global memory settings |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
654 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
655 |
TGlobalCacheConfig globalCacheConfig; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
656 |
TInt32 rel; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
657 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
658 |
const TInt KByteToByteShift = 10; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
659 |
_LIT8(KLitSectionNameCacheMemory,"CacheMemory"); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
660 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
661 |
if (F32Properties::GetInt(KLitSectionNameCacheMemory, _L8("GlobalCacheMemorySize"), rel)) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
662 |
globalCacheConfig.iGlobalCacheSizeInBytes = rel << KByteToByteShift; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
663 |
else |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
664 |
globalCacheConfig.iGlobalCacheSizeInBytes = KErrNotFound; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
665 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
666 |
if (F32Properties::GetInt(KLitSectionNameCacheMemory, _L8("LowMemoryThreshold"), rel)) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
667 |
globalCacheConfig.iGlobalLowMemoryThreshold = rel; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
668 |
else |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
669 |
globalCacheConfig.iGlobalLowMemoryThreshold = KErrNotFound; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
670 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
671 |
TPckgBuf<TGlobalCacheConfig> pkgBuf(globalCacheConfig); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
672 |
TInt r=aRequest->Write(2,pkgBuf); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
673 |
return r; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
674 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
675 |
case KControlIoGlobalCacheInfo: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
676 |
// get system's current global cache memory info |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
677 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
678 |
TGlobalCacheInfo info; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
679 |
info.iGlobalCacheSizeInBytes = TGlobalCacheMemorySettings::CacheSize(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
680 |
info.iGlobalLowMemoryThreshold = TGlobalCacheMemorySettings::LowMemoryThreshold(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
681 |
TPckgBuf<TGlobalCacheInfo> pkgBuf(info); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
682 |
TInt r=aRequest->Write(2,pkgBuf); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
683 |
return r; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
684 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
685 |
case KControlIoDirCacheConfig: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
686 |
// read ESTART.TXT file for per-drive directory cache settings |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
687 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
688 |
TInt driveNumber = aRequest->Drive()->DriveNumber(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
689 |
TDirCacheConfig dirCacheConfig; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
690 |
TInt32 rel; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
691 |
dirCacheConfig.iDrive = driveNumber; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
692 |
TBuf8<32> driveSection; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
693 |
driveSection.Format(_L8("Drive%c"), 'A' + driveNumber); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
694 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
695 |
if (F32Properties::GetInt(driveSection, _L8("FAT_LeafDirCacheSize"), rel)) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
696 |
dirCacheConfig.iLeafDirCacheSize = rel; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
697 |
else |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
698 |
dirCacheConfig.iLeafDirCacheSize = KErrNotFound; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
699 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
700 |
if (F32Properties::GetInt(driveSection, _L8("FAT_DirCacheSizeMin"), rel)) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
701 |
dirCacheConfig.iDirCacheSizeMin = rel << KByteToByteShift; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
702 |
else |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
703 |
dirCacheConfig.iDirCacheSizeMin = KErrNotFound; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
704 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
705 |
if (F32Properties::GetInt(driveSection, _L8("FAT_DirCacheSizeMax"), rel)) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
706 |
dirCacheConfig.iDirCacheSizeMax = rel << KByteToByteShift; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
707 |
else |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
708 |
dirCacheConfig.iDirCacheSizeMax = KErrNotFound; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
709 |
|
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
710 |
TPckgBuf<TDirCacheConfig> pkgBuf(dirCacheConfig); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
711 |
TInt r=aRequest->Write(2,pkgBuf); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
712 |
return r; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
713 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
714 |
case KControlIoDirCacheInfo: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
715 |
// get system's current per-drive directory cache settings |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
716 |
// currently only supports FAT file system |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
717 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
718 |
TFSName fsName; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
719 |
aRequest->Drive()->CurrentMount().FileSystemName(fsName); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
720 |
if (fsName.CompareF(KFileSystemName_FAT) == 0) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
721 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
722 |
// 16 is the control cmd used for FAT |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
723 |
// see EFATDirCacheInfo in FAT code please. |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
724 |
const TInt KFATDirCacheInfo = 16; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
725 |
return(aRequest->Drive()->ControlIO(aRequest->Message(),KFATDirCacheInfo,param1,param2)); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
726 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
727 |
return KErrNotSupported; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
728 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
729 |
case KControlIoSimulateMemoryLow: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
730 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
731 |
CCacheMemoryManager* cacheMemManager = CCacheMemoryManagerFactory::CacheMemoryManager(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
732 |
if (cacheMemManager) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
733 |
cacheMemManager->SetMemoryLow(ETrue); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
734 |
else |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
735 |
return KErrNotSupported; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
736 |
return KErrNone; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
737 |
} |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
738 |
case KControlIoStopSimulateMemoryLow: |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
739 |
{ |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
740 |
CCacheMemoryManager* cacheMemManager = CCacheMemoryManagerFactory::CacheMemoryManager(); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
741 |
if (cacheMemManager) |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
742 |
cacheMemManager->SetMemoryLow(EFalse); |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
743 |
else |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
744 |
return KErrNotSupported; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
745 |
return KErrNone; |
43365a9b78a3
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
109
diff
changeset
|
746 |
} |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
747 |
|
0 | 748 |
} |
749 |
#endif |
|
750 |
||
751 |
return(aRequest->Drive()->ControlIO(aRequest->Message(),command,param1,param2)); |
|
752 |
} |
|
753 |
||
754 |
TInt TFsControlIo::Initialise(CFsRequest* aRequest) |
|
755 |
// |
|
756 |
// General purpose test interface - .FSY specific. |
|
757 |
// Not in the release build |
|
758 |
// |
|
759 |
{ |
|
760 |
TInt driveNumber=aRequest->Message().Int0(); |
|
761 |
if(driveNumber<0||driveNumber>=KMaxDrives) |
|
762 |
return(KErrArgument); |
|
763 |
ValidateDriveDoSubst(driveNumber,aRequest); |
|
764 |
return KErrNone; |
|
765 |
} |
|
766 |