userlibandfileserver/fileserver/sfat32/sl_drv.cpp
changeset 140 2ac1c5c27758
parent 90 947f0dc9f7a8
child 176 af6ec97d9189
--- a/userlibandfileserver/fileserver/sfat32/sl_drv.cpp	Mon May 24 18:45:46 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_drv.cpp	Mon Jun 07 16:46:36 2010 +0100
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -46,12 +46,11 @@
     Close the interface to the media driver
 */
 void TDriveInterface::Close()
-{
-	 if(iMount)
+{	 
+	 if((iMount != NULL) && (iMount->LocalDrive() != NULL))
 		{
 		iMount->LocalDrive()->SetMount(NULL);
-        }
-
+		}
      iMount = NULL;
 }
 
@@ -118,7 +117,7 @@
     @return KErrBadPower - failure due to low power
 
 */
-TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
+TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
 {
     //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength);
 
@@ -127,7 +126,7 @@
 
     for(;;)
     {
-        nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset);
+        nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset, aFlag);
         if (nRes==KErrNone)
             break;
 
@@ -201,7 +200,7 @@
     @return KErrCorrupt - an illegal write is detected
     @return KErrAccessDenied - write to protected media
 */
-TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset)
+TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset, TUint aFlag)
 {
     //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength);
 
@@ -212,7 +211,7 @@
     for(;;)
     {
         iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write.
-        nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset);
+        nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset, aFlag);
         if (nRes==KErrNone)
             break;
 
@@ -543,10 +542,10 @@
 
 //-- see original TDriveInterface methods
 
-TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
+TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
 {
     EnterCriticalSection();
-    TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset);
+    TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset, aFlag);
     LeaveCriticalSection();
     return nRes;
 }
@@ -559,10 +558,10 @@
     return nRes;
 }
 
-TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
+TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag)
 {
     EnterCriticalSection();
-    TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset);
+    TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset, aFlag);
     LeaveCriticalSection();
     return nRes;
 }