userlibandfileserver/fileserver/sfile/sf_notify.cpp
branchRCL_3
changeset 19 4a8fed1c0ef6
parent 0 a41df078684a
equal deleted inserted replaced
15:2d65c2f76d7b 19:4a8fed1c0ef6
   331 			}
   331 			}
   332 		}
   332 		}
   333 	return(isFound);
   333 	return(isFound);
   334 	}
   334 	}
   335 
   335 
       
   336 CNotifyInfo* TBaseQue::DoFindEntry(CSessionFs* aSession, TRequestStatus* aStatus)
       
   337 	{
       
   338 	TDblQueIter<CNotifyInfo> q(iHeader);
       
   339 	CNotifyInfo* info;
       
   340 	while((info=q++)!=NULL)
       
   341 		{
       
   342 		if(info->Session()==aSession && (!aStatus || aStatus==info->Status()))
       
   343 			return info;
       
   344 		}
       
   345 	return NULL;
       
   346 	}
       
   347 
   336 void TBaseQue::DoCancelAll(TInt aCompletionCode)
   348 void TBaseQue::DoCancelAll(TInt aCompletionCode)
   337 //
   349 //
   338 // Cancel all notifications
   350 // Cancel all notifications
   339 // Que should be locked by calling function
   351 // Que should be locked by calling function
   340 //
   352 //
   652 	return(KErrNone);
   664 	return(KErrNone);
   653 	}
   665 	}
   654 
   666 
   655 TInt TDismountNotifyQue::CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus)
   667 TInt TDismountNotifyQue::CancelSession(CSessionFs* aSession,TInt aCompletionCode,TRequestStatus* aStatus)
   656 //
   668 //
   657 //
   669 // Returns the drive number or KErrNotFound
   658 //
   670 //
   659 	{
   671 	{
   660 	iQLock.Wait();
   672 	iQLock.Wait();
   661 	TBool isFound=TBaseQue::DoCancelSession(aSession,aCompletionCode,aStatus);
   673 
   662 	iQLock.Signal();
   674 	// return the drive number
   663 	return(isFound);
   675 	CDismountNotifyInfo* info = (CDismountNotifyInfo*) DoFindEntry(aSession, aStatus);
       
   676 	TInt driveNumber = info ? info->DriveNumber() : KErrNotFound;
       
   677 
       
   678 	TBaseQue::DoCancelSession(aSession,aCompletionCode,aStatus);
       
   679 
       
   680 	iQLock.Signal();
       
   681 
       
   682 	return(driveNumber);
   664 	}
   683 	}
   665 
   684 
   666 void TDismountNotifyQue::CancelAll(TInt aCompletionCode)
   685 void TDismountNotifyQue::CancelAll(TInt aCompletionCode)
   667 //
   686 //
   668 //
   687 //
   927 	{
   946 	{
   928 	__PRINT2(_L("FsNotify::CancelDebugSession() aSession=0x%x aStatus=0x%x"),aSession,aStatus);
   947 	__PRINT2(_L("FsNotify::CancelDebugSession() aSession=0x%x aStatus=0x%x"),aSession,aStatus);
   929 	iDebugQue.CancelSession(aSession,KErrCancel,aStatus);
   948 	iDebugQue.CancelSession(aSession,KErrCancel,aStatus);
   930 	}
   949 	}
   931 
   950 
   932 void FsNotify::CancelDismountNotifySession(CSessionFs* aSession, TRequestStatus* aStatus)
   951 TInt FsNotify::CancelDismountNotifySession(CSessionFs* aSession, TRequestStatus* aStatus)
   933 //
   952 //
   934 // Cancel all media removal notification(s) setup by aSession (if aStatus == NULL)
   953 // Cancel all media removal notification(s) setup by aSession (if aStatus == NULL)
   935 // else cancels all oustanding notifications(s) for the session
   954 // else cancels all outstanding notifications(s) for the session
   936 //
   955 //
   937 	{
   956 	{
   938 	__PRINT2(_L("FsNotify::CancelDismountNotifySession() aSession=0x%x aStatus=0x%x"),aSession,aStatus);
   957 	__PRINT2(_L("FsNotify::CancelDismountNotifySession() aSession=0x%x aStatus=0x%x"),aSession,aStatus);
   939 	iDismountNotifyQue.CancelSession(aSession,KErrCancel,aStatus);
   958 	TInt drive = iDismountNotifyQue.CancelSession(aSession,KErrCancel,aStatus);
       
   959 	return drive;
   940 	}
   960 	}
   941 
   961 
   942 void FsNotify::CancelSession(CSessionFs* aSession)
   962 void FsNotify::CancelSession(CSessionFs* aSession)
   943 //
   963 //
   944 //
   964 //