os/kernelhwsrv/userlibandfileserver/fileserver/estart/estart.h
author sl
Tue, 10 Jun 2014 14:32:02 +0200
changeset 1 260cb5ec6c19
permissions -rw-r--r--
Update contrib.
sl@0
     1
// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies).
sl@0
     2
// All rights reserved.
sl@0
     3
// This component and the accompanying materials are made available
sl@0
     4
// under the terms of the License "Eclipse Public License v1.0"
sl@0
     5
// which accompanies this distribution, and is available
sl@0
     6
// at the URL "http://www.eclipse.org/legal/epl-v10.html".
sl@0
     7
//
sl@0
     8
// Initial Contributors:
sl@0
     9
// Nokia Corporation - initial contribution.
sl@0
    10
//
sl@0
    11
// Contributors:
sl@0
    12
//
sl@0
    13
// Description:
sl@0
    14
// f32\estart\estart.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
/**
sl@0
    19
 @file
sl@0
    20
 @internalComponent
sl@0
    21
*/
sl@0
    22
sl@0
    23
#ifndef __ESTART_H__
sl@0
    24
#define __ESTART_H__
sl@0
    25
sl@0
    26
#include <f32file.h>
sl@0
    27
#include <d32locd.h>
sl@0
    28
sl@0
    29
GLREF_D TBool gMountRofsAlone;
sl@0
    30
GLREF_D TBool gMountComposite;
sl@0
    31
sl@0
    32
//#define AUTO_PROFILE
sl@0
    33
//#define LOAD_PATCH_LDD
sl@0
    34
sl@0
    35
#ifdef _DEBUG
sl@0
    36
extern TBool DebugTraceEnabled();
sl@0
    37
#define ____IF_DEBUG(s)			if (DebugTraceEnabled()) {s;}
sl@0
    38
#else
sl@0
    39
#define ____IF_DEBUG(s)
sl@0
    40
#endif
sl@0
    41
sl@0
    42
#define	DEBUGPRINT(s)			____IF_DEBUG(RDebug::Print(_L(s)))
sl@0
    43
#define	DEBUGPRINT1(s,a)		____IF_DEBUG(RDebug::Print(_L(s),(a)))
sl@0
    44
#define	DEBUGPRINT2(s,a,b)		____IF_DEBUG(RDebug::Print(_L(s),(a),(b)))
sl@0
    45
#define	DEBUGPRINT3(s,a,b,c)	____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c)))
sl@0
    46
#define	DEBUGPRINT4(s,a,b,c,d)	____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d)))
sl@0
    47
#define	DEBUGPRINT5(s,a,b,c,d,e)	____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e)))
sl@0
    48
#define	DEBUGPRINT6(s,a,b,c,d,e,f)	____IF_DEBUG(RDebug::Print(_L(s),(a),(b),(c),(d),(e),(f)))
sl@0
    49
#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
    50
sl@0
    51
const TInt KMaxLineLen=256;
sl@0
    52
sl@0
    53
#define FS_FORMAT_ALWAYS		0x001	// Format the drive once mounted
sl@0
    54
#define FS_FORMAT_COLD			0x002	// Format the drive on a cold boot
sl@0
    55
#define FS_FORMAT_CORRUPT 		0x004  	// Format only if corrupt
sl@0
    56
#define	FS_DISMNT_CORRUPT		0x008	// Dismount if corrupt
sl@0
    57
#define FS_SWAP_CORRUPT			0x010	// Swap drive mappings with another (specified) drive if corrupt
sl@0
    58
#define FS_SYNC_DRIVE			0x020	// Mount as a synchronous drive 
sl@0
    59
#define FS_SCANDRIVE			0x040	// Run scandrive once mounted (if rugged file system enabled)
sl@0
    60
#define FS_COMPOSITE			0x080	// Mount the composite FSY on this drive
sl@0
    61
#define FS_NO_MOUNT				0x100	// Add the FSY, map the drive but don't actually mount the drive
sl@0
    62
#define FS_ALLOW_REM_ACC  		0x200	// Allow this drive to be accessed directly via a remote host
sl@0
    63
#define FS_NOT_RUGGED  			0x400	// The FAT mount is not rugged
sl@0
    64
