author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:34:56 +0100 | |
branch | RCL_3 |
changeset 257 | 3e88ff8f41d5 |
parent 62 | 4a8fed1c0ef6 |
child 273 | 6a75fa55495f |
permissions | -rw-r--r-- |
0 | 1 |
// Copyright (c) 2002-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_notif.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
18 |
#include "sf_std.h" |
|
19 |
||
20 |
||
21 |
||
22 |
TChangeQue FsNotify::iChangeQues[KMaxNotifyQues]; |
|
23 |
TDiskSpaceQue FsNotify::iDiskSpaceQues[KMaxDiskQues]; |
|
24 |
TDebugQue FsNotify::iDebugQue; |
|
25 |
TDismountNotifyQue FsNotify::iDismountNotifyQue; |
|
26 |
||
27 |
void CNotifyInfo::Initialise(TInfoType aType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession) |
|
28 |
// |
|
29 |
// |
|
30 |
// |
|
31 |
{ |
|
32 |
iType=aType; |
|
33 |
iStatus=aStatus; |
|
34 |
iMessage=aMessage; |
|
35 |
iSession=aSession; |
|
36 |
}; |
|
37 |
||
38 |
CNotifyInfo::~CNotifyInfo() |
|
39 |
// |
|
40 |
// |
|
41 |
// |
|
42 |
{ |
|
43 |
__ASSERT_DEBUG(!iLink.iNext,Fault(ENotifyInfoDestructor)); |
|
44 |
} |
|
45 |
||
46 |
void CNotifyInfo::Complete(TInt aError) |
|
47 |
// |
|
48 |
// |
|
49 |
// |
|
50 |
{ |
|
51 |
__PRINT2(_L("CNotifyInfo::Complete 0x%x error=%d"),this,aError); |
|
52 |
if (iType != EDismount || !iMessage.IsNull()) // Dismount notifiers may be completed but remain in the list |
|
53 |
{ // until handled by the client or the session is closed. |
|
54 |
iMessage.Complete(aError); |
|
55 |
} |
|
56 |
} |
|
57 |
||
58 |
||
59 |
void CStdChangeInfo::Initialise(TNotifyType aChangeType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession) |
|
60 |
// |
|
61 |
// |
|
62 |
// |
|
63 |
{ |
|
64 |
iChangeType=aChangeType; |
|
65 |
CNotifyInfo::Initialise(EStdChange,aStatus,aMessage,aSession); |
|
66 |
} |
|
67 |
||
68 |
TUint CStdChangeInfo::RequestNotifyType(CFsRequest* aRequest) |
|
69 |
// |
|
70 |
// return notification type for the request |
|
71 |
// |
|
72 |
{ |
|
73 |
TUint notifyType=aRequest->Operation()->NotifyType(); |
|
74 |
if(aRequest->Operation()->Function()==EFsRename) |
|
75 |
{ |
|
76 |
__ASSERT_DEBUG(notifyType==(ENotifyDir|ENotifyFile|ENotifyEntry),Fault(EStdChangeRequestType)); |
|
77 |
if(aRequest->Src().NamePresent()) |
|
78 |
notifyType=ENotifyFile|ENotifyEntry; |
|
79 |
else |
|
80 |
notifyType=ENotifyDir|ENotifyEntry; |
|
81 |
} |
|
82 |
return(notifyType); |
|
83 |
} |
|
84 |
||
85 |
TBool CStdChangeInfo::IsMatching(CFsRequest* aRequest) |
|
86 |
// |
|
87 |
// return ETrue if operation type of request matches that of change notification |
|
88 |
// |
|
89 |
{ |
|
90 |
if((iChangeType&ENotifyAll) || (iChangeType&aRequest->Operation()->NotifyType())) |
|
91 |
return(ETrue); |
|
92 |
else |
|
93 |
return(EFalse); |
|
94 |
} |
|
95 |
||
96 |
void CExtChangeInfo::Initialise(TNotifyType aChangeType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession,const TDesC& aName) |
|
97 |
// |
|
98 |
// |
|
99 |
// |
|
100 |
{ |
|
101 |
__ASSERT_DEBUG(aName.Length()<=KMaxFileName-2,Fault(EExtChangeNameLength)); |
|
102 |
iName=aName; |
|
103 |
iChangeType=aChangeType; |
|
104 |
CNotifyInfo::Initialise(EExtChange,aStatus,aMessage,aSession); |
|
105 |
} |
|
106 |
||
107 |
||
108 |
TBool CExtChangeInfo::IsMatching(CFsRequest* aRequest) |
|
109 |
// |
|
110 |
// return ETrue if operation notify type of request matches that of change notification |
|
111 |
// and paths match |
|
112 |
// |
|
113 |
{ |
|
114 |
TInt function=aRequest->Operation()->Function(); |
|
115 |
// if a rename occurred inform any requests if their path has been changed regardless of the notification type |
|
116 |
if(function==EFsRename) |
|
117 |
{ |
|
118 |
TBuf<KMaxFileName> renamePath=aRequest->Src().FullName().Mid(2); |
|
119 |
renamePath+=_L("*"); |
|
120 |
if (iName.MatchF(renamePath)!=KErrNotFound) |
|
121 |
return(ETrue); |
|
122 |
} |
|
123 |
||
124 |
||
125 |
//Special case where the dir the notifier is setup on has just been created |
|
126 |
if(function==EFsMkDir) |
|
127 |
{ |
|
128 |
TInt notDrive; |
|
129 |
RFs::CharToDrive(aRequest->Src().Drive()[0],notDrive); //can not fail as the drive letter has been parsed already |
|
130 |
if(aRequest->Src().Path().MatchF(iName) == 0 && aRequest->DriveNumber() == notDrive) |
|
131 |
return ETrue; |
|
132 |
} |
|
133 |
||
134 |
//Special case where the File the notifier is setup on has just been created by temp as the name is not known unti it has been created |
|
135 |
if(function==EFsRename||function==EFsFileOpen||function==EFsFileCreate||function==EFsFileReplace) |
|
136 |
{ |
|
137 |
TInt notDrive; |
|
138 |
RFs::CharToDrive(aRequest->Src().Drive()[0],notDrive); //can not fail as the drive letter has been parsed already |
|
139 |
if(aRequest->Src().FullName().Mid(2).MatchF(iName) == 0 && aRequest->DriveNumber() == notDrive) |
|
140 |
return ETrue; |
|
141 |
} |
|
142 |
||
143 |
//For the case of a file created using EFsFileTemp we can probably ignore it for special cases as it |
|
144 |
//is created with a random name. Not specifically going to be being looked for |
|
145 |
||
146 |
if((iChangeType&ENotifyAll) || (iChangeType&RequestNotifyType(aRequest))) |
|
147 |
{ |
|
148 |
switch (function) |
|
149 |
{ |
|
150 |
// Notify interested requests if a SetDriveName(), SetVolume() or RawDiskWrite() operation |
|
151 |
// occcurred. By their nature, these operations have no distinct path. All outstanding |
|
152 |
// requests monitoring the relevant TNotifyType are potentially interested in such operations |
|
153 |
case EFsFileWrite: |
|
154 |
case EFsFileWriteDirty: |
|
155 |
case EFsFileSet: |
|
156 |
case EFsFileSetAtt: |
|
157 |
case EFsFileSetModified: |
|
158 |
case EFsFileSetSize: |
|
159 |
{ |
|
160 |
TBuf<KMaxFileName> root=iName; |
|
161 |
root+=_L("*"); |
|
162 |
||
163 |
// NB share may be NULL if file server has initiated a flush of the file cache |
|
164 |
CFileShare* share; |
|
165 |
CFileCB* fileCache; |
|
166 |
GetFileFromScratch(aRequest, share, fileCache); |
|
167 |
if (share && share->File().FileName().MatchF(root) != KErrNotFound) |
|
168 |
return(ETrue); |
|
169 |
||
170 |
} |
|
171 |
break; |
|
172 |
case EFsSetDriveName: |
|
173 |
case EFsSetVolume: |
|
174 |
case EFsRawDiskWrite: |
|
175 |
case EFsLockDrive: |
|
176 |
case EFsUnlockDrive: |
|
177 |
case EFsReserveDriveSpace: |
|
178 |
{ |
|
179 |
return(ETrue); |
|
180 |
} |
|
181 |
||
182 |
default: |
|
183 |
{ |
|
184 |
TBuf<KMaxFileName> root = iName; |
|
185 |
root+=_L("*"); |
|
186 |
||
187 |
if(aRequest->Src().FullName().Mid(2).MatchF(root)!=KErrNotFound) |
|
188 |
return(ETrue); |
|
189 |
else if(function==EFsRename||function==EFsReplace||function==EFsFileRename) |
|
190 |
{ |
|
191 |
// - rename/replace causes the file/path to disappear |
|
192 |
if(aRequest->Dest().FullName().Mid(2).MatchF(root)!=KErrNotFound) |
|
193 |
{ |
|
194 |
return(ETrue); |
|
195 |
} |
|
196 |
||
197 |
// - rename/replace causes the file/path to arrive |
|
198 |
root=aRequest->Dest().FullName().Mid(2); |
|
199 |
root+=_L("*"); |
|
200 |
||
201 |
if (iName.MatchF(root)!=KErrNotFound) |
|
202 |
{ |
|
203 |
return(ETrue); |
|
204 |
} |
|
205 |
} |
|
206 |
} |
|
207 |
} |
|
208 |
} |
|
209 |
return(EFalse); |
|
210 |
} |
|
211 |
||
212 |
||
213 |
void CDiskSpaceInfo::Initialise(TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession,TInt64 aThreshold) |
|
214 |
// |
|
215 |
// |
|
216 |
// |
|
217 |
{ |
|
218 |
__ASSERT_DEBUG(aThreshold>0,Fault(EDiskSpaceThreshold)); |
|
219 |
iThreshold=aThreshold; |
|
220 |
CNotifyInfo::Initialise(EDiskSpace,aStatus,aMessage,aSession); |
|
221 |
} |
|
222 |
||
223 |
TBool CDiskSpaceInfo::IsMatching(TInt64& aBefore,TInt64& aAfter) |
|
224 |
// |
|
225 |
// return ETrue if the threshold has been crossed |
|
226 |
// |
|
227 |
{ |
|
228 |
if((aBefore>=iThreshold&&aAfter<iThreshold)||(aBefore<=iThreshold&&aAfter>iThreshold)) |
|
229 |
return(ETrue); |
|
230 |
return(EFalse); |
|
231 |
} |
|
232 |
||
233 |
void CDebugChangeInfo::Initialise(TUint aDebugType,TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession) |
|
234 |
// |
|
235 |
// |
|
236 |
// |
|
237 |
{ |
|
238 |
__ASSERT_DEBUG((aDebugType&KDebugNotifyMask)&&!(aDebugType&~KDebugNotifyMask),Fault(EDebugChangeType)); |
|
239 |
iDebugType=aDebugType; |
|
240 |
CNotifyInfo::Initialise(EDebugChange,aStatus,aMessage,aSession); |
|
241 |
} |
|
242 |
||
243 |
TBool CDebugChangeInfo::IsMatching(TUint aFunction) |
|
244 |
// |
|
245 |
// return ETrue if debug notification type matches aFunction |
|
246 |
// |
|
247 |
{ |
|
248 |
if(iDebugType&aFunction) |
|
249 |
return(ETrue); |
|
250 |
return(EFalse); |
|
251 |
} |
|
252 |
||
253 |
||
254 |
CDismountNotifyInfo::~CDismountNotifyInfo() |
|
255 |
{ |
|
256 |
switch(iMode) |
|
257 |
{ |
|
258 |
case EFsDismountNotifyClients: |
|
259 |
break; |
|
260 |
case EFsDismountRegisterClient: |
|
261 |
__ASSERT_ALWAYS(TheDrives[iDriveNumber].DismountUnlock() >= 0, Fault(ENotifyDismountCancel)); |
|
262 |
break; |
|
263 |
default: |
|
264 |
break; |
|
265 |
} |
|
266 |
} |
|
267 |
||
268 |
void CDismountNotifyInfo::Initialise(TNotifyDismountMode aMode, TInt aDriveNumber, TRequestStatus* aStatus,const RMessagePtr2& aMessage,CSessionFs* aSession) |
|
269 |
{ |
|
270 |
iMode = aMode; |
|
271 |
iDriveNumber=aDriveNumber; |
|
272 |
CNotifyInfo::Initialise(EDismount,aStatus,aMessage,aSession); |
|
273 |
||
274 |
if (iMode == EFsDismountRegisterClient) |
|
275 |
TheDrives[iDriveNumber].DismountLock(); |
|
276 |
} |
|
277 |
||
278 |
TBool CDismountNotifyInfo::IsMatching(TNotifyDismountMode aMode, TInt aDriveNumber, CSessionFs* aSession) |
|
279 |
{ |
|
280 |
if((iDriveNumber == aDriveNumber) && (iMode == aMode) && (aSession == NULL || aSession == Session())) |
|
281 |
return(ETrue); |
|
282 |
return(EFalse); |
|
283 |
} |
|
284 |
||
285 |
TBaseQue::TBaseQue() |
|
286 |
// |
|
287 |
// |
|
288 |
// |
|
289 |
{ |
|
290 |
iHeader.SetOffset(_FOFF(CNotifyInfo,iLink)); |
|
291 |
TInt r=iQLock.CreateLocal(); |
|
292 |
__ASSERT_ALWAYS(r==KErrNone,Fault(EBaseQueConstruction)); |
|
293 |
} |
|
294 |
||
295 |
TBaseQue::~TBaseQue() |
|
296 |
// |
|
297 |
// |
|
298 |
// |
|
299 |
{ |
|
300 |
iQLock.Close(); |
|
301 |
} |
|
302 |
||
303 |
void TBaseQue::DoAddNotify(CNotifyInfo* aInfo) |
|
304 |
// |
|
305 |
// Add notification |
|
306 |
// Que should be locked by calling function |
|
307 |
// |
|
308 |
{ |
|
309 |
iHeader.AddLast(*aInfo); |
|
310 |
} |
|
311 |
||
312 |
TBool TBaseQue::DoCancelSession(CSessionFs* aSession,TInt aCompletionCode, TRequestStatus* aStatus) |
|
313 |
// |
|
314 |
// Cancel notification(s) setup by aSession matching aStatus if set |
|
315 |
// Que should be locked by calling function |
|
316 |
// |
|
317 |
{ |
|
318 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
319 |
CNotifyInfo* info; |
|
320 |
TBool isFound=EFalse; |
|
321 |
while((info=q++)!=NULL) |
|
322 |
{ |
|
323 |
if(info->Session()==aSession && (!aStatus || aStatus==info->Status())) |
|
324 |
{ |
|
325 |
isFound=ETrue; |
|
326 |
info->Complete(aCompletionCode); |
|
327 |
info->iLink.Deque(); |
|
328 |
delete(info); |
|
329 |
if(aStatus) |
|
330 |
break; |
|
331 |
} |
|
332 |
} |
|
333 |
return(isFound); |
|
334 |
} |
|
335 |
||
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
336 |
CNotifyInfo* TBaseQue::DoFindEntry(CSessionFs* aSession, TRequestStatus* aStatus) |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
337 |
{ |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
338 |
TDblQueIter<CNotifyInfo> q(iHeader); |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
339 |
CNotifyInfo* info; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
340 |
while((info=q++)!=NULL) |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
341 |
{ |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
342 |
if(info->Session()==aSession && (!aStatus || aStatus==info->Status())) |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
343 |
return info; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
344 |
} |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
345 |
return NULL; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
346 |
} |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
347 |
|
0 | 348 |
void TBaseQue::DoCancelAll(TInt aCompletionCode) |
349 |
// |
|
350 |
// Cancel all notifications |
|
351 |
// Que should be locked by calling function |
|
352 |
// |
|
353 |
{ |
|
354 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
355 |
CNotifyInfo* info; |
|
356 |
while((info=q++)!=NULL) |
|
357 |
{ |
|
358 |
info->Complete(aCompletionCode); |
|
359 |
info->iLink.Deque(); |
|
360 |
delete(info); |
|
361 |
} |
|
362 |
__ASSERT_DEBUG(iHeader.IsEmpty(),Fault(EBaseQueCancel)); |
|
363 |
} |
|
364 |
||
365 |
TBool TBaseQue::IsEmpty() |
|
366 |
// |
|
367 |
// Que should be locked by calling function |
|
368 |
// |
|
369 |
{ |
|
370 |
return iHeader.IsEmpty(); |
|
371 |
} |
|
372 |
||
373 |
TBool TChangeQue::IsEmpty() |
|
374 |
// |
|
375 |
// |
|
376 |
// |
|
377 |
{ |
|
378 |
iQLock.Wait(); |
|
379 |
TBool empty = TBaseQue::IsEmpty(); |
|
380 |
iQLock.Signal(); |
|
381 |
return(empty); |
|
382 |
} |
|
383 |
||
384 |
TInt TChangeQue::AddNotify(CNotifyInfo* aInfo) |
|
385 |
// |
|
386 |
// |
|
387 |
// |
|
388 |
{ |
|
389 |
iQLock.Wait(); |
|
390 |
TBaseQue::DoAddNotify(aInfo); |
|
391 |
iQLock.Signal(); |
|
392 |
return(KErrNone); |
|
393 |
} |
|
394 |
||
395 |
TBool TChangeQue::CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus) |
|
396 |
// |
|
397 |
// |
|
398 |
// |
|
399 |
{ |
|
400 |
iQLock.Wait(); |
|
401 |
TBool isFound=TBaseQue::DoCancelSession(aSession,aCompletionCode,aStatus); |
|
402 |
iQLock.Signal(); |
|
403 |
return(isFound); |
|
404 |
} |
|
405 |
||
406 |
void TChangeQue::CancelAll(TInt aCompletionCode) |
|
407 |
// |
|
408 |
// |
|
409 |
// |
|
410 |
{ |
|
411 |
iQLock.Wait(); |
|
412 |
TBaseQue::DoCancelAll(aCompletionCode); |
|
413 |
iQLock.Signal(); |
|
414 |
} |
|
415 |
||
416 |
void TChangeQue::CheckChange(CFsRequest* aRequest) |
|
417 |
// |
|
418 |
// complete any notification in que that matches aRequest |
|
419 |
// |
|
420 |
{ |
|
421 |
iQLock.Wait(); |
|
422 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
423 |
CNotifyInfo* info; |
|
424 |
while((info=q++)!=NULL) |
|
425 |
{ |
|
426 |
__ASSERT_DEBUG(info->Type()==CNotifyInfo::EStdChange||info->Type()==CNotifyInfo::EExtChange,Fault(EChangeQueType)); |
|
427 |
TBool isMatching; |
|
428 |
if(info->Type()==CNotifyInfo::EStdChange) |
|
429 |
isMatching=((CStdChangeInfo*)info)->IsMatching(aRequest); |
|
430 |
else |
|
431 |
isMatching=((CExtChangeInfo*)info)->IsMatching(aRequest); |
|
432 |
if(isMatching) |
|
433 |
{ |
|
434 |
__PRINT1(_L("TChangeQue::CheckChange()-Matching info=0x%x"),info); |
|
435 |
info->Complete(KErrNone); |
|
436 |
info->iLink.Deque(); |
|
437 |
delete(info); |
|
438 |
} |
|
439 |
} |
|
440 |
iQLock.Signal(); |
|
441 |
} |
|
442 |
||
443 |
TBool TDiskSpaceQue::IsEmpty() |
|
444 |
// |
|
445 |
// |
|
446 |
// |
|
447 |
{ |
|
448 |
iQLock.Wait(); |
|
449 |
TBool empty = TBaseQue::IsEmpty(); |
|
450 |
iQLock.Signal(); |
|
451 |
return(empty); |
|
452 |
} |
|
453 |
||
454 |
TInt TDiskSpaceQue::AddNotify(CNotifyInfo* aInfo) |
|
455 |
// |
|
456 |
// |
|
457 |
// |
|
458 |
{ |
|
459 |
iQLock.Wait(); |
|
460 |
TInt r=KErrNone; |
|
461 |
if(iHeader.IsEmpty()) |
|
462 |
{ |
|
463 |
r=GetFreeDiskSpace(iFreeDiskSpace); |
|
464 |
iReservedDiskSpace = TheDrives[iDriveNumber].ReservedSpace(); |
|
465 |
} |
|
466 |
if(r==KErrNone) |
|
467 |
TBaseQue::DoAddNotify(aInfo); |
|
468 |
iQLock.Signal(); |
|
469 |
return(r); |
|
470 |
} |
|
471 |
||
472 |
TInt TDiskSpaceQue::CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus) |
|
473 |
// |
|
474 |
// |
|
475 |
// |
|
476 |
{ |
|
477 |
iQLock.Wait(); |
|
478 |
TBaseQue::DoCancelSession(aSession,aCompletionCode,aStatus); |
|
479 |
iQLock.Signal(); |
|
480 |
return(KErrNone); |
|
481 |
} |
|
482 |
||
483 |
void TDiskSpaceQue::CancelAll(TInt aCompletionCode) |
|
484 |
// |
|
485 |
// |
|
486 |
// |
|
487 |
{ |
|
488 |
iQLock.Wait(); |
|
489 |
TBaseQue::DoCancelAll(aCompletionCode); |
|
490 |
iQLock.Signal(); |
|
491 |
} |
|
492 |
||
493 |
||
494 |
void TDiskSpaceQue::CheckDiskSpace() |
|
495 |
// |
|
496 |
// Complete any disk space notification whose threshold has been crossed |
|
497 |
// |
|
498 |
{ |
|
499 |
iQLock.Wait(); |
|
500 |
if(iHeader.IsEmpty()) |
|
501 |
{ |
|
502 |
iQLock.Signal(); |
|
503 |
return; |
|
504 |
} |
|
505 |
TInt64 freeSpace; |
|
506 |
TInt r=GetFreeDiskSpace(freeSpace); |
|
507 |
TInt64 reservedSpace(TheDrives[iDriveNumber].ReservedSpace()); |
|
508 |
if(r==KErrNone) |
|
509 |
{ |
|
510 |
if((freeSpace==iFreeDiskSpace) && (reservedSpace==iReservedDiskSpace)) |
|
511 |
{ |
|
512 |
iQLock.Signal(); |
|
513 |
return; |
|
514 |
} |
|
515 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
516 |
CNotifyInfo* info; |
|
517 |
while((info=q++)!=NULL) |
|
518 |
{ |
|
519 |
__ASSERT_DEBUG(info->Type()==CNotifyInfo::EDiskSpace,Fault(EDiskSpaceQueType1)); |
|
520 |
||
521 |
TInt64 newSessionFreeSpace(freeSpace); |
|
522 |
TInt64 oldSessionFreeSpace(iFreeDiskSpace); |
|
523 |
if(!info->Session()->ReservedAccess(iDriveNumber)) |
|
524 |
{ |
|
525 |
newSessionFreeSpace -= reservedSpace; |
|
526 |
oldSessionFreeSpace -= iReservedDiskSpace; |
|
527 |
} |
|
528 |
||
529 |
if(((CDiskSpaceInfo*)info)->IsMatching(oldSessionFreeSpace,newSessionFreeSpace)) |
|
530 |
{ |
|
531 |
__PRINT1(_L("TDiskSpaceQue::CheckDiskSpace()-Matching info=0x%x"),info); |
|
532 |
info->Complete(KErrNone); |
|
533 |
info->iLink.Deque(); |
|
534 |
delete(info); |
|
535 |
} |
|
536 |
} |
|
537 |
iFreeDiskSpace=freeSpace; |
|
538 |
iReservedDiskSpace=reservedSpace; |
|
539 |
} |
|
540 |
else |
|
541 |
TBaseQue::DoCancelAll(KErrNone); |
|
542 |
iQLock.Signal(); |
|
543 |
} |
|
544 |
||
545 |
void TDiskSpaceQue::CheckDiskSpace(TInt64& aFreeDiskSpace) |
|
546 |
// |
|
547 |
// |
|
548 |
// |
|
549 |
{ |
|
550 |
iQLock.Wait(); |
|
551 |
if(iHeader.IsEmpty()) |
|
552 |
{ |
|
553 |
iQLock.Signal(); |
|
554 |
return; |
|
555 |
} |
|
556 |
||
557 |
TInt64 reservedSpace(TheDrives[iDriveNumber].ReservedSpace()); |
|
558 |
||
559 |
if((aFreeDiskSpace==iFreeDiskSpace) && (reservedSpace==iReservedDiskSpace)) |
|
560 |
{ |
|
561 |
iQLock.Signal(); |
|
562 |
return; |
|
563 |
} |
|
564 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
565 |
CNotifyInfo* info; |
|
566 |
while((info=q++)!=NULL) |
|
567 |
{ |
|
568 |
__ASSERT_DEBUG(info->Type()==CNotifyInfo::EDiskSpace,Fault(EDiskSpaceQueType2)); |
|
569 |
||
570 |
TInt64 newSessionFreeSpace(aFreeDiskSpace); |
|
571 |
TInt64 oldSessionFreeSpace(iFreeDiskSpace); |
|
572 |
if(!info->Session()->ReservedAccess(iDriveNumber)) |
|
573 |
{ |
|
574 |
newSessionFreeSpace -= reservedSpace; |
|
575 |
oldSessionFreeSpace -= iReservedDiskSpace; |
|
576 |
} |
|
577 |
||
578 |
if(((CDiskSpaceInfo*)info)->IsMatching(oldSessionFreeSpace,newSessionFreeSpace)) |
|
579 |
{ |
|
580 |
__PRINT1(_L("TDiskSpaceQue::CheckDiskSpace()-Matching info=0x%x"),info); |
|
581 |
info->Complete(KErrNone); |
|
582 |
info->iLink.Deque(); |
|
583 |
delete(info); |
|
584 |
} |
|
585 |
} |
|
586 |
iFreeDiskSpace=aFreeDiskSpace; |
|
587 |
iReservedDiskSpace=reservedSpace; |
|
588 |
iQLock.Signal(); |
|
589 |
} |
|
590 |
||
591 |
TInt TDiskSpaceQue::GetFreeDiskSpace(TInt64& aFreeDiskSpace) |
|
592 |
// |
|
593 |
// |
|
594 |
// |
|
595 |
{ |
|
596 |
__ASSERT_DEBUG(iDriveNumber>=EDriveA&&iDriveNumber<=EDriveZ,Fault(EDiskSpaceQueDrive)); |
|
597 |
__CHECK_DRIVETHREAD(iDriveNumber); |
|
598 |
TInt r=TheDrives[iDriveNumber].FreeDiskSpace(aFreeDiskSpace); |
|
599 |
return(r); |
|
600 |
} |
|
601 |
||
602 |
TInt TDebugQue::AddNotify(CNotifyInfo* aInfo) |
|
603 |
// |
|
604 |
// |
|
605 |
// |
|
606 |
{ |
|
607 |
iQLock.Wait(); |
|
608 |
TBaseQue::DoAddNotify(aInfo); |
|
609 |
iQLock.Signal(); |
|
610 |
return(KErrNone); |
|
611 |
} |
|
612 |
||
613 |
TInt TDebugQue::CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus) |
|
614 |
// |
|
615 |
// |
|
616 |
// |
|
617 |
{ |
|
618 |
iQLock.Wait(); |
|
619 |
TBool isFound=TBaseQue::DoCancelSession(aSession,aCompletionCode,aStatus); |
|
620 |
iQLock.Signal(); |
|
621 |
return(isFound); |
|
622 |
} |
|
623 |
||
624 |
void TDebugQue::CancelAll(TInt aCompletionCode) |
|
625 |
// |
|
626 |
// |
|
627 |
// |
|
628 |
{ |
|
629 |
iQLock.Wait(); |
|
630 |
TBaseQue::DoCancelAll(aCompletionCode); |
|
631 |
iQLock.Signal(); |
|
632 |
} |
|
633 |
||
634 |
void TDebugQue::CheckDebug(TUint aDebugChange) |
|
635 |
// |
|
636 |
// Complete any debug notification whose debug type matches aDebugChange |
|
637 |
// |
|
638 |
{ |
|
639 |
iQLock.Wait(); |
|
640 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
641 |
CNotifyInfo* info; |
|
642 |
while((info=q++)!=NULL) |
|
643 |
{ |
|
644 |
__ASSERT_DEBUG(info->Type()==CNotifyInfo::EDebugChange,Fault(EDebugQueType)); |
|
645 |
if(((CDebugChangeInfo*)info)->IsMatching(aDebugChange)) |
|
646 |
{ |
|
647 |
__PRINT1(_L("TDebugQue::CheckDebug()-Matching info=0x%x"),info); |
|
648 |
info->Complete(KErrNone); |
|
649 |
info->iLink.Deque(); |
|
650 |
delete(info); |
|
651 |
} |
|
652 |
} |
|
653 |
iQLock.Signal(); |
|
654 |
} |
|
655 |
||
656 |
TInt TDismountNotifyQue::AddNotify(CNotifyInfo* aInfo) |
|
657 |
// |
|
658 |
// |
|
659 |
// |
|
660 |
{ |
|
661 |
iQLock.Wait(); |
|
662 |
TBaseQue::DoAddNotify(aInfo); |
|
663 |
iQLock.Signal(); |
|
664 |
return(KErrNone); |
|
665 |
} |
|
666 |
||
667 |
TInt TDismountNotifyQue::CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus) |
|
668 |
// |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
669 |
// Returns the drive number or KErrNotFound |
0 | 670 |
// |
671 |
{ |
|
672 |
iQLock.Wait(); |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
673 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
674 |
// return the drive number |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
675 |
CDismountNotifyInfo* info = (CDismountNotifyInfo*) DoFindEntry(aSession, aStatus); |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
676 |
TInt driveNumber = info ? info->DriveNumber() : KErrNotFound; |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
677 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
678 |
TBaseQue::DoCancelSession(aSession,aCompletionCode,aStatus); |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
679 |
|
0 | 680 |
iQLock.Signal(); |
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
681 |
|
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
682 |
return(driveNumber); |
0 | 683 |
} |
684 |
||
685 |
void TDismountNotifyQue::CancelAll(TInt aCompletionCode) |
|
686 |
// |
|
687 |
// |
|
688 |
// |
|
689 |
{ |
|
690 |
iQLock.Wait(); |
|
691 |
TBaseQue::DoCancelAll(aCompletionCode); |
|
692 |
iQLock.Signal(); |
|
693 |
} |
|
694 |
||
695 |
void TDismountNotifyQue::CheckDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt aError) |
|
696 |
// |
|
697 |
// Complete any dismount notifications on the specified drive. |
|
698 |
// |
|
699 |
{ |
|
700 |
iQLock.Wait(); |
|
701 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
702 |
CNotifyInfo* info; |
|
703 |
while((info=q++)!=NULL) |
|
704 |
{ |
|
705 |
__ASSERT_DEBUG(info->Type()==CNotifyInfo::EDismount,Fault(EBadDismountNotifyType)); |
|
706 |
if(((CDismountNotifyInfo*)info)->IsMatching(aMode, aDrive, NULL)) |
|
707 |
{ |
|
708 |
__PRINT1(_L("TDismountNotifyQue::CheckDismount()-Matching info=0x%x"),info); |
|
709 |
info->Complete(aError); |
|
710 |
if(aRemove) |
|
711 |
{ |
|
712 |
info->iLink.Deque(); |
|
713 |
delete(info); |
|
714 |
} |
|
715 |
} |
|
716 |
} |
|
717 |
||
718 |
__ASSERT_ALWAYS(!aRemove || TheDrives[aDrive].DismountLocked() == 0, Fault(EDismountLocked)); |
|
719 |
||
720 |
iQLock.Signal(); |
|
721 |
} |
|
722 |
||
723 |
TBool TDismountNotifyQue::HandlePendingDismount(CSessionFs* aSession, TInt aDrive) |
|
724 |
// |
|
725 |
// Determine if the session has any outstanding dismount notifications on the specified drive. |
|
726 |
// |
|
727 |
{ |
|
728 |
iQLock.Wait(); |
|
729 |
TDblQueIter<CNotifyInfo> q(iHeader); |
|
730 |
CNotifyInfo* info; |
|
731 |
while((info=q++)!=NULL) |
|
732 |
{ |
|
733 |
__ASSERT_DEBUG(info->Type()==CNotifyInfo::EDismount,Fault(EBadDismountNotifyType)); |
|
734 |
if(((CDismountNotifyInfo*)info)->IsMatching(EFsDismountRegisterClient, aDrive, aSession)) |
|
735 |
{ |
|
736 |
__PRINT1(_L("TDismountNotifyQue::CheckDismount()-Pending info=0x%x"),info); |
|
737 |
info->iLink.Deque(); |
|
738 |
delete(info); |
|
739 |
iQLock.Signal(); |
|
740 |
return ETrue; |
|
741 |
} |
|
742 |
} |
|
743 |
iQLock.Signal(); |
|
744 |
return EFalse; |
|
745 |
} |
|
746 |
||
747 |
void FsNotify::Initialise() |
|
748 |
// |
|
749 |
// |
|
750 |
// |
|
751 |
{ |
|
752 |
for(TInt i=0;i<KMaxDiskQues;++i) |
|
753 |
{ |
|
754 |
iDiskSpaceQues[i].SetDriveNumber(i); |
|
755 |
} |
|
756 |
} |
|
757 |
||
758 |
TBool FsNotify::IsChangeQueEmpty(TInt aDrive) |
|
759 |
// |
|
760 |
// |
|
761 |
// |
|
762 |
{ |
|
763 |
if((iChangeQues[ChangeIndex(aDrive)].IsEmpty()) && (iChangeQues[ChangeIndex(KDriveInvalid)].IsEmpty())) |
|
764 |
return ETrue; |
|
765 |
||
766 |
return EFalse; |
|
767 |
} |
|
768 |
||
769 |
TInt FsNotify::AddChange(CNotifyInfo* aInfo,TInt aDrive) |
|
770 |
// |
|
771 |
// |
|
772 |
// |
|
773 |
{ |
|
774 |
__ASSERT_DEBUG(aInfo->Type()==CNotifyInfo::EStdChange||aInfo->Type()==CNotifyInfo::EExtChange,Fault(EBadChangeNotifyType)); |
|
775 |
__PRINT2(_L("FsNotify::AddChange() drive=%d,info=0x%x"),aDrive,aInfo); |
|
776 |
iChangeQues[ChangeIndex(aDrive)].AddNotify(aInfo); |
|
777 |
return(KErrNone); |
|
778 |
} |
|
779 |
||
780 |
TBool FsNotify::IsDiskSpaceQueEmpty(TInt aDrive) |
|
781 |
// |
|
782 |
// |
|
783 |
// |
|
784 |
{ |
|
785 |
if(iDiskSpaceQues[aDrive].IsEmpty()) |
|
786 |
return ETrue; |
|
787 |
||
788 |
return EFalse; |
|
789 |
} |
|
790 |
||
791 |
TInt FsNotify::AddDiskSpace(CNotifyInfo* aInfo,TInt aDrive) |
|
792 |
// |
|
793 |
// |
|
794 |
// |
|
795 |
{ |
|
796 |
__ASSERT_DEBUG(aInfo->Type()==CNotifyInfo::EDiskSpace,Fault(EBadDiskNotifyType)); |
|
797 |
__ASSERT_DEBUG((aDrive>=EDriveA && aDrive<=EDriveZ),Fault(EDiskBadIndex1)); |
|
798 |
__PRINT2(_L("FsNotify::AddDiskSpace() drive=%d,info=0x%x"),aDrive,aInfo); |
|
799 |
return(iDiskSpaceQues[aDrive].AddNotify(aInfo)); |
|
800 |
} |
|
801 |
||
802 |
TInt FsNotify::AddDebug(CNotifyInfo* aDebugInfo) |
|
803 |
// |
|
804 |
// |
|
805 |
// |
|
806 |
{ |
|
807 |
__ASSERT_DEBUG(aDebugInfo->Type()==CNotifyInfo::EDebugChange,Fault(EBadDebugNotifyType)); |
|
808 |
__PRINT1(_L("FsNotify::AddDebug() info=0x%x"),aDebugInfo); |
|
809 |
iDebugQue.AddNotify(aDebugInfo); |
|
810 |
return(KErrNone); |
|
811 |
} |
|
812 |
||
813 |
TInt FsNotify::AddDismountNotify(CNotifyInfo* aDismountNotifyInfo) |
|
814 |
// |
|
815 |
// |
|
816 |
// |
|
817 |
{ |
|
818 |
__ASSERT_DEBUG(aDismountNotifyInfo->Type()==CNotifyInfo::EDismount,Fault(EBadDismountNotifyType)); |
|
819 |
__PRINT1(_L("FsNotify::AddDismountNotify() info=0x%x"),aDismountNotifyInfo); |
|
820 |
iDismountNotifyQue.AddNotify(aDismountNotifyInfo); |
|
821 |
return(KErrNone); |
|
822 |
} |
|
823 |
||
824 |
void FsNotify::HandleChange(CFsRequest* aRequest,TInt aDrive) |
|
825 |
// |
|
826 |
// Check whether any change notifications need to be completed due to aRequest on aDrive |
|
827 |
// |
|
828 |
{ |
|
829 |
__PRINT2(_L("FsNotify::HandleChange() aRequest=0x%x, aDrive=%d"),aRequest,aDrive); |
|
830 |
if(!aRequest->IsChangeNotify()) |
|
831 |
return; |
|
832 |
iChangeQues[ChangeIndex(aDrive)].CheckChange(aRequest); |
|
833 |
iChangeQues[ChangeIndex(KDriveInvalid)].CheckChange(aRequest); |
|
834 |
} |
|
835 |
||
836 |
||
837 |
void FsNotify::HandleDiskSpace(CFsRequest* aRequest,TInt aDrive) |
|
838 |
// |
|
839 |
// Check whether any disk space notifications need to be completed due to aRequest on aDrive |
|
840 |
// |
|
841 |
{ |
|
842 |
__ASSERT_DEBUG((aDrive>=EDriveA && aDrive<=EDriveZ) || aDrive==KDriveInvalid,Fault(EDiskBadIndex2)); |
|
843 |
__PRINT2(_L("FsNotify::HandleDiskSpace() aRequest=0x%x, aDrive=%d"),aRequest,aDrive); |
|
844 |
||
845 |
if(!aRequest->Operation()->IsDiskSpaceNotify()) |
|
846 |
return; |
|
847 |
TInt f = aRequest->Operation()->Function(); |
|
848 |
if ((f == EFsFileWrite || f == EFsFileWriteDirty) && !((CFsClientMessageRequest*)aRequest)->IsFreeChanged()) |
|
849 |
return; |
|
850 |
if (FsThreadManager::IsDriveThread(aDrive,EFalse)) |
|
851 |
iDiskSpaceQues[aDrive].CheckDiskSpace(); |
|
852 |
} |
|
853 |
||
854 |
void FsNotify::HandleDiskSpace(TInt aDrive, TInt64& aFreeSpace) |
|
855 |
// |
|
856 |
// |
|
857 |
// |
|
858 |
{ |
|
859 |
__ASSERT_DEBUG((aDrive>=EDriveA && aDrive<=EDriveZ),Fault(EDiskBadIndex3)); |
|
860 |
__PRINT1(_L("FsNotify::HandleDiskSpace() aDrive=%d"),aDrive); |
|
861 |
iDiskSpaceQues[aDrive].CheckDiskSpace(aFreeSpace); |
|
862 |
} |
|
863 |
||
864 |
void FsNotify::HandleDebug(TUint aFunction) |
|
865 |
// |
|
866 |
// Check whether any debug notifications need to be completed due to aFunction |
|
867 |
// |
|
868 |
{ |
|
869 |
__PRINT1(_L("FsNotify::HandleDebug() aFunction=0x%x"),aFunction); |
|
870 |
if(!(aFunction&KDebugNotifyMask)) |
|
871 |
return; |
|
872 |
iDebugQue.CheckDebug(aFunction); |
|
873 |
} |
|
874 |
||
875 |
void FsNotify::HandleDismount(TNotifyDismountMode aMode, TInt aDrive, TBool aRemove, TInt err) |
|
876 |
// |
|
877 |
// Handle dismount notifications for the given drive |
|
878 |
// |
|
879 |
{ |
|
880 |
__PRINT4(_L("FsNotify::HandleDismount() aMode = %d, aDrive=%d, aRemove=%d, err=%d"),aMode,aDrive,aRemove,err); |
|
881 |
iDismountNotifyQue.CheckDismount(aMode, aDrive, aRemove, err); |
|
882 |
} |
|
883 |
||
884 |
TBool FsNotify::HandlePendingDismount(CSessionFs* aSession, TInt aDrive) |
|
885 |
// |
|
886 |
// Checks if the session has an outstanding notification registered on the drive |
|
887 |
// |
|
888 |
{ |
|
889 |
__PRINT1(_L("FsNotify::HandlePendingDismount() aDrive=%d"),aDrive); |
|
890 |
return iDismountNotifyQue.HandlePendingDismount(aSession, aDrive); |
|
891 |
} |
|
892 |
||
893 |
void FsNotify::DiskChange(TInt aDrive) |
|
894 |
// |
|
895 |
// Complete all notifications in queus due to a disk change |
|
896 |
// |
|
897 |
{ |
|
898 |
__ASSERT_DEBUG((aDrive>=EDriveA && aDrive<=EDriveZ),Fault(EDiskChangeDrive)); |
|
899 |
__PRINT1(_L("FsNotify::DiskChange() aDrive=%d"),aDrive); |
|
900 |
iChangeQues[ChangeIndex(aDrive)].CancelAll(KErrNone); |
|
901 |
iChangeQues[ChangeIndex(KDriveInvalid)].CancelAll(KErrNone); |
|
902 |
iDiskSpaceQues[aDrive].CancelAll(KErrNone); |
|
903 |
iDebugQue.CancelAll(KErrNone); |
|
904 |
||
905 |
// if there are any files containing dirty data, start issuing write-dirty data requests to trigger |
|
906 |
// a critical notifier (CFileCache::HandleWriteDirtyError()) |
|
907 |
// otherwise purge all file caches |
|
908 |
TDrive& drive=TheDrives[aDrive]; |
|
909 |
drive.FlushCachedFileInfo(ETrue); |
|
910 |
} |
|
911 |
||
912 |
||
913 |
void FsNotify::CancelChangeSession(CSessionFs* aSession,TRequestStatus* aStatus) |
|
914 |
// |
|
915 |
// Cancel change notifcation(s) setup by aSession and matching aStatus if not NULL |
|
916 |
// |
|
917 |
{ |
|
918 |
__PRINT2(_L("FsNotify::CancelChangeSession() aSession=0x%x aStatus=0x%x"),aSession,aStatus); |
|
919 |
for(TInt i=0;i<KMaxNotifyQues;++i) |
|
920 |
{ |
|
921 |
TBool isFound=iChangeQues[i].CancelSession(aSession,KErrCancel,aStatus); |
|
922 |
if(aStatus && isFound) |
|
923 |
break; |
|
924 |
} |
|
925 |
} |
|
926 |
||
927 |
void FsNotify::CancelDiskSpaceSession(CSessionFs* aSession,TRequestStatus* aStatus) |
|
928 |
// |
|
929 |
// Cancel disk space notification(s) setup by aSession and matching aStatus if not NULL |
|
930 |
// |
|
931 |
||
932 |
{ |
|
933 |
__PRINT2(_L("FsNotify::CancelDiskSpaceSession() aSession=0x%x aStatus=0x%x"),aSession,aStatus); |
|
934 |
for(TInt i=0;i<KMaxDiskQues;++i) |
|
935 |
{ |
|
936 |
TBool isFound=iDiskSpaceQues[i].CancelSession(aSession,KErrCancel,aStatus); |
|
937 |
if(aStatus && isFound) |
|
938 |
break; |
|
939 |
} |
|
940 |
} |
|
941 |
||
942 |
void FsNotify::CancelDebugSession(CSessionFs* aSession, TRequestStatus* aStatus) |
|
943 |
// |
|
944 |
// Cancel debug notification(s) setup by aSession and matching aStatus if not NULL |
|
945 |
// |
|
946 |
{ |
|
947 |
__PRINT2(_L("FsNotify::CancelDebugSession() aSession=0x%x aStatus=0x%x"),aSession,aStatus); |
|
948 |
iDebugQue.CancelSession(aSession,KErrCancel,aStatus); |
|
949 |
} |
|
950 |
||
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
951 |
TInt FsNotify::CancelDismountNotifySession(CSessionFs* aSession, TRequestStatus* aStatus) |
0 | 952 |
// |
953 |
// Cancel all media removal notification(s) setup by aSession (if aStatus == NULL) |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
954 |
// else cancels all outstanding notifications(s) for the session |
0 | 955 |
// |
956 |
{ |
|
957 |
__PRINT2(_L("FsNotify::CancelDismountNotifySession() aSession=0x%x aStatus=0x%x"),aSession,aStatus); |
|
62
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
958 |
TInt drive = iDismountNotifyQue.CancelSession(aSession,KErrCancel,aStatus); |
4a8fed1c0ef6
Revision: 201007
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
959 |
return drive; |
0 | 960 |
} |
961 |
||
962 |
void FsNotify::CancelSession(CSessionFs* aSession) |
|
963 |
// |
|
964 |
// |
|
965 |
// |
|
966 |
{ |
|
967 |
__PRINT(_L("FsNotify::CancelSession")); |
|
968 |
FsNotify::CancelChangeSession(aSession); |
|
969 |
FsNotify::CancelDiskSpaceSession(aSession); |
|
970 |
FsNotify::CancelDebugSession(aSession); |
|
971 |
FsNotify::CancelDismountNotifySession(aSession); |
|
972 |
} |
|
973 |
||
974 |
||
975 |
TInt FsNotify::ChangeIndex(TInt aDrive) |
|
976 |
// |
|
977 |
// |
|
978 |
// |
|
979 |
{ |
|
980 |
__ASSERT_DEBUG((aDrive>=EDriveA && aDrive<=EDriveZ) || aDrive==KDriveInvalid,Fault(EChangeBadIndex)); |
|
981 |
if(aDrive==KDriveInvalid) |
|
982 |
return(0); |
|
983 |
else |
|
984 |
return(aDrive+1); |
|
985 |
} |
|
986 |