userlibandfileserver/fileserver/sfat32/sl_file.cpp
branchRCL_3
changeset 42 a179b74831c9
parent 41 0ffb4e86fcc9
child 43 c1f20ce4abcf
--- a/userlibandfileserver/fileserver/sfat32/sl_file.cpp	Thu Jul 15 20:11:42 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_file.cpp	Thu Aug 19 11:14:22 2010 +0300
@@ -103,18 +103,6 @@
 	iSeekIndex[seekPos] = aStoredCluster;
 	}
 
-TBool CFatFileCB::IsSeekBackwards(TUint aPos)
-//
-// Return true if aPos<currentPos
-//
-	{
-	
-	TUint cluster=iCurrentPos.iCluster<<ClusterSizeLog2();
-	TInt offset=ClusterRelativePos(iCurrentPos.iPos);
-	TUint currentPos=cluster+offset;
-	return(aPos<currentPos);
-	}
-
 void CFatFileCB::CheckPosL(TUint aPos)
 //
 // Check that the file is positioned correctly.
@@ -126,9 +114,6 @@
 		return;
     __ASSERT_DEBUG(aPos <= FCB_FileSize(), Fault(EFatFilePosBeyondEnd));
 
-	if (FileSizeModified() && IsSeekBackwards(aPos))
-		FlushDataL(); 
-	
 	TUint newRelCluster=aPos>>ClusterSizeLog2();
 	if ( aPos && (aPos==(newRelCluster<<ClusterSizeLog2())) )
 		newRelCluster--;
@@ -245,8 +230,10 @@
 	
 	if((startPos + length > curSize) || (startPos > startPos + length) )
 		aLength=curSize-startPos;
+		
+	TUint flag = DirectIOMode(aMessage) ? RLocalDrive::ELocDrvDirectIO : 0;
 	
-    FatMount().ReadFromClusterListL(iCurrentPos,aLength,aDes,aMessage,aOffset);
+    FatMount().ReadFromClusterListL(iCurrentPos,aLength,aDes,aMessage,aOffset, flag);
 	aLength=iCurrentPos.iPos-startPos;
 	}
 
@@ -295,7 +282,9 @@
 	TUint badcluster=0;
 	TUint goodcluster=0;
    	
-	TRAPD(ret, FatMount().WriteToClusterListL(iCurrentPos,aLength,aSrc,aMessage,aOffset,badcluster, goodcluster));
+	TUint flag = DirectIOMode(aMessage) ? RLocalDrive::ELocDrvDirectIO : 0;
+	
+	TRAPD(ret, FatMount().WriteToClusterListL(iCurrentPos,aLength,aSrc,aMessage,aOffset,badcluster, goodcluster, flag));
    	
 	if (ret == KErrCorrupt || ret == KErrDied)
 		{
@@ -864,10 +853,15 @@
 	else
 		return KErrNotSupported;
 
-	// Fetch the address of cluster 0
-	aInfo.iStartBlockAddress = fatMount.FAT().DataPositionInBytes(KFirstClusterNum);
+    TInt r;
+	
+    // Fetch the address of cluster 0
+	TRAP(r, aInfo.iStartBlockAddress = fatMount.FAT().DataPositionInBytesL(KFirstClusterNum));
+	if (r != KErrNone)
+		return r;
 
-	TRAPD(r, CheckPosL(startPos));
+
+	TRAP(r, CheckPosL(startPos));
 	if (r != KErrNone)
 		return r;