userlibandfileserver/fileserver/sfat32/sl_file.cpp
changeset 140 2ac1c5c27758
parent 90 947f0dc9f7a8
child 176 af6ec97d9189
--- a/userlibandfileserver/fileserver/sfat32/sl_file.cpp	Mon May 24 18:45:46 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_file.cpp	Mon Jun 07 16:46:36 2010 +0100
@@ -11,7 +11,7 @@
 // Contributors:
 //
 // Description:
-// f32\sfat\sl_file.cpp
+// f32\sfat32\sl_file.cpp
 // 
 //
 
@@ -245,8 +245,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 +297,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)
 		{
@@ -367,7 +371,7 @@
 		}
 	aLength=iCurrentPos.iPos-startPos;
 
-	if(FatMount().IsRuggedFSys() && pos+(TUint)aLength > FCB_FileSize())
+	if(!IsSequentialMode() && FatMount().IsRuggedFSys() && pos+(TUint)aLength > FCB_FileSize())
 		{
 		WriteFileSizeL(pos+aLength);
 		}
@@ -381,7 +385,6 @@
 	}
 
 
-
 //-----------------------------------------------------------------------------
 
 void CFatFileCB::ResizeIndex(TInt aNewMult,TUint aNewSize)
@@ -502,7 +505,7 @@
 	if (I64HIGH(aSize))
 		User::Leave(KErrNotSupported);
 
-    DoSetSizeL(I64LOW(aSize), FatMount().IsRuggedFSys());
+	DoSetSizeL(I64LOW(aSize), FatMount().IsRuggedFSys());
 	}
 
 
@@ -520,7 +523,7 @@
 	    ASSERT(FCB_FileSize());
         ASSERT(FileSizeModified());
         
-            ClearIndex(0); //-- clear seek index array
+        ClearIndex(0); // Clear seek index array
 		
         //-- update file dir. entry
         const TUint32 cluster = FCB_StartCluster();
@@ -608,8 +611,8 @@
 	
 		FAT().FlushL();
 		
-        if(aForceCachesFlush)			// write file size if increasing
-			WriteFileSizeL(aNewSize);
+        if(!IsSequentialMode() && aForceCachesFlush)	// Write file size directly to its dir. entry if a cache flush
+			WriteFileSizeL(aNewSize);				// is needed and rugged FAT is not ignored by client
 		}
 
 	}
@@ -884,7 +887,6 @@
 	}
 
 
-
 TInt CFatFileCB::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput)
 	{
 	switch(aInterfaceId)
@@ -906,8 +908,6 @@
 	}
 
 
-
-
 /**
     Overwrites file's start cluster (iStartCluster) in its directory entry.
 */