author | hgs |
Mon, 04 Oct 2010 12:15:59 +0100 | |
changeset 280 | 2bfb1feef9de |
parent 273 | 6a75fa55495f |
child 286 | 48e57fb1237e |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 1995-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_ses.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "sf_std.h" |
|
19 |
#include "sf_file_cache.h" |
|
20 |
#include "sf_memory_man.h" |
|
21 |
#ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION |
|
22 |
#include "sf_notifier.h" |
|
23 |
#endif //SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION |
|
24 |
||
273 | 25 |
TInt CancelAsyncRequests(CSessionFs* aSession); |
26 |
||
27 |
||
0 | 28 |
CSessionFs::CSessionFs() |
29 |
:iSessionFlags((TInt)EFsSessionFlagsAll), |
|
30 |
iReservedDriveAccess(KReservedDriveAccessArrayGranularity, _FOFF(TReservedDriveAccess, iDriveNumber)), |
|
273 | 31 |
iId(0), iAccessCount(1) |
0 | 32 |
{ |
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
33 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
34 |
__e32_atomic_add_ord32(&SessionCount, 1); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
35 |
#endif |
0 | 36 |
} |
37 |
||
38 |
CSessionFs *CSessionFs::NewL() |
|
39 |
{ |
|
40 |
return new(ELeave) CSessionFs; |
|
41 |
} |
|
42 |
||
43 |
CSessionFs::~CSessionFs() |
|
44 |
{ |
|
45 |
__PRINT1(_L("CSessionFs::~CSessionFs() deleting... = 0x%x"),this); |
|
46 |
||
273 | 47 |
FsNotify::CancelSession(this); |
48 |
||
49 |
#ifdef SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION |
|
50 |
FsNotificationManager::RemoveNotificationRequest(this); |
|
51 |
#endif //SYMBIAN_F32_ENHANCED_CHANGE_NOTIFICATION |
|
52 |
||
53 |
||
0 | 54 |
//take out all the reserved space set by this session |
55 |
while(iReservedDriveAccess.Count()) |
|
56 |
{ |
|
57 |
TReservedDriveAccess& reserved = iReservedDriveAccess[0]; |
|
58 |
if(reserved.iReservedSpace) |
|
59 |
{ |
|
60 |
TheDrives[reserved.iDriveNumber].SetReservedSpace(TheDrives[reserved.iDriveNumber].ReservedSpace() - reserved.iReservedSpace); |
|
61 |
__ASSERT_DEBUG(TheDrives[reserved.iDriveNumber].ReservedSpace() >= 0,Fault(EReserveSpaceArithmetic)); |
|
62 |
} |
|
63 |
iReservedDriveAccess.Remove(0); |
|
64 |
} |
|
65 |
iReservedDriveAccess.Close(); |
|
66 |
||
67 |
||
68 |
// Need to free the requests that we own from the close queue |
|
69 |
while (iCloseRequestCount > 0) |
|
70 |
RequestAllocator::OpenSubFailed(this); |
|
71 |
||
72 |
if (iHandles) |
|
73 |
delete iHandles; |
|
74 |
||
75 |
||
76 |
delete iPath; |
|
77 |
iSessionFlagsLock.Close(); |
|
90
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
78 |
|
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
79 |
#if defined(_DEBUG) || defined(_DEBUG_RELEASE) |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
80 |
__e32_atomic_add_ord32(&SessionCount, (TUint32) -1); |
947f0dc9f7a8
Revision: 201015
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
81 |
#endif |
0 | 82 |
} |
83 |
||
273 | 84 |
void CSessionFs::Close() |
85 |
{ |
|
86 |
TheFileServer->SessionQueueLockWait(); |
|
87 |
||
88 |
if (iAccessCount == 1) |
|
89 |
{ |
|
90 |
// close the objects owned by this session |
|
91 |
// NB closing a CFileShare may allocate a request to flush dirty data which will |
|
92 |
// in turn increment iAccessCount on this session |
|
93 |
if (iHandles) |
|
94 |
{ |
|
95 |
// Cancel any ASYNC requests belonging to this session BEFORE |
|
96 |
// CSessionFs is deleted to avoid a KERN-EXEC 44 (EBadMessageHandle) |
|
97 |
CancelAsyncRequests(this); |
|
98 |
delete iHandles; |
|
99 |
iHandles = NULL; |
|
100 |
} |
|
101 |
} |
|
102 |
||
103 |
if (__e32_atomic_tas_ord32(&iAccessCount, 1, -1, 0) == 1) |
|
104 |
{ |
|
105 |
RMessage2 message = iMessage; |
|
106 |
delete this; |
|
107 |
// NB Must complete the message AFTER the session has been deleted... |
|
108 |
message.Complete(KErrNone); |
|
109 |
} |
|
110 |
||
111 |
TheFileServer->SessionQueueLockSignal(); |
|
112 |
} |
|
113 |
||
0 | 114 |
void CSessionFs::CreateL() |
115 |
// |
|
116 |
// Create any additional resources. |
|
117 |
// |
|
118 |
{ |
|
119 |
__PRINT1(_L("CSessionFs::CreateL 0x%x"),this); |
|
120 |
||
121 |
iHandles=CFsObjectIx::NewL(); |
|
122 |
TInt r = iSessionFlagsLock.CreateLocal(); |
|
123 |
User::LeaveIfError(r); |
|
124 |
} |
|
125 |
||
126 |
TInt CSessionFs::CurrentDrive() |
|
127 |
// |
|
128 |
// Return the current drive. |
|
129 |
// |
|
130 |
{ |
|
131 |
||
132 |
TInt d; |
|
133 |
TInt r=RFs::CharToDrive(Path()[0],d); |
|
134 |
__ASSERT_ALWAYS(r==KErrNone,Fault(ESesPathBadDrive)); |
|
135 |
return(d); |
|
136 |
} |
|
137 |
||
138 |
TInt CSessionFs::CountResources() |
|
139 |
// |
|
140 |
// Return the number of resources owned by the session |
|
141 |
// |
|
142 |
{ |
|
143 |
/* what's this supposed to be doing ?? |
|
144 |
TInt count=User::LockedInc(iResourceCount); |
|
145 |
User::LockedDec(iResourceCount); |
|
146 |
return(count); |
|
147 |
*/ |
|
148 |
||
149 |
return iResourceCount; // ... because that's all it does. |
|
150 |
} |
|
151 |
||
152 |
void CSessionFs::ResourceCountMarkStart() |
|
153 |
// |
|
154 |
// Mark resources at this point |
|
155 |
// |
|
156 |
{ |
|
157 |
iResourceCountMark = CountResources(); |
|
158 |
} |
|
159 |
||
160 |
void CSessionFs::ResourceCountMarkEnd(const RMessage2& aMessage) |
|
161 |
// |
|
162 |
// End resource count and check same as count start |
|
163 |
// |
|
164 |
{ |
|
165 |
if (iResourceCountMark!=CountResources()) |
|
166 |
{ |
|
167 |
_LIT(KCategory,"CSessionFs"); |
|
168 |
aMessage.Panic(KCategory,ESesFoundResCountHeaven); |
|
169 |
} |
|
170 |
else |
|
171 |
aMessage.Complete(KErrNone); |
|
172 |
} |
|
173 |
||
174 |
void CSessionFs::Disconnect(const RMessage2& aMessage) |
|
175 |
{ |
|
176 |
__THRD_PRINT1(_L("CSessionFs::Disconnect() 0x%x"),this); |
|
177 |
||
178 |
iHandles->CloseMainThreadObjects(); |
|
273 | 179 |
iMessage = aMessage; |
0 | 180 |
|
273 | 181 |
// close the session - if there are no requests using this session then the session will be freed |
182 |
Close(); |
|
0 | 183 |
} |
184 |
||
185 |
||
186 |
TUint CSessionFs::Reserved(TInt aDriveNumber) const |
|
187 |
{ |
|
188 |
TReservedDriveAccess reserved(aDriveNumber); |
|
189 |
TInt idx = iReservedDriveAccess.Find(reserved); |
|
190 |
if(idx == KErrNotFound) |
|
191 |
return 0; |
|
192 |
||
193 |
return iReservedDriveAccess[idx].iReservedSpace; |
|
194 |
} |
|
195 |
||
196 |
||
197 |
TInt CSessionFs::SetReserved(const TInt aDriveNumber, const TInt aReservedValue) |
|
198 |
{ |
|
199 |
TReservedDriveAccess reserved(aDriveNumber, aReservedValue); |
|
200 |
TInt idx = iReservedDriveAccess.Find(reserved); |
|
201 |
if(idx == KErrNotFound) |
|
202 |
return iReservedDriveAccess.InsertInSignedKeyOrder(reserved); |
|
203 |
||
204 |
iReservedDriveAccess[idx].iReservedSpace = aReservedValue; |
|
205 |
return KErrNone; |
|
206 |
||
207 |
} |
|
208 |
||
209 |
||
210 |
TBool CSessionFs::ReservedAccess(TInt aDriveNumber) const |
|
211 |
{ |
|
212 |
TReservedDriveAccess reserved(aDriveNumber); |
|
213 |
TInt idx = iReservedDriveAccess.Find(reserved); |
|
214 |
return idx == KErrNotFound ? EFalse : iReservedDriveAccess[idx].iReservedAccess; |
|
215 |
} |
|
216 |
||
217 |
||
218 |
void CSessionFs::SetReservedAccess(const TInt aDriveNumber, const TBool aReservedAccess) |
|
219 |
{ |
|
220 |
TReservedDriveAccess reserved(aDriveNumber); |
|
221 |
TInt idx = iReservedDriveAccess.Find(reserved); |
|
222 |
if(idx != KErrNotFound) |
|
223 |
iReservedDriveAccess[idx].iReservedAccess = aReservedAccess; |
|
224 |
} |
|
225 |
||
226 |
TBool CSessionFs::IsChangeNotify() |
|
227 |
{ |
|
228 |
return TestSessionFlags(EFsSessionNotifyChange); |
|
229 |
} |
|
230 |
||
231 |
||
232 |
TBool CSessionFs::TestSessionFlags(TUint32 aFlags) |
|
233 |
{ |
|
234 |
iSessionFlagsLock.Wait(); |
|
235 |
TBool b = (iSessionFlags & aFlags) == aFlags; |
|
236 |
iSessionFlagsLock.Signal(); |
|
237 |
return(b); |
|
238 |
} |
|
239 |
||
240 |
||
241 |
void CSessionFs::SetSessionFlags(TUint32 aBitsToSet, TUint32 aBitsToClear) |
|
242 |
{ |
|
243 |
iSessionFlagsLock.Wait(); |
|
244 |
||
245 |
iSessionFlags &= ~aBitsToClear; |
|
246 |
iSessionFlags |= aBitsToSet; |
|
247 |
||
248 |
iSessionFlagsLock.Signal(); |
|
249 |
} |
|
250 |
||
251 |
void CSessionFs::CloseRequestCountInc() |
|
252 |
{ |
|
253 |
iSessionFlagsLock.Wait(); |
|
254 |
iCloseRequestCount++; |
|
255 |
iSessionFlagsLock.Signal(); |
|
256 |
} |
|
257 |
||
258 |
void CSessionFs::CloseRequestCountDec() |
|
259 |
{ |
|
260 |
iSessionFlagsLock.Wait(); |
|
261 |
iCloseRequestCount--; |
|
262 |
iSessionFlagsLock.Signal(); |
|
263 |
} |
|
264 |
||
265 |
// |
|
266 |
// Start resource count |
|
267 |
// |
|
268 |
TInt TFsResourceCountMarkStart::DoRequestL(CFsRequest* aRequest) |
|
269 |
{ |
|
270 |
aRequest->Session()->ResourceCountMarkStart(); |
|
271 |
return(KErrNone); |
|
272 |
} |
|
273 |
||
274 |
TInt TFsResourceCountMarkStart::Initialise(CFsRequest* /*aRequest*/) |
|
275 |
{ |
|
276 |
return KErrNone; |
|
277 |
} |
|
278 |
||
279 |
||
280 |
// |
|
281 |
// Check for resource heaven |
|
282 |
// |
|
283 |
TInt TFsResourceCountMarkEnd::DoRequestL(CFsRequest* aRequest) |
|
284 |
{ |
|
285 |
aRequest->Session()->ResourceCountMarkEnd(aRequest->Message()); |
|
286 |
return(KErrNone); |
|
287 |
} |
|
288 |
||
289 |
TInt TFsResourceCountMarkEnd::Initialise(CFsRequest* /*aRequest*/) |
|
290 |
{ |
|
291 |
return KErrNone; |
|
292 |
} |
|
293 |
||
294 |
||
295 |
// |
|
296 |
// Return the number of resources owned by the session |
|
297 |
// |
|
298 |
TInt TFsResourceCount::DoRequestL(CFsRequest* aRequest) |
|
299 |
{ |
|
300 |
TInt resCount=aRequest->Session()->CountResources(); |
|
301 |
TPckgC<TInt> pckg(resCount); |
|
302 |
aRequest->WriteL(KMsgPtr0,pckg); |
|
303 |
return(KErrNone); |
|
304 |
} |
|
305 |
||
306 |
TInt TFsResourceCount::Initialise(CFsRequest* /*aRequest*/) |
|
307 |
{ |
|
308 |
return KErrNone; |
|
309 |
} |
|
310 |
||
311 |
||
312 |
// |
|
313 |
// Set iNotifyUser |
|
314 |
// |
|
315 |
void CSessionFs::SetNotifyUser(TBool aNotification) |
|
316 |
{ |
|
317 |
if(aNotification) |
|
318 |
{ |
|
319 |
SetSessionFlags(EFsSessionNotifyUser, 0); |
|
320 |
} |
|
321 |
else |
|
322 |
{ |
|
323 |
SetSessionFlags(0, EFsSessionNotifyUser); |
|
324 |
} |
|
325 |
} |
|
326 |
||
327 |
// |
|
328 |
// Get iNotifyUser |
|
329 |
// |
|
330 |
TBool CSessionFs::GetNotifyUser() |
|
331 |
{ |
|
332 |
return TestSessionFlags(EFsSessionNotifyUser); |
|
333 |
} |
|
334 |
||
335 |
// |
|
336 |
// Notify the user of any read or write failure |
|
337 |
// |
|
338 |
TInt TFsSetNotifyUser::DoRequestL(CFsRequest* aRequest) |
|
339 |
{ |
|
340 |
TBool notification=aRequest->Message().Int0(); |
|
341 |
aRequest->Session()->SetNotifyUser(notification); |
|
342 |
return(KErrNone); |
|
343 |
} |
|
344 |
||
345 |
TInt TFsSetNotifyUser::Initialise(CFsRequest* /*aRequest*/) |
|
346 |
{ |
|
347 |
return KErrNone; |
|
348 |
} |
|
349 |
||
350 |
||
351 |
// |
|
352 |
// Notify the user of any read or write failure |
|
353 |
// |
|
354 |
TInt TFsGetNotifyUser::DoRequestL(CFsRequest* aRequest) |
|
355 |
{ |
|
356 |
TBool notification=aRequest->Session()->GetNotifyUser(); |
|
357 |
TPtrC8 pA((TUint8*)¬ification,sizeof(TBool)); |
|
358 |
aRequest->WriteL(KMsgPtr0,pA); |
|
359 |
return(KErrNone); |
|
360 |
} |
|
361 |
||
362 |
TInt TFsGetNotifyUser::Initialise(CFsRequest* /*aRequest*/) |
|
363 |
{ |
|
364 |
return KErrNone; |
|
365 |
} |
|
366 |
||
367 |
||
368 |
// |
|
369 |
// Get the drive name |
|
370 |
// |
|
371 |
TInt TFsGetDriveName::DoRequestL(CFsRequest* aRequest) |
|
372 |
{ |
|
373 |
TInt driveNum=aRequest->Drive()->DriveNumber(); |
|
374 |
TFileName driveName; |
|
375 |
if (TheDriveNames[driveNum]==NULL) |
|
376 |
driveName.SetLength(0); |
|
377 |
else |
|
378 |
driveName=(*TheDriveNames[driveNum]); |
|
379 |
aRequest->WriteL(KMsgPtr1,driveName); |
|
380 |
return(KErrNone); |
|
381 |
} |
|
382 |
||
383 |
||
384 |
TInt TFsGetDriveName::Initialise(CFsRequest* aRequest) |
|
385 |
{ |
|
386 |
TInt r=ValidateDrive(aRequest->Message().Int0(),aRequest); |
|
387 |
return(r); |
|
388 |
} |
|
389 |
||
390 |
||
391 |
||
392 |
// |
|
393 |
// Set the drive name |
|
394 |
// |
|
395 |
TInt TFsSetDriveName::DoRequestL(CFsRequest* aRequest) |
|
396 |
{ |
|
397 |
TInt driveNum=aRequest->Drive()->DriveNumber(); |
|
398 |
TFileName driveName; |
|
399 |
aRequest->ReadL(KMsgPtr1,driveName); |
|
400 |
||
401 |
// Validate name - return KErrBadName if it contains illegal characters such as |
|
402 |
// * ? / | > < |
|
403 |
||
404 |
TNameChecker checker(driveName); |
|
405 |
TText badChar; |
|
406 |
if (checker.IsIllegalName(badChar)) |
|
407 |
return(KErrBadName); |
|
408 |
||
409 |
TInt len=((driveName.Length()+31)>>5)<<5; // % 32 |
|
410 |
if (TheDriveNames[driveNum]==NULL) |
|
411 |
TheDriveNames[driveNum]=HBufC::New(len); |
|
412 |
else if (TheDriveNames[driveNum]->Des().MaxLength()<len) |
|
413 |
{ |
|
414 |
HBufC* temp=TheDriveNames[driveNum]->ReAlloc(len); |
|
415 |
if (temp==NULL) |
|
416 |
return(KErrNoMemory); |
|
417 |
TheDriveNames[driveNum]=temp; |
|
418 |
} |
|
419 |
if (TheDriveNames[driveNum]==NULL || TheDriveNames[driveNum]->Des().MaxLength()<len) |
|
420 |
return(KErrNoMemory); |
|
421 |
*TheDriveNames[driveNum]=driveName; |
|
422 |
return(KErrNone); |
|
423 |
} |
|
424 |
||
425 |
TInt TFsSetDriveName::Initialise(CFsRequest* aRequest) |
|
426 |
{ |
|
427 |
TInt r=ValidateDrive(aRequest->Message().Int0(),aRequest); |
|
428 |
if (r!=KErrNone) |
|
429 |
return(r); |
|
430 |
if (!KCapFsSetDriveName.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Set Drive Name"))) |
|
431 |
return KErrPermissionDenied; |
|
432 |
return KErrNone; |
|
433 |
} |
|
434 |
||
435 |
TInt FlushCachedFiles(CSessionFs* aSession) |
|
436 |
{ |
|
437 |
TInt retVal = KErrNone; |
|
438 |
||
439 |
aSession->Handles().Lock(); |
|
440 |
TInt count = aSession->Handles().Count(); |
|
441 |
for (TInt n=0; n<count; n++) |
|
442 |
{ |
|
443 |
CObjPromotion* obj = (CObjPromotion*)aSession->Handles()[n]; |
|
444 |
if (obj != NULL && obj->UniqueID() == FileShares->UniqueID()) |
|
445 |
{ |
|
446 |
CFileShare* share = (CFileShare*) obj; |
|
447 |
if (!share->IsCorrectThread()) |
|
448 |
continue; |
|
449 |
CFileCB& file=((CFileShare*) obj)->File(); |
|
450 |
||
451 |
CFileCache* fileCache = file.FileCache(); |
|
452 |
if (fileCache) |
|
453 |
{ |
|
454 |
retVal = fileCache->FlushDirty(); |
|
455 |
if (retVal == CFsRequest::EReqActionBusy) |
|
456 |
break; |
|
457 |
} |
|
458 |
} |
|
459 |
} |
|
460 |
aSession->Handles().Unlock(); |
|
461 |
||
462 |
return retVal; |
|
463 |
} |
|
464 |
||
465 |
TInt TFsFlushDirtyData::DoRequestL(CFsRequest* aRequest) |
|
466 |
// |
|
467 |
// |
|
468 |
// |
|
469 |
{ |
|
470 |
__CHECK_DRIVETHREAD(aRequest->DriveNumber()); |
|
471 |
||
472 |
// Flush all dirty data |
|
473 |
TInt r = FlushCachedFiles(aRequest->Session()); |
|
474 |
if (r == CFsRequest::EReqActionBusy) |
|
475 |
return r; |
|
476 |
return KErrNone; |
|
477 |
} |
|
478 |
||
479 |
TInt TFsFlushDirtyData::Initialise(CFsRequest* /*aRequest*/) |
|
480 |
// |
|
481 |
// |
|
482 |
// |
|
483 |
{ |
|
484 |
return(KErrNone); |
|
485 |
} |
|
486 |
||
487 |
||
488 |
// Iterate though all file shares owned by this session and cancel any async requests |
|
489 |
TInt CancelAsyncRequests(CSessionFs* aSession) |
|
490 |
{ |
|
491 |
TInt retVal = KErrNone; |
|
492 |
||
493 |
aSession->Handles().Lock(); |
|
494 |
TInt count = aSession->Handles().Count(); |
|
495 |
for (TInt n=0; n<count; n++) |
|
496 |
{ |
|
497 |
CObjPromotion* obj = (CObjPromotion*)aSession->Handles()[n]; |
|
498 |
if (obj != NULL && obj->UniqueID() == FileShares->UniqueID()) |
|
499 |
{ |
|
500 |
CFileShare* share = (CFileShare*) obj; |
|
501 |
if (!share->IsCorrectThread()) |
|
502 |
continue; |
|
503 |
CFileCB& file=((CFileShare*) obj)->File(); |
|
504 |
file.CancelAsyncReadRequest(share, NULL); |
|
505 |
} |
|
506 |
} |
|
507 |
aSession->Handles().Unlock(); |
|
508 |
||
509 |
return retVal; |
|
510 |
} |
|
511 |
||
512 |
||
513 |
||
514 |
TInt TFsSetSessionFlags::DoRequestL(CFsRequest* aRequest) |
|
515 |
{ |
|
516 |
aRequest->Session()->SetSessionFlags(aRequest->Message().Int0(), aRequest->Message().Int1()); |
|
517 |
return(KErrNone); |
|
518 |
} |
|
519 |
||
520 |
TInt TFsSetSessionFlags::Initialise(CFsRequest* aRequest) |
|
521 |
{ |
|
522 |
if (!KCapFsPlugin. CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Set Session Flags"))) |
|
523 |
return KErrPermissionDenied; |
|
524 |
return KErrNone; |
|
525 |
} |
|
526 |
||
527 |
TInt TFsInitialisePropertiesFile::DoRequestL(CFsRequest* aRequest) |
|
528 |
{ |
|
529 |
__PRINT(_L("**TFsInitialisePropertiesFile::DoRequestL**\n")); |
|
530 |
TInt err = KErrNone; |
|
531 |
TInt leaveErr = KErrNone; |
|
532 |
const TBool isRomParam = aRequest->Message().Int2(); |
|
533 |
if(isRomParam) |
|
534 |
{ |
|
535 |
const TAny* romAddress = aRequest->Message().Ptr0(); |
|
536 |
TBool isInRom = EFalse; |
|
537 |
TRAP(leaveErr, User::IsRomAddress(isInRom, const_cast<TAny*>(romAddress))); |
|
538 |
if (leaveErr == KErrNone) |
|
539 |
{ |
|
540 |
const TInt length = aRequest->Message().Int1(); |
|
541 |
err = isInRom ? F32Properties::Initialise((TInt)romAddress, length) : KErrNotSupported; |
|
542 |
} |
|
543 |
} |
|
544 |
else |
|
545 |
{ |
|
546 |
err = KErrNotSupported; |
|
547 |
} |
|
548 |
||
549 |
#ifdef SYMBIAN_ENABLE_FAT_DIRECTORY_OPT |
|
550 |
// Create the global cache memory manager for FAT dir cache (and other caches). |
|
551 |
// Note: file cache uses its own cache memory manager. |
|
552 |
if (CCacheMemoryManagerFactory::CacheMemoryManager() == NULL) |
|
553 |
{ |
|
554 |
TGlobalCacheMemorySettings::ReadPropertiesFile(); |
|
555 |
TRAPD(r, CCacheMemoryManagerFactory::CreateL()); |
|
556 |
__ASSERT_ALWAYS(r==KErrNone,Fault(ECacheMemoryManagerCreateFailed)); |
|
557 |
} |
|
558 |
#endif // SYMBIAN_ENABLE_FAT_DIRECTORY_OPT |
|
559 |
||
560 |
// Create the page cache for file caching etc. |
|
561 |
TGlobalFileCacheSettings::ReadPropertiesFile(); |
|
562 |
if (TGlobalFileCacheSettings::Enabled()) |
|
563 |
{ |
|
564 |
TRAPD(r, CCacheManagerFactory::CreateL()); |
|
565 |
__ASSERT_ALWAYS(r==KErrNone,Fault(EFileCacheCreateFailed)); |
|
566 |
} |
|
567 |
||
568 |
User::LeaveIfError(leaveErr); |
|
569 |
return(err); |
|
570 |
} |
|
571 |
||
572 |
TInt TFsInitialisePropertiesFile::Initialise(CFsRequest* aRequest) |
|
573 |
{ |
|
574 |
if (!KCapDiskAdmin. CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Initialise Property File"))) |
|
575 |
{ |
|
576 |
return(KErrPermissionDenied); |
|
577 |
} |
|
578 |
||
579 |
if (aRequest->Message().SecureId() != KEstartUidValue) |
|
580 |
{ |
|
581 |
return(KErrPermissionDenied); |
|
582 |
} |
|
583 |
||
584 |
aRequest->SetDriveNumber(EDriveZ); |
|
585 |
return(KErrNone); |
|
586 |
} |