userlibandfileserver/fileserver/sfat32/sl_mnt.cpp
branchRCL_3
changeset 249 a179b74831c9
parent 248 0ffb4e86fcc9
child 256 c1f20ce4abcf
--- a/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp	Thu Jul 15 20:11:42 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp	Thu Aug 19 11:14:22 2010 +0300
@@ -1610,7 +1610,7 @@
 /**
     Overwrite as many contiguous file clusters as possible.
 */
-void CFatMountCB::DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster)
+void CFatMountCB::DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag)
     {
 
     __PRINT(_L("CFatMountCB::DoWriteToClusterListL"));
@@ -1622,9 +1622,9 @@
     const TInt maxClusters=((aLength+clusterRelativePos-1)>>ClusterSizeLog2())+1;
     const TInt clusterListLen=FAT().CountContiguousClustersL(aPos.iCluster,endCluster,maxClusters);
     const TInt writeLength=Min(aLength,(clusterListLen<<ClusterSizeLog2())-clusterRelativePos);
-    TInt64 dataStart=FAT().DataPositionInBytes(aPos.iCluster)+clusterRelativePos;
-
-    TRAPD(r, iRawDisk->WriteL(dataStart,writeLength,aSrc,aMessage,anOffset));
+    TInt64 dataStart=FAT().DataPositionInBytesL(aPos.iCluster)+clusterRelativePos;
+
+    TRAPD(r, iRawDisk->WriteL(dataStart,writeLength,aSrc,aMessage,anOffset, aFlag));
 
     if(r == KErrNone) // Write succeded
         {
@@ -1653,7 +1653,7 @@
         if((aPos.iPos != 0) && (badcluster == aPos.iCluster) && (aLastcluster == 0) && (aPos.iCluster == cluster))
             { //Copy the contents already present in this cluster to new cluster allocated.
             const TInt sizeToRead = aPos.iPos - ((aPos.iPos >> ClusterSizeLog2()) << ClusterSizeLog2());
-            dataStart = FAT().DataPositionInBytes(aPos.iCluster) + ClusterRelativePos((aPos.iPos - sizeToRead));
+            dataStart = FAT().DataPositionInBytesL(aPos.iCluster) + ClusterRelativePos((aPos.iPos - sizeToRead));
 
 
             //-- Allocate the buffer required to copy the contents from bad cluster
@@ -1682,7 +1682,7 @@
                 {
                 //Calculate and copy the contents to new cluster.
                 aPos.iCluster = goodcluster;
-                dataStart = FAT().DataPositionInBytes(aPos.iCluster) + ClusterRelativePos(aPos.iPos - sizeToRead);
+                dataStart = FAT().DataPositionInBytesL(aPos.iCluster) + ClusterRelativePos(aPos.iPos - sizeToRead);
 
                 r = LocalDrive()->Write(dataStart, clustBuf);
                 if(r == KErrNone)
@@ -1739,7 +1739,7 @@
 
 //-----------------------------------------------------------------------------------------
 
-void CFatMountCB::WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster)
+void CFatMountCB::WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag)
 //
 // Overwrite cluster list.
 //
@@ -1761,7 +1761,7 @@
     TInt previouscluster=0;
     FOREVER
         {
-        DoWriteToClusterListL(aPos,length-offset,aSrc,aMessage,anOffset+offset, previouscluster, aBadcluster, aGoodcluster);
+        DoWriteToClusterListL(aPos,length-offset,aSrc,aMessage,anOffset+offset, previouscluster, aBadcluster, aGoodcluster, aFlag);
         if (offset == (aPos.iPos-startPos))
             continue;
         offset=aPos.iPos-startPos;
@@ -1776,7 +1776,7 @@
 
 //-----------------------------------------------------------------------------------------
 
-void CFatMountCB::DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const
+void CFatMountCB::DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const
 //
 // Read from as many contiguous file clusters as possible
 //
@@ -1790,9 +1790,9 @@
     const TInt maxClusters=((aLength+clusterRelativePos-1)>>ClusterSizeLog2())+1;
     const TInt clusterListLen=FAT().CountContiguousClustersL(aPos.iCluster,endCluster,maxClusters);
     const TInt readLength=Min(aLength,(clusterListLen<<ClusterSizeLog2())-clusterRelativePos);
-    const TInt64 dataStart=FAT().DataPositionInBytes(aPos.iCluster)+clusterRelativePos;
-
-    TRAPD(r, iRawDisk->ReadL(dataStart,readLength,aTrg,aMessage,anOffset));
+    const TInt64 dataStart=FAT().DataPositionInBytesL(aPos.iCluster)+clusterRelativePos;
+
+    TRAPD(r, iRawDisk->ReadL(dataStart,readLength,aTrg,aMessage,anOffset, aFlag));
 
     if(r == KErrNone) // Read succeded
         {
@@ -1817,7 +1817,7 @@
 
 //-----------------------------------------------------------------------------------------
 
-void CFatMountCB::ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const
+void CFatMountCB::ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const
 //
 // Read from cluster list
 //
@@ -1837,7 +1837,7 @@
     TInt offset=0;
     FOREVER
         {
-        DoReadFromClusterListL(aPos,aLength-offset,aTrg,aMessage,anOffset+offset);
+        DoReadFromClusterListL(aPos,aLength-offset,aTrg,aMessage,anOffset+offset, aFlag);
         offset=aPos.iPos-startPos;
         if ((offset<aLength))
             {
@@ -3154,7 +3154,7 @@
         User::Leave(KErrCorrupt);
 
     TBuf8<sizeof(TCheckedUid)> uidBuf;
-    iRawDisk->ReadCachedL(FAT().DataPositionInBytes(aCluster),sizeof(TCheckedUid),uidBuf);
+    iRawDisk->ReadCachedL(FAT().DataPositionInBytesL(aCluster),sizeof(TCheckedUid),uidBuf);
     __ASSERT_DEBUG(uidBuf.Length()==sizeof(TCheckedUid),Fault(EFatReadUidFailed));
     TCheckedUid uid(uidBuf);
     anEntry.iType=uid.UidType();
@@ -3230,8 +3230,8 @@
 			//  Read the remaining length or the entire cluster block whichever is smaller
 			TInt readLength = Min(aLength-readTotal,(clusterListLen<<ClusterSizeLog2())-pos);
 			__ASSERT_DEBUG(readLength>0,Fault(EReadFileSectionFailed));
-			TInt64 dataAddress=(FAT().DataPositionInBytes(cluster))+pos;
-			iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal);
+			TInt64 dataAddress=(FAT().DataPositionInBytesL(cluster))+pos;
+			iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal, 0);
 			readTotal += readLength;
 
 			if (readTotal == aLength)
@@ -3259,7 +3259,7 @@
 // Read aLength of data from disk directly to thread relative descriptor
 //
     {
-    iRawDisk->ReadL(aPos,aLength,aTrg,aMessage,anOffset);
+    iRawDisk->ReadL(aPos,aLength,aTrg,aMessage,anOffset, 0);
     }
 
 //-----------------------------------------------------------------------------------------
@@ -3274,7 +3274,7 @@
 	//-- check if we are trying to write to the FAT directly and wait until FAT scan thread finishes in this case.
     FAT().RequestRawWriteAccess(aPos, aLength);
 
-    iRawDisk->WriteL(aPos,aLength,aSrc,aMessage,anOffset);
+    iRawDisk->WriteL(aPos,aLength,aSrc,aMessage,anOffset, 0);
     //-- Note: FAT directory cache will be invalidated in MountL()
     }
 
@@ -3434,7 +3434,7 @@
     if (!IsRootDir(aPos))
         {
         TInt relPos=ClusterRelativePos(aPos.iPos);
-        return FAT().DataPositionInBytes(aPos.iCluster)+relPos;
+        return FAT().DataPositionInBytesL(aPos.iCluster)+relPos;
         }
     if (aPos.iPos+StartOfRootDirInBytes()>=RootDirEnd())
         User::Leave(KErrDirFull); // Past last root dir entry
@@ -4070,7 +4070,7 @@
             User::LeaveIfError(r);
         if ( caps().iType&EMediaRam )
             {
-            realPosition = FAT().DataPositionInBytes( aPos.iCluster );
+            realPosition = FAT().DataPositionInBytesL( aPos.iCluster );
             aPos.iCluster = I64LOW((realPosition - aInfo.iStartBlockAddress)>>ClusterSizeLog2());
             blockMapEntry.SetStartBlock( aPos.iCluster );
             }