imgtools/imglib/filesystem/include/constants.h
changeset 0 044383f39525
equal deleted inserted replaced
-1:000000000000 0:044383f39525
       
     1 /*
       
     2 * Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
       
     3 * All rights reserved.
       
     4 * This component and the accompanying materials are made available
       
     5 * under the terms of the License "Eclipse Public License v1.0"
       
     6 * which accompanies this distribution, and is available
       
     7 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
       
     8 *
       
     9 * Initial Contributors:
       
    10 * Nokia Corporation - initial contribution.
       
    11 *
       
    12 * Contributors:
       
    13 *
       
    14 * Description: 
       
    15 * Constants used by FileSystem component
       
    16 * @internalComponent
       
    17 * @released
       
    18 * This file contains common constants used by FileSystem component
       
    19 *
       
    20 */
       
    21 
       
    22 
       
    23 #ifndef CONSTANTS_H
       
    24 #define CONSTANTS_H
       
    25 
       
    26 /*
       
    27  * mingw.inl is included to avoid the below mentioned error throwned by mingw compiler.
       
    28  * "stl_construct.h: error: no matching function for call to `operator new(unsigned int, void*)'"
       
    29  */
       
    30 #include "mingw.inl"
       
    31 #include "utils.h"
       
    32 
       
    33 //This constant is used to track the FileSystem component version information.
       
    34 const int KFileSystemMajorVersion = 1;
       
    35 const int KFileSystemMinorVersion = 1;
       
    36 
       
    37 #define KDefaultVolumeLabel "NO NAME    "
       
    38 #define KDefaultOEMName "SYMBIAN "
       
    39 
       
    40 const int KSectorsPerBootSector = 1;
       
    41 
       
    42 /* Total number of reserved clusters which is always two as cluster 0 and 1 
       
    43  * are never used by data segment for file or directory writing
       
    44  */
       
    45 const int KReservedClusters = 2;
       
    46 
       
    47 //Offset just after the end of boot sector w.r.t to the start of a FAT Volume
       
    48 const int KBootSectorOffset = 512;
       
    49 
       
    50 //size of the first reserved field in FSInfo data structure
       
    51 const int KFSIFutureExpansion=480;
       
    52 
       
    53 //size of the second reserved field in FSInfo data structure
       
    54 const int KFSIKFSIFutureExpansion2=12;
       
    55 
       
    56 //size of reserved field in FAT32 media
       
    57 const int KMaxSizeFutureExpansion=12;
       
    58 
       
    59 //size of volume label in boot sector 
       
    60 const int KMaxVolumeLabel=11;
       
    61 const int KBPBMedia =0xF8;
       
    62 const unsigned short  KDefaultBytesPerSector=512;
       
    63 
       
    64 // default sector per clusters for FAT16 image
       
    65 const unsigned char KDefaultSectorsPerCluster=2;
       
    66 
       
    67 // default sector per clusters for FAT32 image
       
    68 const unsigned char KDefaultSectorsPerCluster32=1;
       
    69 
       
    70 //default number of FAT tables
       
    71 const unsigned char KDefaultNumFats =2;
       
    72 
       
    73 // default number of root directories entries for FAT32 image
       
    74 const unsigned short KDefaultRootDirEntries=512;
       
    75 
       
    76 const unsigned short KFat32RootDirEntries=0;
       
    77 const unsigned int KSizeOfFatBootSector=512;
       
    78 const unsigned char  KDefaultReservedByte=0x00;
       
    79 
       
    80 //size of the string defining the FileSystem type
       
    81 const unsigned int KFileSysTypeLength=8;
       
    82 const unsigned int KBootSectorSignature=0xAA55;
       
    83 const unsigned int KDefaultRootDirClusterNumber=0x0002;
       
    84 const unsigned char KDefaultDriveNumber=0x80;
       
    85 
       
    86 //Default extended boot signature to be specified in boot sector
       
    87 const unsigned char KDefaultBootSignature=0x29;
       
    88 const unsigned short KDefaultVersion=0;	
       
    89 const unsigned int KDefaultHiddenSectors= 0;
       
    90 const unsigned short KDefaultSectorsPerTrack=0;
       
    91 const unsigned short KDefaultNumHeads=0;
       
    92 
       
    93 //default value of flags to be specified in FAT32 boot sector
       
    94 const unsigned short KDefaultExtFlags=0;
       
    95 
       
    96 //sector number containing the FSInfo data structure in FAT32 volume
       
    97 const unsigned short KDefaultFSInfoSector=1;
       
    98 
       
    99 //sector number to be occupied by backup boot sector in FAT32 volume
       
   100 const unsigned short KDefaultBkUpBootSec=6;
       
   101 const unsigned short KDefaultFat32ReservedSectors=32;
       
   102 const unsigned short KDefaultFat16ReservedSectors=1;
       
   103 
       
   104 //constant used in FAT table entries
       
   105 const unsigned short EOF16 = 0xffff;
       
   106 const unsigned short KFat16FirstEntry = 0xfff8;
       
   107 const unsigned int EOF32 = 0x0fffffff;
       
   108 const unsigned int KFat32FirstEntry =0x0ffffff8;
       
   109 const unsigned short KEmptyFATCluster=0;
       
   110 
       
   111 //minimum and maximum number of FAT32 cluster
       
   112 const unsigned int KMinimumFat32Clusters= 65525;
       
   113 /* Since Sector size as taken as 512 bytes(Mostly followed), total clusters supported 
       
   114  * by FAT32 is limited to 67092480 otherwise it is 268435456. Here 67092480 clusters 
       
   115  * will cover up to 2047.9999GB of user input partition size.
       
   116  */
       
   117 const unsigned int KMaximumFat32Clusters= 67092480; 
       
   118 
       
   119 
       
   120 //minimum and maximum number of FAT16 cluster
       
   121 const unsigned int KMinimumFat16Clusters= 4085;
       
   122 const unsigned int KMaximumFat16Clusters=65524;
       
   123 
       
   124 //Partition range constants
       
   125 const Long64 K16MB = 0x1000000;
       
   126 const Long64 K64MB = 0x4000000;
       
   127 const Long64 K128MB =0x8000000;
       
   128 const Long64 K256MB =0x10000000;
       
   129 const Long64 K260MB =0x10400000;
       
   130 const Long64 K512MB =0x20000000;
       
   131 const Long64 K1GB =0x40000000;
       
   132 const Long64 K2GB =0x80000000;
       
   133 #ifdef _MSC_VER
       
   134 	const Long64 K8GB =0x200000000;
       
   135 	const Long64 K16GB =0x400000000;
       
   136 	const Long64 K32GB =0x800000000;
       
   137 #else
       
   138 	const Long64 K8GB =0x200000000LL;
       
   139 	const Long64 K16GB =0x400000000LL;
       
   140 	const Long64 K32GB =0x800000000LL;
       
   141 #endif
       
   142 
       
   143 //Bytes per sector selection constants
       
   144 const short int K1SectorsPerCluster = 0x01;
       
   145 const short int K2SectorsPerCluster = 0x02;
       
   146 const short int K4SectorsPerCluster = 0x04;
       
   147 const short int K8SectorsPerCluster = 0x08;
       
   148 const short int K16SectorsPerCluster = 0x10;
       
   149 const short int K32SectorsPerCluster = 0x20;
       
   150 const short int K64SectorsPerCluster = 0x40;
       
   151 
       
   152 const int KParentDirClusterNumber = 0x0;
       
   153 const int KCurrentDirClusterNumber = 0x01;
       
   154 const short int KFat32RootEntryNumber = 0x02;
       
   155 const short int KFat16RootEntryNumber = 0x01;
       
   156 const short int KRootClusterNumber = 0x02;
       
   157 
       
   158 const short int KDirectoryEntrySize = 0x20;
       
   159 const short int KZeroFileSize = 0x00;
       
   160 const short int KEntryNameSize = 0x3c;
       
   161 const short int KFilePathMaxSize = 0xFF;
       
   162 const short int KWriteOnce = 0x01;
       
   163  
       
   164 const long int KHighWordMask = 0x0000FFFF;
       
   165 const short int KBitShift16 = 0x10;
       
   166 const short int KNTReserverdByte = 0x00;
       
   167 
       
   168 const short int KPaddingCharCnt = 0x02;
       
   169 
       
   170 const char KSpace = 0x20;
       
   171 const char KDot = 0x2E;
       
   172 const char KTilde = 0x7E;
       
   173 const char KTildeNumber = 0x31;
       
   174 const char KCreateTimeInMsecs = 0x00;
       
   175 
       
   176 const unsigned char KLongNamePaddingChar = 0xFF;
       
   177 const char KNullPaddingChar = 0x00;
       
   178 
       
   179 const char KDirSubComponent = 0x00;//Dir sub component constant
       
   180 const char KLongNameCharSeperator = 0x00;//Long sub component Name characters separated by 0x00
       
   181 
       
   182 
       
   183 #endif //CONSTANTS_H