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