equal
deleted
inserted
replaced
216 @leave if write error occured. |
216 @leave if write error occured. |
217 */ |
217 */ |
218 void CFatMountCB::SetVolumeCleanL(TBool aClean) |
218 void CFatMountCB::SetVolumeCleanL(TBool aClean) |
219 { |
219 { |
220 |
220 |
221 //-- The volume can't be set clean if there are objects opened on it. This precondition must be checked before calling this function |
221 //-- The volume can't be set clean if there are disk access objects opened on it. This precondition must be checked before calling this function |
222 if(aClean && LockStatus()!=0) |
222 if(aClean && Locked()) |
223 { |
223 { |
224 __PRINT1(_L("#- CFatMountCB::SetVolumeCleanL drive:%d isn't free!"),DriveNumber()); |
224 __PRINT1(_L("#- CFatMountCB::SetVolumeCleanL drive:%d isn't free!"),DriveNumber()); |
225 ASSERT(0); |
225 ASSERT(0); |
226 User::Leave(KErrInUse); |
226 User::Leave(KErrInUse); |
227 return; |
227 return; |
890 |
890 |
891 //-- mount-specific volume parameters queries that might not be handled by CFatMountCB::VolumeL |
891 //-- mount-specific volume parameters queries that might not be handled by CFatMountCB::VolumeL |
892 if(aLevel == EMountVolParamQuery) |
892 if(aLevel == EMountVolParamQuery) |
893 { |
893 { |
894 ASSERT(ConsistentState()); //-- volume state shall be consistent, otherwise its parameters do not make sense |
894 ASSERT(ConsistentState()); //-- volume state shall be consistent, otherwise its parameters do not make sense |
895 if(iRamDrive) |
895 |
896 return KErrNotSupported; //-- it requires knowledge of free space on the volume |
896 // Ram Drives calculate their total / free space based on querying HAL parameters |
|
897 // in ::VolumeL(). To make all interfaces return consistent results, we need to force |
|
898 // a fallback to that for RAM drives. |
|
899 if (iRamDrive) |
|
900 return (KErrNotSupported); |
897 |
901 |
898 switch(aOption) |
902 switch(aOption) |
899 { |
903 { |
900 //-- Request a certain amount of free space on the volume. |
904 //-- Request a certain amount of free space on the volume. |
901 case ESQ_RequestFreeSpace: |
905 case ESQ_RequestFreeSpace: |
929 |
933 |
930 //-- A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). |
934 //-- A request to obtain size of the mounted volume without blocking (CMountCB::VolumeL() can block). |
931 case ESQ_MountedVolumeSize: |
935 case ESQ_MountedVolumeSize: |
932 { |
936 { |
933 TUint64* pVal = (TUint64*)aParam; |
937 TUint64* pVal = (TUint64*)aParam; |
934 *pVal = iSize; //-- physical drive size |
938 *pVal = VolumeSizeInBytes(); |
935 |
|
936 //-- take into account space occupied by FAT table, etc. |
|
937 *pVal -= ClusterBasePosition(); |
|
938 *pVal=(*pVal >> ClusterSizeLog2()) << ClusterSizeLog2(); //-- round down to cluster size |
|
939 |
|
940 __PRINT1(_L("MountControl() MountedVolumeSize:%LU"), *pVal); |
939 __PRINT1(_L("MountControl() MountedVolumeSize:%LU"), *pVal); |
941 return KErrNone; |
940 return KErrNone; |
942 } |
941 } |
943 |
942 |
944 default: |
943 default: |
1066 if (pos<(clusterListLen<<ClusterSizeLog2())) |
1065 if (pos<(clusterListLen<<ClusterSizeLog2())) |
1067 { |
1066 { |
1068 // Read the remaining length or the entire cluster block whichever is smaller |
1067 // Read the remaining length or the entire cluster block whichever is smaller |
1069 TInt readLength = (TInt)Min((TInt64)(aLength-readTotal),(clusterListLen<<ClusterSizeLog2())-pos); |
1068 TInt readLength = (TInt)Min((TInt64)(aLength-readTotal),(clusterListLen<<ClusterSizeLog2())-pos); |
1070 __ASSERT_DEBUG(readLength>0,Fault(EReadFileSectionFailed)); |
1069 __ASSERT_DEBUG(readLength>0,Fault(EReadFileSectionFailed)); |
1071 TInt64 dataAddress=(FAT().DataPositionInBytesL(cluster))+pos; |
1070 TInt64 dataAddress=(FAT().DataPositionInBytes(cluster))+pos; |
1072 iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal, 0); |
1071 iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal, 0); |
1073 readTotal += readLength; |
1072 readTotal += readLength; |
1074 |
1073 |
1075 if (readTotal == aLength) |
1074 if (readTotal == aLength) |
1076 return; |
1075 return; |