os/kernelhwsrv/userlibandfileserver/fileserver/srom/sr_std.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) 1995-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\srom\sr_std.h
sl@0
    15
// 
sl@0
    16
//
sl@0
    17
sl@0
    18
#if defined(_UNICODE)
sl@0
    19
#if !defined(UNICODE)
sl@0
    20
#define UNICODE
sl@0
    21
#endif
sl@0
    22
#endif
sl@0
    23
sl@0
    24
#include "common.h"
sl@0
    25
#include <f32fsys.h>
sl@0
    26
#include <f32ver.h>
sl@0
    27
#include <e32rom.h>
sl@0
    28
#include <e32svr.h>
sl@0
    29
sl@0
    30
#if defined(__EPOC32__)
sl@0
    31
// #define __PRINT_DEBUG_INFO_SR_STD__ 1
sl@0
    32
#endif
sl@0
    33
sl@0
    34
#if defined(__PRINT_DEBUG_INFO_SR_STD__) && !defined(__LOCK_SR_STD__)
sl@0
    35
#define __LOCK_SR_STD__
sl@0
    36
#define __PRINT(t) RDebug::t;
sl@0
    37
#else
sl@0
    38
#define __PRINT(t)
sl@0
    39
#endif
sl@0
    40
sl@0
    41
//
sl@0
    42
enum TFault
sl@0
    43
	{
sl@0
    44
	ERomReMountNotSupported,
sl@0
    45
	ERomGetFileInfo,
sl@0
    46
	ERomFileTooBig,
sl@0
    47
	ERomCreateFileMapping,
sl@0
    48
	ERomCreateMappedView,
sl@0
    49
	ERomInvalidArgument,
sl@0
    50
	ERomFsCorrupt
sl@0
    51
	};
sl@0
    52
//
sl@0
    53
NONSHARABLE_CLASS(CRom) : public CFileSystem
sl@0
    54
	{
sl@0
    55
public:
sl@0
    56
	CRom();
sl@0
    57
	~CRom();
sl@0
    58
	TInt Install();
sl@0
    59
	CMountCB* NewMountL() const;
sl@0
    60
	CFileCB* NewFileL() const;
sl@0
    61
	CDirCB* NewDirL() const;
sl@0
    62
	CFormatCB* NewFormatL() const;
sl@0
    63
	void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
sl@0
    64
	const TRomHeader& RomHeader() const {return(*iRomHeaderAddress);}
sl@0
    65
	TLinAddr RootDirectory() const {return UserSvr::RomRootDirectoryAddress();}
sl@0
    66
private:
sl@0
    67
	static const TRomHeader* iRomHeaderAddress;
sl@0
    68
	};
sl@0
    69
//
sl@0
    70
NONSHARABLE_CLASS(CRomMountCB) : public CMountCB, public CMountCB::MFileAccessor
sl@0
    71
	{
sl@0
    72
public:
sl@0
    73
	CRomMountCB(const CRom* aRom);
sl@0
    74
	void MountL(TBool aForceMount);
sl@0
    75
	TInt ReMount();
sl@0
    76
	void Dismounted();
sl@0
    77
	static TInt Compare(const TDesC& aLeft, const TDesC& aRight);
sl@0
    78
	void VolumeL(TVolumeInfo& aVolume) const;
sl@0
    79
	void SetVolumeL(TDes& aName);
sl@0
    80
	void MkDirL(const TDesC& aName);
sl@0
    81
	void RmDirL(const TDesC& aName);
sl@0
    82
	void DeleteL(const TDesC& aName);
sl@0
    83
	void RenameL(const TDesC& anOldName,const TDesC& anNewName);
sl@0
    84
	void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
sl@0
    85
	void EntryL(const TDesC& aName,TEntry& anEntry) const;
sl@0
    86
	void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aMask,TUint aVal);
sl@0
    87
	void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
sl@0
    88
	void DirOpenL(const TDesC& aName,CDirCB* aDir);
