userlibandfileserver/fileserver/sfat32/sl_drv.cpp
changeset 200 73ea206103e6
parent 102 ef2a444a7410
child 201 43365a9b78a3
equal deleted inserted replaced
152:657f875b013e 200:73ea206103e6
   115     @return KErrNotReady - non-critical error
   115     @return KErrNotReady - non-critical error
   116     @return KErrCorrupt - an illegal write is detected
   116     @return KErrCorrupt - an illegal write is detected
   117     @return KErrBadPower - failure due to low power
   117     @return KErrBadPower - failure due to low power
   118 
   118 
   119 */
   119 */
   120 TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
   120 TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
   121 {
   121 {
   122     //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength);
   122     //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength);
   123 
   123 
   124     TInt nRes = KErrNone;
   124     TInt nRes = KErrNone;
   125     TInt cntRetry = KMaxRecoverableRetries;
   125     TInt cntRetry = KMaxRecoverableRetries;
   126 
   126 
   127     for(;;)
   127     for(;;)
   128     {
   128     {
   129         nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset);
   129         nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset, aFlag);
   130         if (nRes==KErrNone)
   130         if (nRes==KErrNone)
   131             break;
   131             break;
   132 
   132 
   133         __PRINT4(_L("TDriveInterface::ReadNonCritical() Failure! drv:%d aPosl=%d len=%d anOffset=%d"), iMount->DriveNumber(), aPos,aLength, anOffset);
   133         __PRINT4(_L("TDriveInterface::ReadNonCritical() Failure! drv:%d aPosl=%d len=%d anOffset=%d"), iMount->DriveNumber(), aPos,aLength, anOffset);
   134         
   134         
   198     @return KErrNotReady - non-critical error
   198     @return KErrNotReady - non-critical error
   199     @return KErrBadPower - write not attempted due to low batteries
   199     @return KErrBadPower - write not attempted due to low batteries
   200     @return KErrCorrupt - an illegal write is detected
   200     @return KErrCorrupt - an illegal write is detected
   201     @return KErrAccessDenied - write to protected media
   201     @return KErrAccessDenied - write to protected media
   202 */
   202 */
   203 TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset)
   203 TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset, TUint aFlag)
   204 {
   204 {
   205     //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength);
   205     //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength);
   206 
   206 
   207     
   207     
   208     TInt nRes = KErrNone;
   208     TInt nRes = KErrNone;
   209     TInt cntRetry = KMaxRecoverableRetries;
   209     TInt cntRetry = KMaxRecoverableRetries;
   210 
   210 
   211     for(;;)
   211     for(;;)
   212     {
   212     {
   213         iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write.
   213         iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write.
   214         nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset);
   214         nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset, aFlag);
   215         if (nRes==KErrNone)
   215         if (nRes==KErrNone)
   216             break;
   216             break;
   217 
   217 
   218         __PRINT4(_L("TDriveInterface::WriteNonCritical() failure! drv:%d, Pos=%LU len=%d anOffset=%d"), iMount->DriveNumber(), aPos, aLength, anOffset);
   218         __PRINT4(_L("TDriveInterface::WriteNonCritical() failure! drv:%d, Pos=%LU len=%d anOffset=%d"), iMount->DriveNumber(), aPos, aLength, anOffset);
   219         
   219         
   540     return ETrue;
   540     return ETrue;
   541 }
   541 }
   542 
   542 
   543 //-- see original TDriveInterface methods
   543 //-- see original TDriveInterface methods
   544 
   544 
   545 TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const
   545 TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const
   546 {
   546 {
   547     EnterCriticalSection();
   547     EnterCriticalSection();
   548     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset);
   548     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset, aFlag);
   549     LeaveCriticalSection();
   549     LeaveCriticalSection();
   550     return nRes;
   550     return nRes;
   551 }
   551 }
   552        
   552        
   553 TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const
   553 TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const
   556     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg);
   556     TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg);
   557     LeaveCriticalSection();
   557     LeaveCriticalSection();
   558     return nRes;
   558     return nRes;
   559 }
   559 }
   560 
   560 
   561 TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset)
   561 TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag)
   562 {
   562 {
   563     EnterCriticalSection();
   563     EnterCriticalSection();
   564     TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset);
   564     TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset, aFlag);
   565     LeaveCriticalSection();
   565     LeaveCriticalSection();
   566     return nRes;
   566     return nRes;
   567 }
   567 }
   568 
   568 
   569 TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos, const TDesC8& aSrc)
   569 TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos, const TDesC8& aSrc)