#define FS_SYSTEM_DRIVE			0x800	// The drive is System Drive
sl@0
    65
sl@0
    66
const TInt KFsDetectMappingChangeReturnOffset=0x10;
sl@0
    67
typedef TInt (*TFsDetect)(RLocalDrive, TInt, TLocalDriveCapsV2&);
sl@0
    68
struct SFsMountInfo
sl@0
    69
	{
sl@0
    70
	const TText* iFsyName;		// Filename of .FSY without extension
sl@0
    71
	const TText* iObjName;		// Object name of file system (NULL = same as iFsyName)
sl@0
    72
	const TText* iExtName;     	// Name of primary extension if applicable
sl@0
    73
	TUint32 iFlags;				// Mount options
sl@0
    74
	};
sl@0
    75
sl@0
    76
struct SFileSystemInfo
sl@0
    77
	{
sl@0
    78
	TFsDetect iDetect;			// Detection function
sl@0
    79
	SFsMountInfo iFsInfo;
sl@0
    80
	};
sl@0
    81
sl@0
    82
struct SLocalDriveMappingInfo
sl@0
    83
	{
sl@0
    84
	TInt iDriveNumber;
sl@0
    85
	TInt iLocalDriveNumber;
sl@0
    86
	SFsMountInfo iFsInfo;
sl@0
    87
	TInt iSpare;
sl@0
    88
	TInt iCapsRetCode;
sl@0
    89
	TBool iRemovable;
sl@0
    90
	};
sl@0
    91
	
sl@0
    92
class TText8FileReader
sl@0
    93
	{
sl@0
    94
public:
sl@0
    95
	TText8FileReader();
sl@0
    96
	~TText8FileReader();
sl@0
    97
	TInt Set(RFile& aFile);
sl@0
    98
	TInt Read(TPtr& aPtr);	
sl@0
    99
public:
sl@0
   100
	RFile iFile;
sl@0
   101
	TBuf8<KMaxLineLen> iBuf;
sl@0
   102
	TInt iBufPos;
sl@0
   103
	TText* iFileDataBuf;
sl@0
   104
	TInt iFileSize;	
sl@0
   105
	};	
sl@0
   106
sl@0
   107
sl@0
   108
/**
sl@0
   109
A class that implements the behaviour provided by ESTART.
sl@0
   110
sl@0
   111
The class defines a number of virtual functions, which may be overridden
sl@0
   112
by a customised versions of ESTART.  
sl@0
   113
*/
sl@0
   114
