Update contrib.
1 // Copyright (c) 2004-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\estart\estart.h
29 GLREF_D TBool gMountRofsAlone;
30 GLREF_D TBool gMountComposite;
32 //#define AUTO_PROFILE
33 //#define LOAD_PATCH_LDD
36 extern TBool DebugTraceEnabled();
37 #define ____IF_DEBUG(s) if (DebugTraceEnabled()) {s;}
39 #define ____IF_DEBUG(s)
42 #define DEBUGPRINT(s) ____IF_DEBUG(RDebug::Print(_L(s)))
43 #define DEBUGPRINT1(s,a) ____IF_DEBUG(RDebug::Print(_L(s),(a)))
44 #define DEBUGPRINT2(s,a,b) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b)))
45 #define DEBUGPRINT3(s,a,b,c) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c)))
46 #define DEBUGPRINT4(s,a,b,c,d) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d)))
47 #define DEBUGPRINT5(s,a,b,c,d,e) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e)))
48 #define DEBUGPRINT6(s,a,b,c,d,e,f) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e),(f)))
49 #define DEBUGPRINT7(s,a,b,c,d,e,f,g) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e),(f),(g)))
51 const TInt KMaxLineLen=256;
53 #define FS_FORMAT_ALWAYS 0x001 // Format the drive once mounted
54 #define FS_FORMAT_COLD 0x002 // Format the drive on a cold boot
55 #define FS_FORMAT_CORRUPT 0x004 // Format only if corrupt
56 #define FS_DISMNT_CORRUPT 0x008 // Dismount if corrupt
57 #define FS_SWAP_CORRUPT 0x010 // Swap drive mappings with another (specified) drive if corrupt
58 #define FS_SYNC_DRIVE 0x020 // Mount as a synchronous drive
59 #define FS_SCANDRIVE 0x040 // Run scandrive once mounted (if rugged file system enabled)
60 #define FS_COMPOSITE 0x080 // Mount the composite FSY on this drive
61 #define FS_NO_MOUNT 0x100 // Add the FSY, map the drive but don't actually mount the drive
62 #define FS_ALLOW_REM_ACC 0x200 // Allow this drive to be accessed directly via a remote host
63 #define FS_NOT_RUGGED 0x400 // The FAT mount is not rugged
64 #define FS_SYSTEM_DRIVE 0x800 // The drive is System Drive
66 const TInt KFsDetectMappingChangeReturnOffset=0x10;
67 typedef TInt (*TFsDetect)(RLocalDrive, TInt, TLocalDriveCapsV2&);
70 const TText* iFsyName; // Filename of .FSY without extension
71 const TText* iObjName; // Object name of file system (NULL = same as iFsyName)
72 const TText* iExtName; // Name of primary extension if applicable
73 TUint32 iFlags; // Mount options
76 struct SFileSystemInfo
78 TFsDetect iDetect; // Detection function
82 struct SLocalDriveMappingInfo
85 TInt iLocalDriveNumber;
92 class TText8FileReader
97 TInt Set(RFile& aFile);
98 TInt Read(TPtr& aPtr);
101 TBuf8<KMaxLineLen> iBuf;
109 A class that implements the behaviour provided by ESTART.
111 The class defines a number of virtual functions, which may be overridden
112 by a customised versions of ESTART.
120 virtual TInt LocalDriveInit();
121 virtual TInt InitialiseHAL();
122 virtual TInt LoadLocale();
123 virtual TInt StartSystem();
124 virtual TInt ParseCustomMountFlags(TPtrC* aFlagPtr,TUint32& aFlags,TInt& aSpare);
125 virtual TInt HandleCustomMountFlags(TInt& aMountRet,TInt& aFlags,TInt& aSpare,TInt aDrive);
126 virtual TInt DefaultLocalDrive(TInt aLocalDrive);
127 virtual TPtrC LocalDriveMappingFileName();
128 virtual void ShowFormatProgress(TInt aPercent, TInt aDrive);
129 virtual void Close();
131 virtual TInt GetStartupMode();
132 virtual TInt GetStartupModeFromFile();
133 virtual TInt SysFileNames(RArray<TPtrC>& aFileNames);
135 TInt ProcessLocalDriveMappingFile();
136 TInt ParseMappingFileFlags(const TPtrC& aFlagDesc,TUint32& aFlagVar,TInt& aSpare);
137 TInt ParseMappingRecord(TPtr& aTextLine,SLocalDriveMappingInfo& anInfo);
138 void CheckAndReOrderArrayForSwapping(TInt aTotalEntries);
139 void SwapDriveMappings(TInt aCurrentEntry,TInt aTotalEntries);
140 TInt MountFileSystem(SLocalDriveMappingInfo& anInfo);
141 void SetFServLocalDriveMapping();
142 void SwapFServLocalDriveMapping(TInt aFirstDrive,TInt aSecondDrive);
143 TInt InitCompositeFileSystem();
144 void LoadCompositeFileSystem(TInt aDrive);
145 void LoadCompositeFileSystem(SLocalDriveMappingInfo& anInfo);
146 TBool CreateServer(const TDriveList& aDrives, const TDesC& aRootName);
147 TInt FormatDrive(TInt aDrive);
148 TInt MountRemovableDrives();
149 TInt ParseMappingFileLocalDrive(const TPtrC& aDriveDesc,TUint32 (&aDrives)[KMaxLocalDrives],TInt& aCount);
150 void LocalFSInitialisation();
151 TInt SearchForUnusedDriveNumber(TInt& aDrvNum);
152 #if !defined(AUTODETECT_DISABLE)
153 virtual TInt GetNextStandardFSInfoEntry(const SFileSystemInfo** anEntry,TInt aPos);
154 TInt DetectFileSystem(TInt aLocalDriveNumber,SLocalDriveMappingInfo& anInfo);
155 TInt DetectAndMountFileSystems();
157 #if defined(_LOCKABLE_MEDIA)
158 TInt WriteLocalPwStore(RFile& aFile);
159 TInt InitializeLocalPwStore();
161 #ifdef LOAD_PATCH_LDD
162 void LoadPatchLDDs();
165 void StartProfiler();
168 void SetSystemDrive();
173 TInt iTotalSupportedDrives;
174 TInt iRuggedFileSystem;
175 TUint iRegisteredDriveBitmask;
176 TInt iLocalDriveList[KMaxLocalDrives];
177 SLocalDriveMappingInfo iDriveMappingInfo[KMaxLocalDrives];
178 TInt iDriveSwapCount;
180 TUint iUnmountedDriveBitmask;
182 TText8FileReader* iMapFile;
185 TInt StartSysAgt2(); // launch system agent 2 server
188 #if !defined(AUTODETECT_DISABLE)
189 GLREF_C TInt DetectELocal(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
190 GLREF_C TInt DetectIRam(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
191 GLREF_C TInt DetectRofs(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
192 GLREF_C TInt DetectComposite(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
193 GLREF_C TInt DetectEneaLFFS(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
194 GLREF_C TInt DetectIso9660(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
195 GLREF_C TInt DetectNtfs(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
196 GLREF_C TInt DetectFtl(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);