userlibandfileserver/fileserver/sfat/fat_config.cpp
changeset 15 4122176ea935
parent 0 a41df078684a
equal deleted inserted replaced
0:a41df078684a 15:4122176ea935
    19 
    19 
    20 /**
    20 /**
    21  @file
    21  @file
    22 */
    22 */
    23 
    23 
       
    24 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    25 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    26 //!!
       
    27 //!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
       
    28 //!!
       
    29 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    30 //!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
       
    31 
    24 #include <f32fsys.h>
    32 #include <f32fsys.h>
    25 
    33 
    26 #include "common_constants.h"
    34 #include "common_constants.h"
    27 #include "sl_std.h"
    35 #include "sl_std.h"
    28 #include "fat_config.h"
    36 #include "fat_config.h"
   108 //-- New directory cache settings
   116 //-- New directory cache settings
   109 //=======================================================================================================================
   117 //=======================================================================================================================
   110 //-- New directory cache uses the global cache memory manager for dynamic size allocation
   118 //-- New directory cache uses the global cache memory manager for dynamic size allocation
   111 _LIT8(KPN_FAT_DynamicDirCacheMin, "FAT_DirCacheSizeMin"); 
   119 _LIT8(KPN_FAT_DynamicDirCacheMin, "FAT_DirCacheSizeMin"); 
   112 _LIT8(KPN_FAT_DynamicDirCacheMax, "FAT_DirCacheSizeMax"); 
   120 _LIT8(KPN_FAT_DynamicDirCacheMax, "FAT_DirCacheSizeMax"); 
   113 static const TUint32 KDef_DynamicDirCacheMin = 128;		// default minimum fat dir cache size in KB
   121 static const TUint32 KDef_DynamicDirCacheMin = 128;     // default minimum fat dir cache size in KB
   114 static const TUint32 KDef_DynamicDirCacheMax = 128;		// default maximum fat dir cache size in KB
   122 static const TUint32 KDef_DynamicDirCacheMax = 128;     // default maximum fat dir cache size in KB
   115 //-- default value for directory cache single page maximal size Log2, 2^14 (16K) by default
   123 //-- default value for directory cache single page maximal size Log2, 2^14 (16K) by default
   116 static const TUint32 KDef_MaxDynamicDirCachePageSzLog2 = 14;
   124 static const TUint32 KDef_MaxDynamicDirCachePageSzLog2 = 14;
   117 
   125 
   118 
   126 
   119 
   127 
   242     iFAT32_UseFSInfoOnMount     = ReadUint(section, KPN_FAT32_UseFsInfoOnMount,     KDef_FAT32_UseFsInfoOnMount);
   250     iFAT32_UseFSInfoOnMount     = ReadUint(section, KPN_FAT32_UseFsInfoOnMount,     KDef_FAT32_UseFsInfoOnMount);
   243     iFAT32_UseBitSupercache     = ReadUint(section, KPN_FAT32_UseFatBitSupercache,  KDef_FAT32_UseFatBitSupercache);
   251     iFAT32_UseBitSupercache     = ReadUint(section, KPN_FAT32_UseFatBitSupercache,  KDef_FAT32_UseFatBitSupercache);
   244     iFAT16_UseCleanShutDownBit  = ReadUint(section, KPN_FAT16_UseCleanShutDownBit, KDef_FAT16_UseCleanShutDownBit);
   252     iFAT16_UseCleanShutDownBit  = ReadUint(section, KPN_FAT16_UseCleanShutDownBit, KDef_FAT16_UseCleanShutDownBit);
   245 
   253 
   246     // If leaf dir cache is supported, read the configuration from estart.txt file
   254     // If leaf dir cache is supported, read the configuration from estart.txt file
   247     iLeafDirCacheSize			= ReadUint(section, KPN_FAT_LeafDirCache,  			KDef_KLeafDirCacheSize);
   255     iLeafDirCacheSize           = ReadUint(section, KPN_FAT_LeafDirCache,           KDef_KLeafDirCacheSize);
   248     ProcessDynamicDirCacheParams(section);	//-- read dynamic dir cache parameters;
   256     ProcessDynamicDirCacheParams(section);  //-- read dynamic dir cache parameters;
   249 
   257 
   250     ProcessDirCacheParams(section); //-- read FAT directory cache parameters
   258     ProcessDirCacheParams(section); //-- read FAT directory cache parameters
   251     ProcessFatCacheParams(section); //-- read FAT cache parameters
   259     ProcessFatCacheParams(section); //-- read FAT cache parameters
   252 
   260 
   253     iInitialised = ETrue;
   261     iInitialised = ETrue;
   260 /** 
   268 /** 
   261     process dynamic directory cache parameters 
   269     process dynamic directory cache parameters 
   262     @param aSection section name, like "DriveX"
   270     @param aSection section name, like "DriveX"
   263 */
   271 */
   264 void TFatConfig::ProcessDynamicDirCacheParams(const TDesC8& aSection)
   272 void TFatConfig::ProcessDynamicDirCacheParams(const TDesC8& aSection)
   265 	{
   273     {
   266 	// we have to process the data in this file as the default values are all static variables, which means
   274     // we have to process the data in this file as the default values are all static variables, which means
   267 	//  their scope is limited within this file only.
   275     //  their scope is limited within this file only.
   268     iDynamicDirCacheMaxPageSizeLog2 = KDef_MaxDynamicDirCachePageSzLog2; 
   276     iDynamicDirCacheMaxPageSizeLog2 = KDef_MaxDynamicDirCachePageSzLog2; 
   269     iDynamicDirCacheSizeMinKB = ReadUint(aSection, KPN_FAT_DynamicDirCacheMin, KDef_DynamicDirCacheMin);
   277     iDynamicDirCacheSizeMinKB = ReadUint(aSection, KPN_FAT_DynamicDirCacheMin, KDef_DynamicDirCacheMin);
   270     iDynamicDirCacheSizeMaxKB = ReadUint(aSection, KPN_FAT_DynamicDirCacheMax, KDef_DynamicDirCacheMax);
   278     iDynamicDirCacheSizeMaxKB = ReadUint(aSection, KPN_FAT_DynamicDirCacheMax, KDef_DynamicDirCacheMax);
   271 
   279 
   272     // if less than default values, set to default values
   280     // if less than default values, set to default values
   273     if (iDynamicDirCacheSizeMinKB < KDef_DynamicDirCacheMin)
   281     if (iDynamicDirCacheSizeMinKB < KDef_DynamicDirCacheMin)
   274     	iDynamicDirCacheSizeMinKB = KDef_DynamicDirCacheMin;
   282         iDynamicDirCacheSizeMinKB = KDef_DynamicDirCacheMin;
   275     if (iDynamicDirCacheSizeMaxKB < KDef_DynamicDirCacheMax)
   283     if (iDynamicDirCacheSizeMaxKB < KDef_DynamicDirCacheMax)
   276     	iDynamicDirCacheSizeMaxKB = KDef_DynamicDirCacheMax;
   284         iDynamicDirCacheSizeMaxKB = KDef_DynamicDirCacheMax;
   277 
   285 
   278     // validate settings for those values that the default values does not apply onto them
   286     // validate settings for those values that the default values does not apply onto them
   279     __ASSERT_ALWAYS(iDynamicDirCacheSizeMinKB <= iDynamicDirCacheSizeMaxKB, Fault(EFatBadParameter));
   287     __ASSERT_ALWAYS(iDynamicDirCacheSizeMinKB <= iDynamicDirCacheSizeMaxKB, Fault(EFatBadParameter));
   280 	}
   288     }
   281 
   289 
   282 /** 
   290 /** 
   283     process directory cache parameters 
   291     process directory cache parameters 
   284     @param aSection section name, like "DriveX"
   292     @param aSection section name, like "DriveX"
   285 */
   293 */
   343     @return a value from config file or default aDefaultValue
   351     @return a value from config file or default aDefaultValue
   344 */
   352 */
   345 TUint32 TFatConfig::ReadUint(const TDesC8& aSection, const TDesC8& aKeyName, TUint32 aDefaultValue) const
   353 TUint32 TFatConfig::ReadUint(const TDesC8& aSection, const TDesC8& aKeyName, TUint32 aDefaultValue) const
   346     {
   354     {
   347     TInt32 val = aDefaultValue;
   355     TInt32 val = aDefaultValue;
   348 	// coverity[check_return] coverity[unchecked_value]
   356     // coverity[check_return] coverity[unchecked_value]
   349     F32Properties::GetInt(aSection, aKeyName, val);
   357     F32Properties::GetInt(aSection, aKeyName, val);
   350 
   358 
   351     return val;
   359     return val;
   352     }
   360     }
   353 
   361