class TFSStartup
sl@0
   115
	{
sl@0
   116
public:	
sl@0
   117
	TFSStartup();
sl@0
   118
	virtual void Init();
sl@0
   119
	virtual TInt Run();
sl@0
   120
	virtual TInt LocalDriveInit();
sl@0
   121
	virtual TInt InitialiseHAL();
sl@0
   122
	virtual TInt LoadLocale();
sl@0
   123
	virtual TInt StartSystem();
sl@0
   124
	virtual TInt ParseCustomMountFlags(TPtrC* aFlagPtr,TUint32& aFlags,TInt& aSpare);
sl@0
   125
	virtual TInt HandleCustomMountFlags(TInt& aMountRet,TInt& aFlags,TInt& aSpare,TInt aDrive);
sl@0
   126
	virtual TInt DefaultLocalDrive(TInt aLocalDrive);
sl@0
   127
	virtual TPtrC LocalDriveMappingFileName();
sl@0
   128
    virtual void ShowFormatProgress(TInt aPercent, TInt aDrive);
sl@0
   129
	virtual void Close();
sl@0
   130
protected:
sl@0
   131
	virtual TInt GetStartupMode();
sl@0
   132
    virtual TInt GetStartupModeFromFile();
sl@0
   133
	virtual TInt SysFileNames(RArray<TPtrC>& aFileNames);
sl@0
   134
public:
sl@0
   135
	TInt ProcessLocalDriveMappingFile();
sl@0
   136
	TInt ParseMappingFileFlags(const TPtrC& aFlagDesc,TUint32& aFlagVar,TInt& aSpare);
sl@0
   137
	TInt ParseMappingRecord(TPtr& aTextLine,SLocalDriveMappingInfo& anInfo);
sl@0
   138
	void CheckAndReOrderArrayForSwapping(TInt aTotalEntries);
sl@0
   139
	void SwapDriveMappings(TInt aCurrentEntry,TInt aTotalEntries);
sl@0
   140
	TInt MountFileSystem(SLocalDriveMappingInfo& anInfo);
sl@0
   141
	void SetFServLocalDriveMapping();
sl@0
   142
	void SwapFServLocalDriveMapping(TInt aFirstDrive,TInt aSecondDrive);
sl@0
   143
	TInt InitCompositeFileSystem();
sl@0
   144
	void LoadCompositeFileSystem(TInt aDrive);
sl@0
   145
	void LoadCompositeFileSystem(SLocalDriveMappingInfo& anInfo);
sl@0
   146
	TBool CreateServer(const TDriveList& aDrives, const TDesC& aRootName);
sl@0
   147
	TInt FormatDrive(TInt aDrive);
sl@0
   148
    TInt MountRemovableDrives();
sl@0
   149
    TInt ParseMappingFileLocalDrive(const TPtrC& aDriveDesc,TUint32 (&aDrives)[KMaxLocalDrives],TInt& aCount);
sl@0
   150
	void LocalFSInitialisation();
sl@0
   151
	TInt SearchForUnusedDriveNumber(TInt& aDrvNum);
sl@0
   152
#if !defined(AUTODETECT_DISABLE)
sl@0
   153
	virtual TInt GetNextStandardFSInfoEntry(const SFileSystemInfo** anEntry,TInt aPos);
sl@0
   154
	TInt DetectFileSystem(TInt aLocalDriveNumber,SLocalDriveMappingInfo& anInfo);
sl@0
   155
	TInt DetectAndMountFileSystems();
sl@0
   156
#endif		
sl@0
   157
#if defined(_LOCKABLE_MEDIA)
sl@0
   158
	TInt WriteLocalPwStore(RFile& aFile);
sl@0
   159
	TInt InitializeLocalPwStore();	
sl@0
   160
#endif
sl@0
   161
#ifdef LOAD_PATCH_LDD	
sl@0
   162
	void LoadPatchLDDs();
sl@0
   163
#endif	
sl@0
   164
#ifdef AUTO_PROFILE
sl@0
   165
	void StartProfiler();
sl@0
   166
#endif
sl@0
   167
private:
sl@0
   168
	void SetSystemDrive();
sl@0
   169
public:
sl@0
   170
    TInt iStartupMode;                                              
sl@0
   171
	TInt iMuid;                                                     
sl@0
   172
	RFs iFs;                                                        
sl@0
   173
	TInt iTotalSupportedDrives;                                     
sl@0
   174
	TInt iRuggedFileSystem;                                         
sl@0
   175
	TUint iRegisteredDriveBitmask;                                  
sl@0
   176
	TInt iLocalDriveList[KMaxLocalDrives];                          
sl@0
   177
	SLocalDriveMappingInfo iDriveMappingInfo[KMaxLocalDrives];		
sl@0
   178
	TInt iDriveSwapCount;                                           
sl@0
   179
	TBool iColdStart;                                               
sl@0
   180
	TUint iUnmountedDriveBitmask;                                   
sl@0
   181
    TInt iMapCount;                                                 
sl@0
   182
    TText8FileReader* iMapFile;                                     
sl@0
   183
	};
sl@0
   184
sl@0
   185
TInt StartSysAgt2(); // launch system agent 2 server
sl@0
   186
sl@0
   187
sl@0
   188
#if !defined(AUTODETECT_DISABLE)	
sl@0
   189
GLREF_C TInt DetectELocal(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   190
GLREF_C TInt DetectIRam(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   191
GLREF_C TInt DetectRofs(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   192
GLREF_C TInt DetectComposite(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   193
GLREF_C TInt DetectEneaLFFS(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   194
GLREF_C TInt DetectIso9660(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   195
GLREF_C TInt DetectNtfs(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   196
GLREF_C TInt DetectFtl(RLocalDrive ld, TInt cr, TLocalDriveCapsV2& caps);
sl@0
   197
#endif
sl@0
   198
sl@0
   199
#endif