sl@0
    89
	void FindLeafDirL(const TDesC& aName,TLinAddr& aDir) const;
sl@0
    90
	void FindL(const TDesC& aName,TUint anAtt,TLinAddr aDir,TLinAddr& anEntry,TInt anError) const;
sl@0
    91
	void FindBinaryL(const TDesC& aName,TUint aAtt,TBool aAttKnown,TLinAddr aDir,TLinAddr& aEntry,TInt aError) const;
sl@0
    92
	void FindEntryL(const TDesC& aName,TUint anAtt,TBool aAttKnown,TLinAddr& aDir,TLinAddr& anEntry) const;
sl@0
    93
	const TRomHeader& RomHeader() const {return (iRom->RomHeader());}
sl@0
    94
	TLinAddr RomRootDirectory() const {return iRom->RootDirectory(); }
sl@0
    95
	void RawReadL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage) const;
sl@0
    96
	void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage);
sl@0
    97
	void ReadUidL(TLinAddr anAddr,TEntry& anEntry) const;
sl@0
    98
	void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
sl@0
    99
	void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
sl@0
   100
	void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
sl@0
   101
	void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
sl@0
   102
	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
sl@0
   103
	virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
sl@0
   104
	virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
sl@0
   105
	virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
sl@0
   106
	virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
sl@0
   107
sl@0
   108
private:
sl@0
   109
	const CRom* iRom;
sl@0
   110
	};
sl@0
   111
//
sl@0
   112
NONSHARABLE_CLASS(CRomFileCB) : public CFileCB
sl@0
   113
	{
sl@0
   114
public:
sl@0
   115
	CRomFileCB(const CRom* aRom);
sl@0
   116
	void RenameL(const TDesC& aNewName);
sl@0
   117
	void ReadL(TInt aPos,TInt& aLength,const TAny* aTrg,const RMessagePtr2& aMessage);
sl@0
   118
	void WriteL(TInt aPos,TInt& aLength,const TAny* aSrc,const RMessagePtr2& aMessage);
sl@0
   119
	void SetSizeL(TInt aSize);
sl@0
   120
	void SetEntryL(const TTime& aTime,TUint aMask,TUint aVal);
sl@0
   121
	void FlushDataL();
sl@0
   122
	void FlushAllL();
sl@0
   123
	TInt Address(TInt& aPos) const;
sl@0
   124
	const TRomHeader& RomHeader() const {return(iRom->RomHeader());}
sl@0
   125
	TLinAddr RomRootDirectory() const {return iRom->RootDirectory(); }			
sl@0
   126
	void SetBase(const TUint8* aBase) {iBase=aBase;}
sl@0
   127
private:
sl@0
   128
	const CRom* iRom;
sl@0
   129
	const TUint8* iBase;
sl@0
   130
	};
sl@0
   131
//
sl@0
   132
NONSHARABLE_CLASS(CRomDirCB) : public CDirCB
sl@0
   133
	{
sl@0
   134
public:
sl@0
   135
	CRomDirCB(const CRom* aRom);
sl@0
   136
	~CRomDirCB();
sl@0
   137
	void ReadL(TEntry& anEntry);
sl@0
   138
	const TRomHeader& RomHeader() const {return(iRom->RomHeader());}
sl@0
   139
	TLinAddr RomRootDirectory() const {return iRom->RootDirectory(); }
sl@0
   140
	void SetDir(TLinAddr aDir,TLinAddr anEntry,const TDesC& aMatch);
sl@0
   141
private:
sl@0
   142
	TBool MatchUid();
sl@0
   143
private:
sl@0
   144
	const CRom* iRom;
sl@0
   145
	TEntry iEntry;
sl@0
   146
	TLinAddr iDir;
sl@0
   147
	TLinAddr iNext;
sl@0
   148
	HBufC* iMatch;
sl@0
   149
	};
sl@0
   150
//
sl@0
   151
GLREF_C TInt InstallFileSystem(CFileSystem* aSys,RLibrary aLib);
sl@0
   152