userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp
changeset 271 dc268b18d709
parent 269 d57b86b1867a
child 291 206a6eaaeb71
--- a/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp	Mon Sep 13 15:16:07 2010 +0100
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp	Wed Sep 22 10:53:45 2010 +0100
@@ -593,8 +593,10 @@
     Tries to figure out number of FATs, SPC, etc. values passed from the user side.
     This method is called if the user has specified some formatting parameters, like SPC
 */
-TInt CFatFormatCB::ProcessVolParam_User(const TLocalDriveCapsV6& /*aCaps*/)
+TInt CFatFormatCB::ProcessVolParam_User(const TLocalDriveCapsV6& aCaps)
 {
+    (void)aCaps;
+
     __PRINT1(_L("CFatFormatCB::ProcessVolParam_User() sectors:%d"), iMaxDiskSectors);
     Dump_TLDFormatInfo(iSpecialInfo());
 
@@ -739,6 +741,17 @@
 {
     __PRINT(_L("CFatFormatCB::ProcessVolParam_Custom()"));
     
+    ASSERT(aCaps.iExtraInfo);
+
+    //-- the driver may have decided which file system should be used on the media.
+    //-- E.g. for SD cards > 32GB exFAT must be used.
+    if(aCaps.iFileSystemId != KDriveFileSysFAT)
+        {//-- the media driver decides that other than FAT FS must be used on the media.
+        __PRINT1(_L(" the media driver required other than FAT FS:%d"), aCaps.iFileSystemId);
+        return KErrNotSupported;
+        }
+    
+    
     //-- TLDFormatInfo structure is filled by the media driver, it decides the media formatting parameters
     const TLDFormatInfo& fmtInfo = aCaps.iFormatInfo;
     Dump_TLDFormatInfo(fmtInfo);
@@ -934,13 +947,19 @@
 /**
     Initialize the format parameters for a variable sized disk (RAM drive)
     
-    @param  aDiskSizeInSectors volume size in sectors
     @return standard error code
 */
-TInt CFatFormatCB::ProcessVolParam_RamDisk()
+TInt CFatFormatCB::ProcessVolParam_RamDisk(const TLocalDriveCapsV6& aCaps)
 	{
 	__PRINT1(_L("CFatFormatCB::ProcessVolParam_RamDisk() sectors:%d"), iMaxDiskSectors);
 
+    if(aCaps.iFileSystemId != KDriveFileSysFAT)
+        {//-- RAM media driver must set this value correctly.
+        __PRINT1(_L("RAM media driver required other than FAT FS:%d"), aCaps.iFileSystemId);
+        ASSERT(0);
+        return KErrNotSupported;
+        }
+
     iNumberOfFats   = 2; // 1 FAT 1 Indirection table (FIT)
 	iReservedSectors= 1;
 	iRootDirEntries = 2*(4*KDefaultSectorSize)/sizeof(SFatDirEntry);