sl@0
|
1 |
// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
|
sl@0
|
2 |
// All rights reserved.
|
sl@0
|
3 |
// This component and the accompanying materials are made available
|
sl@0
|
4 |
// under the terms of the License "Eclipse Public License v1.0"
|
sl@0
|
5 |
// which accompanies this distribution, and is available
|
sl@0
|
6 |
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
|
sl@0
|
7 |
//
|
sl@0
|
8 |
// Initial Contributors:
|
sl@0
|
9 |
// Nokia Corporation - initial contribution.
|
sl@0
|
10 |
//
|
sl@0
|
11 |
// Contributors:
|
sl@0
|
12 |
//
|
sl@0
|
13 |
// Description:
|
sl@0
|
14 |
// f32\sfat\fat_config.cpp
|
sl@0
|
15 |
// Implementation of the class that reads FAT filesystem configuration parameters from the estart.txt file,
|
sl@0
|
16 |
// caches and provides access to them
|
sl@0
|
17 |
//
|
sl@0
|
18 |
//
|
sl@0
|
19 |
|
sl@0
|
20 |
/**
|
sl@0
|
21 |
@file
|
sl@0
|
22 |
*/
|
sl@0
|
23 |
|
sl@0
|
24 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
25 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
26 |
//!!
|
sl@0
|
27 |
//!! WARNING!! DO NOT edit this file !! '\sfat' component is obsolete and is not being used. '\sfat32'replaces it
|
sl@0
|
28 |
//!!
|
sl@0
|
29 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
30 |
//!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
|
sl@0
|
31 |
|
sl@0
|
32 |
#include <f32fsys.h>
|
sl@0
|
33 |
|
sl@0
|
34 |
#include "common_constants.h"
|
sl@0
|
35 |
#include "sl_std.h"
|
sl@0
|
36 |
#include "fat_config.h"
|
sl@0
|
37 |
|
sl@0
|
38 |
//########################################################################################################################
|
sl@0
|
39 |
//-- parameters that can be defined in estart.txt file under [Drive%] section
|
sl@0
|
40 |
|
sl@0
|
41 |
//=======================================================================================================================
|
sl@0
|
42 |
//-- FAT volumes mounting related settings
|
sl@0
|
43 |
//=======================================================================================================================
|
sl@0
|
44 |
|
sl@0
|
45 |
//-- if this parameter is not 0, ScanDrive will skip finalised volume. Applicable for FAT16/32
|
sl@0
|
46 |
//-- e.g: FAT_ScanDrv_SkipFinalisedVolume 1
|
sl@0
|
47 |
_LIT8(KPN_ScanDrvSkipFinalisedVolume,"FAT_ScanDrv_SkipFinalisedVolume"); //-- parameter key name
|
sl@0
|
48 |
static const TUint32 KDef_ScanDrvSkipFinalisedVolume = 0; //-- parameter default value
|
sl@0
|
49 |
|
sl@0
|
50 |
//-- if this parameter is not 0, enables asynchronous mounting FAT32 volumes.
|
sl@0
|
51 |
//-- At present it means enabling/disabling FAT32 background scanning for free clusters. Applicable for FAT32 only
|
sl@0
|
52 |
//-- e.g: FAT_FAT32_AsynchMount=0
|
sl@0
|
53 |
_LIT8(KPN_FAT32_AsynchMount, "FAT_FAT32_AsynchMount");
|
sl@0
|
54 |
static const TUint32 KDef_FAT32_AsynchMount = 1;
|
sl@0
|
55 |
|
sl@0
|
56 |
//-- Using FSInfo sector data during FAT32 mount to find out number of free clusters etc.
|
sl@0
|
57 |
//-- e.g: FAT_FAT32_UseFsInfo=1
|
sl@0
|
58 |
_LIT8(KPN_FAT32_UseFsInfoOnMount, "FAT_FAT32_UseFsInfo");
|
sl@0
|
59 |
static const TUint32 KDef_FAT32_UseFsInfoOnMount = 1;
|
sl@0
|
60 |
|
sl@0
|
61 |
//-- Using FAT bit supercache for fast free cluster lookup
|
sl@0
|
62 |
//-- e.g: FAT_FAT32_UseBitSupercache 0
|
sl@0
|
63 |
_LIT8(KPN_FAT32_UseFatBitSupercache, "FAT_FAT32_UseBitSupercache");
|
sl@0
|
64 |
static const TUint32 KDef_FAT32_UseFatBitSupercache = 1;
|
sl@0
|
65 |
|
sl@0
|
66 |
|
sl@0
|
67 |
//-- if this parameter is not 0, "clean shutdown mask" bit in FAT16[1] will be used during volume finalisation.
|
sl@0
|
68 |
//-- Otherwise, FAT16[1] will not be affected during finalisation
|
sl@0
|
69 |
//-- e.g: KDef_FAT16_UseCleanShutDownBit 0
|
sl@0
|
70 |
_LIT8(KPN_FAT16_UseCleanShutDownBit,"FAT16_UseCleanShutDownBit"); //-- parameter key name
|
sl@0
|
71 |
static const TUint32 KDef_FAT16_UseCleanShutDownBit = 1; //-- parameter default value
|
sl@0
|
72 |
|
sl@0
|
73 |
|
sl@0
|
74 |
//=======================================================================================================================
|
sl@0
|
75 |
//-- FAT directory cache settings
|
sl@0
|
76 |
//=======================================================================================================================
|
sl@0
|
77 |
//-- FAT_DirCache <CacheSizeKB>,<Log2(max page size)>
|
sl@0
|
78 |
//-- e.g: FAT_DirCache 16,12
|
sl@0
|
79 |
_LIT8(KPN_FAT_DirCache, "FAT_DirCache");
|
sl@0
|
80 |
|
sl@0
|
81 |
static const TUint32 KDef_KDirCacheSizeKB = 16; //-- default value for the total directory cache size, kilobytes. 16K by default
|
sl@0
|
82 |
static const TUint32 KDef_MaxDirCachePageSzLog2 = 12;//-- default value for directory cache single page maximal size Log2, 2^12 (4K) by default
|
sl@0
|
83 |
|
sl@0
|
84 |
|
sl@0
|
85 |
//=======================================================================================================================
|
sl@0
|
86 |
//-- FAT cache settings
|
sl@0
|
87 |
//=======================================================================================================================
|
sl@0
|
88 |
|
sl@0
|
89 |
//-- Fat16 fixed cache
|
sl@0
|
90 |
//-- FAT_FAT16FixedCache <Log2(read granularity)>,<Log2(Write granularity)>
|
sl@0
|
91 |
//-- e.g: FAT_FAT16FixedCache 12,9
|
sl@0
|
92 |
_LIT8(KPN_FAT_FAT16FixedCache, "FAT_FAT16FixedCache");
|
sl@0
|
93 |
static const TUint32 KDef_FAT16_FixedCache_Read_Granularity_LOG2 = 12; //-- read granularity Log2, 4K
|
sl@0
|
94 |
static const TUint32 KDef_FAT16_FixedCache_Write_Granularity_LOG2 = 9; //-- write granularity Log2, 512 bytes
|
sl@0
|
95 |
|
sl@0
|
96 |
|
sl@0
|
97 |
//-- Fat32 LRU cache
|
sl@0
|
98 |
//-- FAT_FAT32LruCache <Size KB>,<Log2(read granularity)>,<Log2(Write granularity)>
|
sl@0
|
99 |
//-- e.g: FAT_FAT32LruCache 128,12,9
|
sl@0
|
100 |
_LIT8(KPN_FAT_FAT32LruCache, "FAT_FAT32LruCache");
|
sl@0
|
101 |
|
sl@0
|
102 |
|
sl@0
|
103 |
static const TUint32 KDef_FAT32_LruCache_SizeKB = 128; //-- LRU cache size, 128KB
|
sl@0
|
104 |
static const TUint32 KDef_FAT32_LruCache_Read_Granularity_LOG2 = 12; //-- read granularity Log2, 4K
|
sl@0
|
105 |
static const TUint32 KDef_FAT32_LruCache_Write_Granularity_LOG2 = 9; //-- write granularity Log2, 512 bytes
|
sl@0
|
106 |
|
sl@0
|
107 |
|
sl@0
|
108 |
//=======================================================================================================================
|
sl@0
|
109 |
//-- FAT leaf directory cache settings
|
sl@0
|
110 |
//=======================================================================================================================
|
sl@0
|
111 |
//-- A leaf directory cache for Fat volumes
|
sl@0
|
112 |
_LIT8(KPN_FAT_LeafDirCache, "FAT_LeafDirCacheSize");
|
sl@0
|
113 |
static const TUint32 KDef_KLeafDirCacheSize = 1; //-- default number of the most recently visited leaf dirs to be cached
|
sl@0
|
114 |
|
sl@0
|
115 |
//=======================================================================================================================
|
sl@0
|
116 |
//-- New directory cache settings
|
sl@0
|
117 |
//=======================================================================================================================
|
sl@0
|
118 |
//-- New directory cache uses the global cache memory manager for dynamic size allocation
|
sl@0
|
119 |
_LIT8(KPN_FAT_DynamicDirCacheMin, "FAT_DirCacheSizeMin");
|
sl@0
|
120 |
_LIT8(KPN_FAT_DynamicDirCacheMax, "FAT_DirCacheSizeMax");
|
sl@0
|
121 |
static const TUint32 KDef_DynamicDirCacheMin = 128; // default minimum fat dir cache size in KB
|
sl@0
|
122 |
static const TUint32 KDef_DynamicDirCacheMax = 128; // default maximum fat dir cache size in KB
|
sl@0
|
123 |
//-- default value for directory cache single page maximal size Log2, 2^14 (16K) by default
|
sl@0
|
124 |
static const TUint32 KDef_MaxDynamicDirCachePageSzLog2 = 14;
|
sl@0
|
125 |
|
sl@0
|
126 |
|
sl@0
|
127 |
|
sl@0
|
128 |
|
sl@0
|
129 |
|
sl@0
|
130 |
|
sl@0
|
131 |
|
sl@0
|
132 |
|
sl@0
|
133 |
//########################################################################################################################
|
sl@0
|
134 |
|
sl@0
|
135 |
|
sl@0
|
136 |
|
sl@0
|
137 |
//-----------------------------------------------------------------------------
|
sl@0
|
138 |
/**
|
sl@0
|
139 |
Extract a token from the comma-separated tokens string.
|
sl@0
|
140 |
|
sl@0
|
141 |
@param aSrc source string descriptor
|
sl@0
|
142 |
@param aTokenNo token number to extract (the 1st token is number 0)
|
sl@0
|
143 |
@param aToken on success there will be extracted token
|
sl@0
|
144 |
|
sl@0
|
145 |
@return ETrue on success and an extracted token in aToken
|
sl@0
|
146 |
*/
|
sl@0
|
147 |
static TBool GetCSV_Token(const TDesC8& aSrc, TUint aTokenNo, TPtrC8& aToken)
|
sl@0
|
148 |
{
|
sl@0
|
149 |
|
sl@0
|
150 |
const TChar chDelim = ','; //-- token delimiter, comma
|
sl@0
|
151 |
TInt nRes;
|
sl@0
|
152 |
|
sl@0
|
153 |
//-- 1. find the beginning of the token we are looking for
|
sl@0
|
154 |
TPtrC8 ptrCurrToken(aSrc);
|
sl@0
|
155 |
for(TUint i=0; i<aTokenNo; ++i)
|
sl@0
|
156 |
{
|
sl@0
|
157 |
const TInt len = ptrCurrToken.Length();
|
sl@0
|
158 |
|
sl@0
|
159 |
nRes = ptrCurrToken.Locate(chDelim);
|
sl@0
|
160 |
if(nRes == KErrNotFound)
|
sl@0
|
161 |
return EFalse; //-- did tot find the required token
|
sl@0
|
162 |
|
sl@0
|
163 |
ptrCurrToken.Set(ptrCurrToken.Right(len-nRes-1));
|
sl@0
|
164 |
}
|
sl@0
|
165 |
|
sl@0
|
166 |
//-- 2. set the end position of the token we found
|
sl@0
|
167 |
aToken.Set(ptrCurrToken);
|
sl@0
|
168 |
|
sl@0
|
169 |
nRes = ptrCurrToken.Locate(chDelim);
|
sl@0
|
170 |
if(nRes != KErrNotFound)
|
sl@0
|
171 |
{
|
sl@0
|
172 |
aToken.Set(ptrCurrToken.Left(nRes));
|
sl@0
|
173 |
}
|
sl@0
|
174 |
|
sl@0
|
175 |
return ETrue;
|
sl@0
|
176 |
}
|
sl@0
|
177 |
|
sl@0
|
178 |
|
sl@0
|
179 |
//-----------------------------------------------------------------------------
|
sl@0
|
180 |
/**
|
sl@0
|
181 |
Extract a token from the comma-separated tokens string and try to convert it into TInt
|
sl@0
|
182 |
|
sl@0
|
183 |
@param aSrc source string descriptor
|
sl@0
|
184 |
@param aTokenNo token number to extract (the 1st token is number 0)
|
sl@0
|
185 |
@param aVal On success will contain the value represented by the token
|
sl@0
|
186 |
|
sl@0
|
187 |
@return ETrue if the token is extracted and converted to TInt OK, in this case aVal contains value
|
sl@0
|
188 |
*/
|
sl@0
|
189 |
static TBool GetIntTokenVal(const TDesC8& aSrc, TUint aTokenNo, TInt& aVal)
|
sl@0
|
190 |
{
|
sl@0
|
191 |
TPtrC8 ptrToken;
|
sl@0
|
192 |
TLex8 lex;
|
sl@0
|
193 |
TInt val;
|
sl@0
|
194 |
|
sl@0
|
195 |
if(!GetCSV_Token(aSrc, aTokenNo, ptrToken))
|
sl@0
|
196 |
return EFalse;
|
sl@0
|
197 |
|
sl@0
|
198 |
lex.Assign(ptrToken);
|
sl@0
|
199 |
lex.SkipSpace();
|
sl@0
|
200 |
|
sl@0
|
201 |
if(lex.Val(val) != KErrNone)
|
sl@0
|
202 |
return EFalse;
|
sl@0
|
203 |
|
sl@0
|
204 |
aVal = val;
|
sl@0
|
205 |
return ETrue;
|
sl@0
|
206 |
}
|
sl@0
|
207 |
|
sl@0
|
208 |
static TBool GetIntTokenVal(const TDesC8& aSrc, TUint aTokenNo, TUint16& aVal)
|
sl@0
|
209 |
{
|
sl@0
|
210 |
TInt val;
|
sl@0
|
211 |
if(!GetIntTokenVal(aSrc, aTokenNo, val))
|
sl@0
|
212 |
return EFalse;
|
sl@0
|
213 |
|
sl@0
|
214 |
aVal = (TUint16)val;
|
sl@0
|
215 |
return ETrue;
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
|
sl@0
|
219 |
//-----------------------------------------------------------------------------
|
sl@0
|
220 |
TFatConfig::TFatConfig()
|
sl@0
|
221 |
{
|
sl@0
|
222 |
iInitialised = EFalse;
|
sl@0
|
223 |
}
|
sl@0
|
224 |
|
sl@0
|
225 |
//-----------------------------------------------------------------------------
|
sl@0
|
226 |
|
sl@0
|
227 |
/**
|
sl@0
|
228 |
reads FAT parameters from estart.txt file.
|
sl@0
|
229 |
@param aDrvNumber a valid drive number
|
sl@0
|
230 |
@param aForceRead if ETrue parameters will be forcedly re-read.
|
sl@0
|
231 |
*/
|
sl@0
|
232 |
void TFatConfig::ReadConfig(TInt aDrvNumber, TBool aForceRead /*=EFalse*/)
|
sl@0
|
233 |
{
|
sl@0
|
234 |
if(aForceRead)
|
sl@0
|
235 |
iInitialised = EFalse;
|
sl@0
|
236 |
|
sl@0
|
237 |
if(iInitialised)
|
sl@0
|
238 |
return;
|
sl@0
|
239 |
|
sl@0
|
240 |
//__PRINT1(_L("#>- TFatConfig::ReadConfig() drive:%d\n"),aDrvNumber);
|
sl@0
|
241 |
ASSERT(aDrvNumber >= EDriveA && aDrvNumber <= EDriveZ);
|
sl@0
|
242 |
|
sl@0
|
243 |
//-- make a section name, like "DriveX"
|
sl@0
|
244 |
TBuf8<32> section;
|
sl@0
|
245 |
section.Format(_L8("Drive%c"), 'A'+aDrvNumber);
|
sl@0
|
246 |
|
sl@0
|
247 |
//-- read values from estart.txt and cache them
|
sl@0
|
248 |
iScanDrvSkipFinalisedVolume = ReadUint(section, KPN_ScanDrvSkipFinalisedVolume, KDef_ScanDrvSkipFinalisedVolume);
|
sl@0
|
249 |
iFAT32_AsynchMount = ReadUint(section, KPN_FAT32_AsynchMount, KDef_FAT32_AsynchMount);
|
sl@0
|
250 |
iFAT32_UseFSInfoOnMount = ReadUint(section, KPN_FAT32_UseFsInfoOnMount, KDef_FAT32_UseFsInfoOnMount);
|
sl@0
|
251 |
iFAT32_UseBitSupercache = ReadUint(section, KPN_FAT32_UseFatBitSupercache, KDef_FAT32_UseFatBitSupercache);
|
sl@0
|
252 |
iFAT16_UseCleanShutDownBit = ReadUint(section, KPN_FAT16_UseCleanShutDownBit, KDef_FAT16_UseCleanShutDownBit);
|
sl@0
|
253 |
|
sl@0
|
254 |
// If leaf dir cache is supported, read the configuration from estart.txt file
|
sl@0
|
255 |
iLeafDirCacheSize = ReadUint(section, KPN_FAT_LeafDirCache, KDef_KLeafDirCacheSize);
|
sl@0
|
256 |
ProcessDynamicDirCacheParams(section); //-- read dynamic dir cache parameters;
|
sl@0
|
257 |
|
sl@0
|
258 |
ProcessDirCacheParams(section); //-- read FAT directory cache parameters
|
sl@0
|
259 |
ProcessFatCacheParams(section); //-- read FAT cache parameters
|
sl@0
|
260 |
|
sl@0
|
261 |
iInitialised = ETrue;
|
sl@0
|
262 |
|
sl@0
|
263 |
DumpParameters(); //-- print out parameters in debug mode
|
sl@0
|
264 |
}
|
sl@0
|
265 |
|
sl@0
|
266 |
|
sl@0
|
267 |
//-----------------------------------------------------------------------------
|
sl@0
|
268 |
/**
|
sl@0
|
269 |
process dynamic directory cache parameters
|
sl@0
|
270 |
@param aSection section name, like "DriveX"
|
sl@0
|
271 |
*/
|
sl@0
|
272 |
void TFatConfig::ProcessDynamicDirCacheParams(const TDesC8& aSection)
|
sl@0
|
273 |
{
|
sl@0
|
274 |
// we have to process the data in this file as the default values are all static variables, which means
|
sl@0
|
275 |
// their scope is limited within this file only.
|
sl@0
|
276 |
iDynamicDirCacheMaxPageSizeLog2 = KDef_MaxDynamicDirCachePageSzLog2;
|
sl@0
|
277 |
iDynamicDirCacheSizeMinKB = ReadUint(aSection, KPN_FAT_DynamicDirCacheMin, KDef_DynamicDirCacheMin);
|
sl@0
|
278 |
iDynamicDirCacheSizeMaxKB = ReadUint(aSection, KPN_FAT_DynamicDirCacheMax, KDef_DynamicDirCacheMax);
|
sl@0
|
279 |
|
sl@0
|
280 |
// if less than default values, set to default values
|
sl@0
|
281 |
if (iDynamicDirCacheSizeMinKB < KDef_DynamicDirCacheMin)
|
sl@0
|
282 |
iDynamicDirCacheSizeMinKB = KDef_DynamicDirCacheMin;
|
sl@0
|
283 |
if (iDynamicDirCacheSizeMaxKB < KDef_DynamicDirCacheMax)
|
sl@0
|
284 |
iDynamicDirCacheSizeMaxKB = KDef_DynamicDirCacheMax;
|
sl@0
|
285 |
|
sl@0
|
286 |
// validate settings for those values that the default values does not apply onto them
|
sl@0
|
287 |
__ASSERT_ALWAYS(iDynamicDirCacheSizeMinKB <= iDynamicDirCacheSizeMaxKB, Fault(EFatBadParameter));
|
sl@0
|
288 |
}
|
sl@0
|
289 |
|
sl@0
|
290 |
/**
|
sl@0
|
291 |
process directory cache parameters
|
sl@0
|
292 |
@param aSection section name, like "DriveX"
|
sl@0
|
293 |
*/
|
sl@0
|
294 |
void TFatConfig::ProcessDirCacheParams(const TDesC8& aSection)
|
sl@0
|
295 |
{
|
sl@0
|
296 |
TBuf8<128> buf;
|
sl@0
|
297 |
|
sl@0
|
298 |
//-- set default values.
|
sl@0
|
299 |
iDirCacheSizeKB = KDef_KDirCacheSizeKB;
|
sl@0
|
300 |
iDirCacheMaxPageSizeLog2 = KDef_MaxDirCachePageSzLog2;
|
sl@0
|
301 |
|
sl@0
|
302 |
//-- read a string containing DirCache parameters
|
sl@0
|
303 |
//-- it looks like this: FAT_DirCache cacheSzKB, maxPageSzBytes
|
sl@0
|
304 |
if(!F32Properties::GetString(aSection, KPN_FAT_DirCache, buf))
|
sl@0
|
305 |
return;
|
sl@0
|
306 |
|
sl@0
|
307 |
GetIntTokenVal(buf, 0, iDirCacheSizeKB); //-- 1. extract directory cache size in KB. this is token 0
|
sl@0
|
308 |
GetIntTokenVal(buf, 1, iDirCacheMaxPageSizeLog2); //-- 2. extract directory cache max page size in bytes Log2. this is token 1
|
sl@0
|
309 |
}
|
sl@0
|
310 |
|
sl@0
|
311 |
//-----------------------------------------------------------------------------
|
sl@0
|
312 |
/**
|
sl@0
|
313 |
process fat cache parameters
|
sl@0
|
314 |
@param aSection section name, like "DriveX"
|
sl@0
|
315 |
*/
|
sl@0
|
316 |
void TFatConfig::ProcessFatCacheParams(const TDesC8& aSection)
|
sl@0
|
317 |
{
|
sl@0
|
318 |
TBuf8<128> buf;
|
sl@0
|
319 |
//-- set default values.
|
sl@0
|
320 |
iFat16FixedCacheReadGrLog2 = KDef_FAT16_FixedCache_Read_Granularity_LOG2;
|
sl@0
|
321 |
iFat16FixedCacheWriteGrLog2 = KDef_FAT16_FixedCache_Write_Granularity_LOG2;
|
sl@0
|
322 |
|
sl@0
|
323 |
iFat32LRUCacheSizeKB = KDef_FAT32_LruCache_SizeKB;
|
sl@0
|
324 |
iFat32LRUCacheReadGrLog2 = KDef_FAT32_LruCache_Read_Granularity_LOG2;
|
sl@0
|
325 |
iFat32LRUCacheWriteGrLog2 = KDef_FAT32_LruCache_Write_Granularity_LOG2;
|
sl@0
|
326 |
|
sl@0
|
327 |
//-- read a string containing FAT16 fixed cache parameters
|
sl@0
|
328 |
if(F32Properties::GetString(aSection, KPN_FAT_FAT16FixedCache, buf))
|
sl@0
|
329 |
{
|
sl@0
|
330 |
GetIntTokenVal(buf, 0, iFat16FixedCacheReadGrLog2); //-- 1. extract Log2(FAT16 fixed cache read granularity)
|
sl@0
|
331 |
GetIntTokenVal(buf, 1, iFat16FixedCacheWriteGrLog2); //-- 2. extract Log2(FAT16 fixed cache write granularity)
|
sl@0
|
332 |
}
|
sl@0
|
333 |
|
sl@0
|
334 |
//-- read a string containing FAT32 LRU cache parameters
|
sl@0
|
335 |
if(F32Properties::GetString(aSection, KPN_FAT_FAT32LruCache, buf))
|
sl@0
|
336 |
{
|
sl@0
|
337 |
GetIntTokenVal(buf, 0, iFat32LRUCacheSizeKB); //-- 1. extract FAT32 LRU cache size, Kbytes
|
sl@0
|
338 |
GetIntTokenVal(buf, 1, iFat32LRUCacheReadGrLog2); //-- 2. extract Log2(FAT32 LRU cache read granularity)
|
sl@0
|
339 |
GetIntTokenVal(buf, 2, iFat32LRUCacheWriteGrLog2); //-- 3. extract Log2(FAT32 LRU cache write granularity)
|
sl@0
|
340 |
}
|
sl@0
|
341 |
}
|
sl@0
|
342 |
|
sl@0
|
343 |
|
sl@0
|
344 |
//-----------------------------------------------------------------------------
|
sl@0
|
345 |
/**
|
sl@0
|
346 |
Just a helper method. Reads TUint32 value from the estart.txt
|
sl@0
|
347 |
|
sl@0
|
348 |
@param aSection section name, e.g. [DriveD]
|
sl@0
|
349 |
@param aKeyName Key name
|
sl@0
|
350 |
@param aDefaultValue Default value to return in parameter isn't found
|
sl@0
|
351 |
@return a value from config file or default aDefaultValue
|
sl@0
|
352 |
*/
|
sl@0
|
353 |
TUint32 TFatConfig::ReadUint(const TDesC8& aSection, const TDesC8& aKeyName, TUint32 aDefaultValue) const
|
sl@0
|
354 |
{
|
sl@0
|
355 |
TInt32 val = aDefaultValue;
|
sl@0
|
356 |
// coverity[check_return] coverity[unchecked_value]
|
sl@0
|
357 |
F32Properties::GetInt(aSection, aKeyName, val);
|
sl@0
|
358 |
|
sl@0
|
359 |
return val;
|
sl@0
|
360 |
}
|
sl@0
|
361 |
|
sl@0
|
362 |
//-----------------------------------------------------------------------------
|
sl@0
|
363 |
/** Debug method, prints out the parameters*/
|
sl@0
|
364 |
void TFatConfig::DumpParameters() const
|
sl@0
|
365 |
{
|
sl@0
|
366 |
#ifdef _DEBUG
|
sl@0
|
367 |
|
sl@0
|
368 |
ASSERT(iInitialised);
|
sl@0
|
369 |
__PRINT(_L("#>- TFatConfig parameters:\n"));
|
sl@0
|
370 |
|
sl@0
|
371 |
DoDumpUintParam(KPN_ScanDrvSkipFinalisedVolume, iScanDrvSkipFinalisedVolume);
|
sl@0
|
372 |
DoDumpUintParam(KPN_FAT32_AsynchMount, iFAT32_AsynchMount);
|
sl@0
|
373 |
DoDumpUintParam(KPN_FAT32_UseFsInfoOnMount, iFAT32_UseFSInfoOnMount);
|
sl@0
|
374 |
DoDumpUintParam(KPN_FAT32_UseFatBitSupercache, iFAT32_UseBitSupercache);
|
sl@0
|
375 |
DoDumpUintParam(KPN_FAT16_UseCleanShutDownBit, iFAT16_UseCleanShutDownBit);
|
sl@0
|
376 |
|
sl@0
|
377 |
DoDumpUintParam(_L8("FAT_DirCache Size, KB"), iDirCacheSizeKB);
|
sl@0
|
378 |
DoDumpUintParam(_L8("FAT_DirCache MaxPage Size Log2"), iDirCacheMaxPageSizeLog2);
|
sl@0
|
379 |
|
sl@0
|
380 |
DoDumpUintParam(_L8("FAT_16Cache RdGr Log2"), iFat16FixedCacheReadGrLog2);
|
sl@0
|
381 |
DoDumpUintParam(_L8("FAT_16Cache WrGr Log2"), iFat16FixedCacheWriteGrLog2);
|
sl@0
|
382 |
|
sl@0
|
383 |
DoDumpUintParam(_L8("FAT_32Cache Size, KB"), iFat32LRUCacheSizeKB);
|
sl@0
|
384 |
DoDumpUintParam(_L8("FAT_32Cache RdGr Log2"), iFat32LRUCacheReadGrLog2);
|
sl@0
|
385 |
DoDumpUintParam(_L8("FAT_32Cache WrGr Log2"), iFat32LRUCacheWriteGrLog2);
|
sl@0
|
386 |
|
sl@0
|
387 |
__PRINT(_L("#>------ end -------<#\n\n"));
|
sl@0
|
388 |
|
sl@0
|
389 |
#endif
|
sl@0
|
390 |
}
|
sl@0
|
391 |
|
sl@0
|
392 |
void TFatConfig::DoDumpUintParam(const TDesC8& aKeyName, TUint32 aParam) const
|
sl@0
|
393 |
{
|
sl@0
|
394 |
#ifdef _DEBUG
|
sl@0
|
395 |
TBuf<100> buf;
|
sl@0
|
396 |
|
sl@0
|
397 |
buf.Copy(aKeyName);
|
sl@0
|
398 |
buf.Insert(0,_L("#>- "));
|
sl@0
|
399 |
buf.AppendFormat(_L(": %d"), aParam);
|
sl@0
|
400 |
__PRINT(buf);
|
sl@0
|
401 |
#else
|
sl@0
|
402 |
(void)aKeyName; (void)aParam; //-- get rid of warning
|
sl@0
|
403 |
|
sl@0
|
404 |
#endif
|
sl@0
|
405 |
}
|
sl@0
|
406 |
|
sl@0
|
407 |
|
sl@0
|
408 |
|
sl@0
|
409 |
|
sl@0
|
410 |
|
sl@0
|
411 |
|
sl@0
|
412 |
|
sl@0
|
413 |
|
sl@0
|
414 |
|
sl@0
|
415 |
|
sl@0
|
416 |
|
sl@0
|
417 |
|
sl@0
|
418 |
|
sl@0
|
419 |
|
sl@0
|
420 |
|
sl@0
|
421 |
|
sl@0
|
422 |
|
sl@0
|
423 |
|
sl@0
|
424 |
|
sl@0
|
425 |
|
sl@0
|
426 |
|
sl@0
|
427 |
|
sl@0
|
428 |
|
sl@0
|
429 |
|
sl@0
|
430 |
|
sl@0
|
431 |
|