sl@0: // Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). sl@0: // All rights reserved. sl@0: // This component and the accompanying materials are made available sl@0: // under the terms of the License "Eclipse Public License v1.0" sl@0: // which accompanies this distribution, and is available sl@0: // at the URL "http://www.eclipse.org/legal/epl-v10.html". sl@0: // sl@0: // Initial Contributors: sl@0: // Nokia Corporation - initial contribution. sl@0: // sl@0: // Contributors: sl@0: // sl@0: // Description: sl@0: // f32\estart\estart.h sl@0: // sl@0: // sl@0: sl@0: /** sl@0: @file sl@0: @internalComponent sl@0: */ sl@0: sl@0: #ifndef __ESTART_H__ sl@0: #define __ESTART_H__ sl@0: sl@0: #include sl@0: #include sl@0: sl@0: GLREF_D TBool gMountRofsAlone; sl@0: GLREF_D TBool gMountComposite; sl@0: sl@0: //#define AUTO_PROFILE sl@0: //#define LOAD_PATCH_LDD sl@0: sl@0: #ifdef _DEBUG sl@0: extern TBool DebugTraceEnabled(); sl@0: #define ____IF_DEBUG(s) if (DebugTraceEnabled()) {s;} sl@0: #else sl@0: #define ____IF_DEBUG(s) sl@0: #endif sl@0: sl@0: #define DEBUGPRINT(s) ____IF_DEBUG(RDebug::Print(_L(s))) sl@0: #define DEBUGPRINT1(s,a) ____IF_DEBUG(RDebug::Print(_L(s),(a))) sl@0: #define DEBUGPRINT2(s,a,b) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b))) sl@0: #define DEBUGPRINT3(s,a,b,c) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c))) sl@0: #define DEBUGPRINT4(s,a,b,c,d) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d))) sl@0: #define DEBUGPRINT5(s,a,b,c,d,e) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e))) sl@0: #define DEBUGPRINT6(s,a,b,c,d,e,f) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e),(f))) sl@0: #define DEBUGPRINT7(s,a,b,c,d,e,f,g) ____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e),(f),(g))) sl@0: sl@0: const TInt KMaxLineLen=256; sl@0: sl@0: #define FS_FORMAT_ALWAYS 0x001 // Format the drive once mounted sl@0: #define FS_FORMAT_COLD 0x002 // Format the drive on a cold boot sl@0: #define FS_FORMAT_CORRUPT 0x004 // Format only if corrupt sl@0: #define FS_DISMNT_CORRUPT 0x008 // Dismount if corrupt sl@0: #define FS_SWAP_CORRUPT 0x010 // Swap drive mappings with another (specified) drive if corrupt sl@0: #define FS_SYNC_DRIVE 0x020 // Mount as a synchronous drive sl@0: #define FS_SCANDRIVE 0x040 // Run scandrive once mounted (if rugged file system enabled) sl@0: #define FS_COMPOSITE 0x080 // Mount the composite FSY on this drive sl@0: #define FS_NO_MOUNT 0x100 // Add the FSY, map the drive but don't actually mount the drive sl@0: #define FS_ALLOW_REM_ACC 0x200 // Allow this drive to be accessed directly via a remote host sl@0: #define FS_NOT_RUGGED 0x400 // The FAT mount is not rugged sl@0: #define FS_SYSTEM_DRIVE 0x800 // The drive is System Drive sl@0: sl@0: const TInt KFsDetectMappingChangeReturnOffset=0x10; sl@0: typedef TInt (*TFsDetect)(RLocalDrive, TInt, TLocalDriveCapsV2&); sl@0: struct SFsMountInfo sl@0: { sl@0: const TText* iFsyName; // Filename of .FSY without extension sl@0: const TText* iObjName; // Object name of file system (NULL = same as iFsyName) sl@0: const TText* iExtName; // Name of primary extension if applicable sl@0: TUint32 iFlags; // Mount options sl@0: }; sl@0: sl@0: struct SFileSystemInfo sl@0: { sl@0: TFsDetect iDetect; // Detection function sl@0: SFsMountInfo iFsInfo; sl@0: }; sl@0: sl@0: struct SLocalDriveMappingInfo sl@0: { sl@0: TInt iDriveNumber; sl@0: TInt iLocalDriveNumber; sl@0: SFsMountInfo iFsInfo; sl@0: TInt iSpare; sl@0: TInt iCapsRetCode; sl@0: TBool iRemovable; sl@0: }; sl@0: sl@0: class TText8FileReader sl@0: { sl@0: public: sl@0: TText8FileReader(); sl@0: ~TText8FileReader(); sl@0: TInt Set(RFile& aFile); sl@0: TInt Read(TPtr& aPtr); sl@0: public: sl@0: RFile iFile; sl@0: TBuf8 iBuf; sl@0: TInt iBufPos; sl@0: TText* iFileDataBuf; sl@0: TInt iFileSize; sl@0: }; sl@0: sl@0: sl@0: /** sl@0: A class that implements the behaviour provided by ESTART. sl@0: sl@0: The class defines a number of virtual functions, which may be overridden sl@0: by a customised versions of ESTART. sl@0: */ sl@0: class TFSStartup sl@0: { sl@0: public: sl@0: TFSStartup(); sl@0: virtual void Init(); sl@0: virtual TInt Run(); sl@0: virtual TInt LocalDriveInit(); sl@0: virtual TInt InitialiseHAL(); sl@0: virtual TInt LoadLocale(); sl@0: virtual TInt StartSystem(); sl@0: virtual TInt ParseCustomMountFlags(TPtrC* aFlagPtr,TUint32& aFlags,TInt& aSpare); sl@0: virtual TInt HandleCustomMountFlags(TInt& aMountRet,TInt& aFlags,TInt& aSpare,TInt aDrive); sl@0: virtual TInt DefaultLocalDrive(TInt aLocalDrive); sl@0: virtual TPtrC LocalDriveMappingFileName(); sl@0: virtual void ShowFormatProgress(TInt aPercent, TInt aDrive); sl@0: virtual void Close(); sl@0: protected: sl@0: virtual TInt GetStartupMode(); sl@0: virtual TInt GetStartupModeFromFile(); sl@0: virtual TInt SysFileNames(RArray& aFileNames); sl@0: public: sl@0: TInt ProcessLocalDriveMappingFile(); sl@0: TInt ParseMappingFileFlags(const TPtrC& aFlagDesc,TUint32& aFlagVar,TInt& aSpare); sl@0: TInt ParseMappingRecord(TPtr& aTextLine,SLocalDriveMappingInfo& anInfo); sl@0: void CheckAndReOrderArrayForSwapping(TInt aTotalEntries); sl@0: void SwapDriveMappings(TInt aCurrentEntry,TInt aTotalEntries); sl@0: TInt MountFileSystem(SLocalDriveMappingInfo& anInfo); sl@0: void SetFServLocalDriveMapping(); sl@0: void SwapFServLocalDriveMapping(TInt aFirstDrive,TInt aSecondDrive); sl@0: TInt InitCompositeFileSystem(); sl@0: void LoadCompositeFileSystem(TInt aDrive); sl@0: void LoadCompositeFileSystem(SLocalDriveMappingInfo& anInfo); sl@0: TBool CreateServer(const TDriveList& aDrives, const TDesC& aRootName); sl@0: TInt FormatDrive(TInt aDrive); sl@0: TInt MountRemovableDrives(); sl@0: TInt ParseMappingFileLocalDrive(const TPtrC& aDriveDesc,TUint32 (&aDrives)[KMaxLocalDrives],TInt& aCount); sl@0: void LocalFSInitialisation(); sl@0: TInt SearchForUnusedDriveNumber(TInt& aDrvNum); sl@0: #if !defined(AUTODETECT_DISABLE) sl@0: virtual TInt GetNextStandardFSInfoEntry(const SFileSystemInfo** anEntry,TInt aPos); sl@0: TInt DetectFileSystem(TInt aLocalDriveNumber,SLocalDriveMappingInfo& anInfo); sl@0: TInt DetectAndMountFileSystems(); sl@0: #endif sl@0: #if defined(_LOCKABLE_MEDIA) sl@0: TInt WriteLocalPwStore(RFile& aFile); sl@0: TInt InitializeLocalPwStore(); sl@0: #endif sl@0: #ifdef LOAD_PATCH_LDD sl@0: void LoadPatchLDDs(); sl@0: #endif sl@0: #ifdef AUTO_PROFILE sl@0: void StartProfiler(); sl@0: #endif sl@0: private: sl@0: void SetSystemDrive(); sl@0: public: sl@0: TInt iStartupMode; sl@0: TInt iMuid; sl@0: RFs iFs; sl@0: TInt iTotalSupportedDrives; sl@0: TInt iRuggedFileSystem; sl@0: TUint iRegisteredDriveBitmask; sl@0: TInt iLocalDriveList[KMaxLocalDrives]; sl@0: SLocalDriveMappingInfo iDriveMappingInfo[KMaxLocalDrives]; sl@0: TInt iDriveSwapCount; sl@0: TBool iColdStart; sl@0: TUint iUnmountedDriveBitmask; sl@0: TInt iMapCount; sl@0: TText8FileReader* iMapFile; sl@0: }; sl@0: sl@0: TInt StartSysAgt2(); // launch system agent 2 server sl@0: sl@0: sl@0: #if !defined(AUTODETECT_DISABLE) sl@0: GLREF_C TInt DetectELocal(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: GLREF_C TInt DetectIRam(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: GLREF_C TInt DetectRofs(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: GLREF_C TInt DetectComposite(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: GLREF_C TInt DetectEneaLFFS(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: GLREF_C TInt DetectIso9660(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: GLREF_C TInt DetectNtfs(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: GLREF_C TInt DetectFtl(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps); sl@0: #endif sl@0: sl@0: #endif