Update contrib.
1 // Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // under the terms of the License "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfat\common_constants.h
15 // Declarations of the constants etc. commom for FAT16/32 Fsy.
24 #ifndef COMMON_CONSTANTS_H
25 #define COMMON_CONSTANTS_H
28 #include "filesystem_utils.h"
33 IMPORT_C TUint32 DebugRegister();
36 //-- define this for having logs disregarding DebugRegister() settings
40 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
43 #define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);}
44 #define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);}
45 #define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);}
46 #define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);}
47 #define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);}
48 #define __PRINT5(t,a,b,c,d,e) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e);}
49 #define __PRINT6(t,a,b,c,d,e,f) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e,f);}
50 #define __PRINT7(t,a,b,c,d,e,f,g) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e,f,g);}
51 #define __PRINT8BIT1(t,a) {if (DebugRegister()&KFSYS){TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}}
52 #define __PRINT1TEMP(t,a) {if (DebugRegister()&KFSERV) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
54 #define __PRINT(t) {RDebug::Print(t);}
55 #define __PRINT1(t,a) {RDebug::Print(t,a);}
56 #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
57 #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
58 #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
59 #define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);}
60 #define __PRINT6(t,a,b,c,d,e,f) {RDebug::Print(t,a,b,c,d,e,f);}
61 #define __PRINT7(t,a,b,c,d,e,f,g) {RDebug::Print(t,a,b,c,d,e,f,g);}
62 #define __PRINT8BIT1(t,a) {{TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}}
63 #define __PRINT1TEMP(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
66 #define DBG_STATEMENT(text) text
72 #define __PRINT2(t,a,b)
73 #define __PRINT3(t,a,b,c)
74 #define __PRINT4(t,a,b,c,d)
75 #define __PRINT5(t,a,b,c,d,e)
76 #define __PRINT6(t,a,b,c,d,e,f)
77 #define __PRINT7(t,a,b,c,d,e,f,g)
78 #define __PRINT8BIT1(t,a)
79 #define __PRINT1TEMP(t,a)
81 #define DBG_STATEMENT(text)
85 //-----------------------------------------------------------------------------
87 //-- define this macro in order to enable the DEMAND PAGING DIRECTORY CACHE.
88 #define USE_DP_DIR_CACHE
90 //-- define this macro in order to use "Rummage Dirictory Cache" feature: searching for the entry in the cache first
91 #define USE_DIR_CACHE_RUMMAGE
93 //-----------------------------------------------------------------------------
95 typedef TUint32 TLinAddr;
96 typedef TUint32 TFat32Entry;
97 typedef TUint16 TFat16Entry;
99 _LIT8(KLit8ReplacementForUnconvertibleUnicodeCharacters, "_");
100 _LIT8(KFileSystemName12,"FAT12 "); ///< Name in BPB given to a Fat12 volume
101 _LIT8(KFileSystemName16,"FAT16 "); ///< Name in BPB given to a Fat16 volume
102 _LIT8(KFileSystemName32,"FAT32 "); ///< Name in BPB given to a Fat32 volume
103 _LIT8(KDefaultVendorID, "EPOC"); ///< Vendor Name for BPB for any volume formated using a Symbian OS device
105 const TInt KMaxFatFileNameExt=3; ///< Maximum Fat file system file/directory name extension length
106 const TInt KNumberOfFatsInternal=1; ///< Number of FATs for an internal drive
107 const TInt KNumberOfFatsExternal=2; ///< Number of FATs for an internal drive
108 const TInt KMaxFatFileName=12; ///< Maximum Fat file system file/directory name length
109 const TInt KMaxFatFileNameWithoutExt=8; ///< Maximum Fat file system file/directory name length without extension
110 const TInt KMaxDuplicateShortName=0xFFFF;
111 const TInt KMaxVFatEntryName=13; ///< Maximum entries in a VFat name
112 const TInt KMaxFAT16Entries=0xFFF0; ///< Maximum number of clusters in a Fat16 Fat table, 65520
113 const TInt KMaxFAT12Entries=0xFF0; ///< Maximum number of clusters in a Fat12 Fat table, 4080
114 const TUint8 KBootSectorMediaDescriptor=0xF8; ///< Media descriptor for a Fat volume, Generic disk
115 const TUint8 KEntryErasedMarker=0xE5; ///< Erased entry marker for a directory entry
118 const TInt EOF_32Bit =0x0fffffff; ///< End of cluster chain value for Fat32
119 const TInt EOF_16Bit =0xffff; ///< End of cluster chain value for Fat16
120 const TInt EOF_12Bit =0xfff; ///< End of cluster chain value for Fat12
121 const TInt KBad_32Bit=0x0ffffff7; ///< Bad cluster value for Fat32
122 const TInt KBad_16Bit=0xfff7; ///< Bad cluster value for Fat16
123 const TInt KBad_12Bit=0xff7; ///< bad cluster value for Fat12
125 const TUint KSpareCluster = 0; ///< FAT entry value for the spare cluster
126 const TUint32 KFatFirstSearchCluster = 2; ///< FAT usable clusters start from 2; FAT[0] and FAT[1] are reserved
128 const TUint KFat16EntrySzLog2 = 1; ///< Log2(sizeof(TFat16Entry)); FAT16 entry is 2 bytes
129 const TUint KFat32EntrySzLog2 = 2; ///< Log2(sizeof(TFat32Entry)); FAT32 entry is 4 bytes
133 //-----------------------------------------------------------------------------
136 Internal fault codes for FAT fsy
140 EVFatNoLongName, // 0
141 EFatBadParameter, // 1
142 EFatBadLocalDrive, // 2
143 EFatBadBootSectorParameter, // 3
144 EFatBadDirEntryParameter, // 4
145 EFatBadStdFormatName, // 5
146 EFatBadDosFormatName, // 6
148 EFatFilePosBeyondEnd, // 8
149 EFatFileSeekIndexTooSmall, // 9
150 EFatFileSeekIndexTooSmall2, // 10
151 ELruCacheBadGranularity, // 11
152 EFatRawReadTooBig, // 12
153 EFatReadUidFailed, // 13
154 ELruCacheFlushNotSupported, // 14
155 EReadFileSectionFailed, // 15
156 EBadReplacementForUnconvertibleUnicodeCharacters, // 16
158 EFatRAMDriveSizeInvalid, // 17
159 EFatRAMDriveFreeInvalid, // 18
160 ECheckFatIndexZero, // 19
162 EFatCache_BadGranularity, // 20
163 EFatCache_DiscardingDirtyData, // 21
164 EFatCache_NotImplemented, // 22
165 EFatCache_BadFatType, // 23
167 EFatTable_InvalidIndex, // 24
171 //-----------------------------------------------------------------------------
176 /** debug IO control functions */
179 ECriticalWriteFailOn, ///< 0
180 ECriticalWriteFailOff, ///< 1
181 ERuggedFSysOn, ///< 2
182 ERuggedFSysOff, ///< 3
183 EIsRuggedFSys, ///< 4
184 ENCNotifierHang, ///< 5
185 ENCNotifierClear, ///< 6
187 ECNotifierCancel, ///< 8
188 ENCNotifierRepeat, ///< 9
190 ELocalTimeForRemovableMediaOn, ///< 10
191 ELocalTimeForRemovableMediaOff, ///< 11
192 ELocalTimeUsedOnRemovableMedia, ///< 12
193 ECreationTime, ///< 13
195 EDisableFATDirCache, ///<14
196 EDumpFATDirCache, ///<15
197 EFATDirCacheInfo, ///<16
199 EExtCustom=KMaxTInt/2
203 const TUid KSID_Test1={0x10210EB3}; ///< SID of the test that will define and set test property to control volume mounting
205 //-- bit flags passed by test property value. Used to control some volume mounting features.
206 const TUint32 KMntDisable_FsInfo = 0x00000001; //-- mask for disabling/enabling FSInfo information
207 const TUint32 KMntDisable_FatBkGndScan = 0x00000002; //-- mask for disabling/enabling FAT background scanner
209 #endif //#if defined(_DEBUG)
214 #endif //COMMON_CONSTANTS_H