1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000
1.2 +++ b/os/kernelhwsrv/userlibandfileserver/fileserver/sfat32/common_constants.h Fri Jun 15 03:10:57 2012 +0200
1.3 @@ -0,0 +1,232 @@
1.4 +// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 +// All rights reserved.
1.6 +// This component and the accompanying materials are made available
1.7 +// under the terms of the License "Eclipse Public License v1.0"
1.8 +// which accompanies this distribution, and is available
1.9 +// at the URL "http://www.eclipse.org/legal/epl-v10.html".
1.10 +//
1.11 +// Initial Contributors:
1.12 +// Nokia Corporation - initial contribution.
1.13 +//
1.14 +// Contributors:
1.15 +//
1.16 +// Description:
1.17 +// f32\sfat\common_constants.h
1.18 +// Declarations of the constants etc. commom for FAT16/32 Fsy.
1.19 +//
1.20 +//
1.21 +
1.22 +/**
1.23 + @file
1.24 + @internalTechnology
1.25 +*/
1.26 +
1.27 +#ifndef COMMON_CONSTANTS_H
1.28 +#define COMMON_CONSTANTS_H
1.29 +
1.30 +
1.31 +#include "filesystem_utils.h"
1.32 +#include <f32fsys.h>
1.33 +#include <f32dbg.h>
1.34 +
1.35 +
1.36 +IMPORT_C TUint32 DebugRegister();
1.37 +
1.38 +
1.39 +//-- define this for having logs disregarding DebugRegister() settings
1.40 +//#define FORCE_LOGS
1.41 +
1.42 +
1.43 +#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
1.44 +
1.45 +#ifndef FORCE_LOGS
1.46 + #define __PRINT(t) {if (DebugRegister()&KFSYS) RDebug::Print(t);}
1.47 + #define __PRINT1(t,a) {if (DebugRegister()&KFSYS) RDebug::Print(t,a);}
1.48 + #define __PRINT2(t,a,b) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b);}
1.49 + #define __PRINT3(t,a,b,c) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c);}
1.50 + #define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d);}
1.51 + #define __PRINT5(t,a,b,c,d,e) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e);}
1.52 + #define __PRINT6(t,a,b,c,d,e,f) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e,f);}
1.53 + #define __PRINT7(t,a,b,c,d,e,f,g) {if (DebugRegister()&KFSYS) RDebug::Print(t,a,b,c,d,e,f,g);}
1.54 + #define __PRINT8BIT1(t,a) {if (DebugRegister()&KFSYS){TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}}
1.55 + #define __PRINT1TEMP(t,a) {if (DebugRegister()&KFSERV) {TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
1.56 +#else //FORCE_LOGS
1.57 + #define __PRINT(t) {RDebug::Print(t);}
1.58 + #define __PRINT1(t,a) {RDebug::Print(t,a);}
1.59 + #define __PRINT2(t,a,b) {RDebug::Print(t,a,b);}
1.60 + #define __PRINT3(t,a,b,c) {RDebug::Print(t,a,b,c);}
1.61 + #define __PRINT4(t,a,b,c,d) {RDebug::Print(t,a,b,c,d);}
1.62 + #define __PRINT5(t,a,b,c,d,e) {RDebug::Print(t,a,b,c,d,e);}
1.63 + #define __PRINT6(t,a,b,c,d,e,f) {RDebug::Print(t,a,b,c,d,e,f);}
1.64 + #define __PRINT7(t,a,b,c,d,e,f,g) {RDebug::Print(t,a,b,c,d,e,f,g);}
1.65 + #define __PRINT8BIT1(t,a) {{TFileName temp;temp.Copy(a);RDebug::Print(t,&temp);}}
1.66 + #define __PRINT1TEMP(t,a) {{TBuf<KMaxFileName>temp(a);RDebug::Print(t,&temp);}}
1.67 +#endif//FORCE_LOGS
1.68 +
1.69 +#define DBG_STATEMENT(text) text
1.70 +
1.71 +#else
1.72 +
1.73 +#define __PRINT(t)
1.74 +#define __PRINT1(t,a)
1.75 +#define __PRINT2(t,a,b)
1.76 +#define __PRINT3(t,a,b,c)
1.77 +#define __PRINT4(t,a,b,c,d)
1.78 +#define __PRINT5(t,a,b,c,d,e)
1.79 +#define __PRINT6(t,a,b,c,d,e,f)
1.80 +#define __PRINT7(t,a,b,c,d,e,f,g)
1.81 +#define __PRINT8BIT1(t,a)
1.82 +#define __PRINT1TEMP(t,a)
1.83 +
1.84 +#define DBG_STATEMENT(text)
1.85 +
1.86 +#endif
1.87 +
1.88 +//-----------------------------------------------------------------------------
1.89 +
1.90 +//-- define this macro in order to enable the DEMAND PAGING DIRECTORY CACHE.
1.91 +#define USE_DP_DIR_CACHE
1.92 +
1.93 +//-- define this macro in order to use "Rummage Dirictory Cache" feature: searching for the entry in the cache first
1.94 +#define USE_DIR_CACHE_RUMMAGE
1.95 +
1.96 +//-----------------------------------------------------------------------------
1.97 +
1.98 +typedef TUint32 TLinAddr;
1.99 +typedef TUint32 TFat32Entry;
1.100 +typedef TUint16 TFat16Entry;
1.101 +
1.102 +_LIT8(KLit8ReplacementForUnconvertibleUnicodeCharacters, "_");
1.103 +_LIT8(KFileSystemName12,"FAT12 "); ///< Name in BPB given to a Fat12 volume
1.104 +_LIT8(KFileSystemName16,"FAT16 "); ///< Name in BPB given to a Fat16 volume
1.105 +_LIT8(KFileSystemName32,"FAT32 "); ///< Name in BPB given to a Fat32 volume
1.106 +_LIT8(KDefaultVendorID, "EPOC"); ///< Vendor Name for BPB for any volume formated using a Symbian OS device
1.107 +
1.108 +const TInt KMaxFatFileNameExt=3; ///< Maximum Fat file system file/directory name extension length
1.109 +const TInt KNumberOfFatsInternal=1; ///< Number of FATs for an internal drive
1.110 +const TInt KNumberOfFatsExternal=2; ///< Number of FATs for an internal drive
1.111 +const TInt KMaxFatFileName=12; ///< Maximum Fat file system file/directory name length
1.112 +const TInt KMaxFatFileNameWithoutExt=8; ///< Maximum Fat file system file/directory name length without extension
1.113 +const TInt KMaxDuplicateShortName=0xFFFF;
1.114 +const TInt KMaxVFatEntryName=13; ///< Maximum entries in a VFat name
1.115 +const TInt KMaxFAT16Entries=0xFFF0; ///< Maximum number of clusters in a Fat16 Fat table, 65520
1.116 +const TInt KMaxFAT12Entries=0xFF0; ///< Maximum number of clusters in a Fat12 Fat table, 4080
1.117 +const TUint8 KBootSectorMediaDescriptor=0xF8; ///< Media descriptor for a Fat volume, Generic disk
1.118 +const TUint8 KEntryErasedMarker=0xE5; ///< Erased entry marker for a directory entry
1.119 +
1.120 +
1.121 +const TInt EOF_32Bit =0x0fffffff; ///< End of cluster chain value for Fat32
1.122 +const TInt EOF_16Bit =0xffff; ///< End of cluster chain value for Fat16
1.123 +const TInt EOF_12Bit =0xfff; ///< End of cluster chain value for Fat12
1.124 +const TInt KBad_32Bit=0x0ffffff7; ///< Bad cluster value for Fat32
1.125 +const TInt KBad_16Bit=0xfff7; ///< Bad cluster value for Fat16
1.126 +const TInt KBad_12Bit=0xff7; ///< bad cluster value for Fat12
1.127 +
1.128 +const TUint KSpareCluster = 0; ///< FAT entry value for the spare cluster
1.129 +const TUint32 KFatFirstSearchCluster = 2; ///< FAT usable clusters start from 2; FAT[0] and FAT[1] are reserved
1.130 +
1.131 +const TUint KFat16EntrySzLog2 = 1; ///< Log2(sizeof(TFat16Entry)); FAT16 entry is 2 bytes
1.132 +const TUint KFat32EntrySzLog2 = 2; ///< Log2(sizeof(TFat32Entry)); FAT32 entry is 4 bytes
1.133 +
1.134 +
1.135 +
1.136 +//-----------------------------------------------------------------------------
1.137 +
1.138 +/**
1.139 +Internal fault codes for FAT fsy
1.140 +*/
1.141 +enum TFault
1.142 + {
1.143 + EVFatNoLongName, // 0
1.144 + EFatBadParameter, // 1
1.145 + EFatBadLocalDrive, // 2
1.146 + EFatBadBootSectorParameter, // 3
1.147 + EFatBadDirEntryParameter, // 4
1.148 + EFatBadStdFormatName, // 5
1.149 + EFatBadDosFormatName, // 6
1.150 + EFatCorrupt, // 7
1.151 + EFatFilePosBeyondEnd, // 8
1.152 + EFatFileSeekIndexTooSmall, // 9
1.153 + EFatFileSeekIndexTooSmall2, // 10
1.154 + ELruCacheBadGranularity, // 11
1.155 + EFatRawReadTooBig, // 12
1.156 + EFatReadUidFailed, // 13
1.157 + ELruCacheFlushNotSupported, // 14
1.158 + EReadFileSectionFailed, // 15
1.159 + EBadReplacementForUnconvertibleUnicodeCharacters, // 16
1.160 +
1.161 + EFatRAMDriveSizeInvalid, // 17
1.162 + EFatRAMDriveFreeInvalid, // 18
1.163 + ECheckFatIndexZero, // 19
1.164 +
1.165 + EFatCache_BadGranularity, // 20
1.166 + EFatCache_DiscardingDirtyData, // 21
1.167 + EFatCache_NotImplemented, // 22
1.168 + EFatCache_BadFatType, // 23
1.169 +
1.170 + EFatTable_InvalidIndex, // 24
1.171 +
1.172 + };
1.173 +
1.174 +//-----------------------------------------------------------------------------
1.175 +
1.176 +
1.177 +#if defined(_DEBUG)
1.178 +
1.179 +/** debug IO control functions */
1.180 +enum TControlIO
1.181 +{
1.182 + ECriticalWriteFailOn, ///< 0
1.183 + ECriticalWriteFailOff, ///< 1
1.184 + ERuggedFSysOn, ///< 2
1.185 + ERuggedFSysOff, ///< 3
1.186 + EIsRuggedFSys, ///< 4
1.187 + ENCNotifierHang, ///< 5
1.188 + ENCNotifierClear, ///< 6
1.189 + ECNotifier, ///< 7
1.190 + ECNotifierCancel, ///< 8
1.191 + ENCNotifierRepeat, ///< 9
1.192 +
1.193 + ELocalTimeForRemovableMediaOn, ///< 10
1.194 + ELocalTimeForRemovableMediaOff, ///< 11
1.195 + ELocalTimeUsedOnRemovableMedia, ///< 12
1.196 + ECreationTime, ///< 13
1.197 +
1.198 + EDisableFATDirCache, ///<14
1.199 + EDumpFATDirCache, ///<15
1.200 + EFATDirCacheInfo, ///<16
1.201 +
1.202 + EExtCustom=KMaxTInt/2
1.203 + };
1.204 +
1.205 +
1.206 +const TUid KSID_Test1={0x10210EB3}; ///< SID of the test that will define and set test property to control volume mounting
1.207 +
1.208 +//-- bit flags passed by test property value. Used to control some volume mounting features.
1.209 +const TUint32 KMntDisable_FsInfo = 0x00000001; //-- mask for disabling/enabling FSInfo information
1.210 +const TUint32 KMntDisable_FatBkGndScan = 0x00000002; //-- mask for disabling/enabling FAT background scanner
1.211 +
1.212 +#endif //#if defined(_DEBUG)
1.213 +
1.214 +
1.215 +
1.216 +
1.217 +#endif //COMMON_CONSTANTS_H
1.218 +
1.219 +
1.220 +
1.221 +
1.222 +
1.223 +
1.224 +
1.225 +
1.226 +
1.227 +
1.228 +
1.229 +
1.230 +
1.231 +
1.232 +
1.233 +
1.234 +
1.235 +