os/kernelhwsrv/userlibandfileserver/fileserver/scomp/sc_std.h
author sl@SLION-WIN7.fritz.box
Fri, 15 Jun 2012 03:10:57 +0200
changeset 0 bde4ae8d615e
permissions -rw-r--r--
First public contribution.
sl@0
     1
// Copyright (c) 2003-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
//
sl@0
    15
sl@0
    16
#include "common.h"
sl@0
    17
#include <f32fsys.h>
sl@0
    18
#include <f32ver.h>
sl@0
    19
#include <f32dbg.h>
sl@0
    20
sl@0
    21
IMPORT_C TUint32 DebugRegister();
sl@0
    22
#if defined(_DEBUG) || defined(_DEBUG_RELEASE)
sl@0
    23
#define __PRINT(t) {if (DebugRegister()&KCOMPFS) RDebug::Print(t);}
sl@0
    24
#define __PRINT1(t,a) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a);}
sl@0
    25
#define __PRINT2(t,a,b) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b);}
sl@0
    26
#define __PRINT3(t,a,b,c) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b,c);}
sl@0
    27
#define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b,c,d);}
sl@0
    28
#else
sl@0
    29
#define __PRINT(t)
sl@0
    30
#define __PRINT1(t,a)
sl@0
    31
#define __PRINT2(t,a,b)
sl@0
    32
#define __PRINT3(t,a,b,c)
sl@0
    33
#define __PRINT4(t,a,b,c,d)
sl@0
    34
#endif
sl@0
    35
sl@0
    36
sl@0
    37
enum TCompFault
sl@0
    38
	{
sl@0
    39
	ECompMountRemount,
sl@0
    40
	ECompDirReadPending,
sl@0
    41
	ECompFsDefaultPath,
sl@0
    42
	ECompDirStoreLongEntryNameL,
sl@0
    43
	};
sl@0
    44
sl@0
    45
class TCompMount
sl@0
    46
	{
sl@0
    47
public:
sl@0
    48
		inline TCompMount(CFileSystem* aFs, CMountCB* aMount);
sl@0
    49
			
sl@0
    50
		CFileSystem* iFs;
sl@0
    51
		CMountCB* iMount;
sl@0
    52
	};
sl@0
    53
sl@0
    54
sl@0
    55
// CCompMountCB
sl@0
    56
sl@0
    57
class CDirCB;
sl@0
    58
class CCompFileSystem;
sl@0
    59
class CCompMountCB : public CMountCB, public CMountCB::MFileAccessor
sl@0
    60
	{
sl@0
    61
public:
sl@0
    62
	void MountL(TBool aForceMount);
sl@0
    63
	TInt ReMount();
sl@0
    64
	void Dismounted();
sl@0
    65
	void VolumeL(TVolumeInfo& aVolume) const;
sl@0
    66
	void SetVolumeL(TDes& aName);
sl@0
    67
	void MkDirL(const TDesC& aName);
sl@0
    68
	void RmDirL(const TDesC& aName);
sl@0
    69
	void DeleteL(const TDesC& aName);
sl@0
    70
	void RenameL(const TDesC& anOldName,const TDesC& anNewName);
sl@0
    71
	void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
sl@0
    72
	void EntryL(const TDesC& aName,TEntry& anEntry) const;
sl@0
    73
	void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
sl@0
    74
	void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
sl@0
    75
	void DirOpenL(const TDesC& aName,CDirCB* aDir);
sl@0
    76
	void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const;
sl@0
    77
	void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage);
sl@0
    78
	void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
sl@0
    79
	void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
sl@0
    80
	void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
sl@0
    81
	void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
sl@0
    82
sl@0
    83
	inline void SetMountNumber(TInt aNum);
sl@0
    84
sl@0
    85
	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
sl@0
    86
	virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
sl@0
    87
	virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
sl@0
    88
	virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
sl@0
    89
	virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
sl@0
    90
sl@0
    91
private:
sl@0
    92
	CCompMountCB(CCompFileSystem * aOwner) {iFileSystem=aOwner;}
sl@0
    93
	~CCompMountCB();
sl@0
    94
sl@0
    95
	inline CMountCB* RomMount() const;
sl@0
    96
	inline void NullCompFileSystem(void);
sl@0
    97
	void NewRomMountL();
sl@0
    98
//	TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
sl@0
    99
	TInt AddFsToCompositeMount(CFileSystem* aFileSystem);
sl@0
   100
sl@0
   101
	TInt64 iSize;
sl@0
   102
	CCompFileSystem * iFileSystem;
sl@0
   103
protected:
sl@0
   104
	RArray<TCompMount> iMounts;
sl@0
   105
sl@0
   106
	friend class CCompFileSystem;
sl@0
   107
	friend class CCompDirCB;
sl@0
   108
	};
sl@0
   109
sl@0
   110
sl@0
   111
// CCompDirCB
sl@0
   112
sl@0
   113
class CCompDirCB : public CDirCB
sl@0
   114
	{
sl@0
   115
public:
sl@0
   116
	void ReadL(TEntry& anEntry);
sl@0
   117
	void StoreLongEntryNameL(const TDesC& aName);
sl@0
   118
sl@0
   119
	TInt InitDir(CDirCB* aTrg, CMountCB* aMount);
sl@0
   120
	TInt InitDir(CMountCB* aMount);
sl@0
   121
	
sl@0
   122
public:
sl@0
   123
	HBufC* iMatch;
sl@0
   124
private:
sl@0
   125
	CCompDirCB();
sl@0
   126
	~CCompDirCB();
sl@0
   127
	
sl@0
   128
	TBool IsDuplicate(TFileName& aFilename);
sl@0
   129
sl@0
   130
	RPointerArray<CDirCB> iDirs;
sl@0
   131
	TInt	iCurrentDir;
sl@0
   132
sl@0
   133
	friend class CCompFileSystem;
sl@0
   134
	friend class CCompMountCB;
sl@0
   135
	};
sl@0
   136
sl@0
   137
sl@0
   138
// CCompFileCB
sl@0
   139
sl@0
   140
class CCompFileCB : public CFileCB
sl@0
   141
	{
sl@0
   142
public:
sl@0
   143
	CCompFileCB();
sl@0
   144
	~CCompFileCB();
sl@0
   145
	
sl@0
   146
	void RenameL(const TDesC& aNewName);
sl@0
   147
	void ReadL(TInt aPos,TInt& aLength,const TAny* aDes);
sl@0
   148
	void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
sl@0
   149
	void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
sl@0
   150
	TInt Address(TInt& aPos) const;
sl@0
   151
	void SetSizeL(TInt aSize);
sl@0
   152
	void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
sl@0
   153
	void FlushDataL();
sl@0
   154
	void FlushAllL();
sl@0
   155
sl@0
   156
	inline void SetTrueFile(CFileCB* aFile);
sl@0
   157
	inline CFileCB* TrueFile() const;
sl@0
   158
sl@0
   159
protected:
sl@0
   160
	
sl@0
   161
	virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
sl@0
   162
sl@0
   163
private:
sl@0
   164
sl@0
   165
	CFileCB* iTrueFile;
sl@0
   166
	};
sl@0
   167
sl@0
   168
sl@0
   169
// CCompFileSystem
sl@0
   170
sl@0
   171
class CCompFileSystem : public CFileSystem
sl@0
   172
	{
sl@0
   173
public:
sl@0
   174
	CCompFileSystem();
sl@0
   175
	~CCompFileSystem();
sl@0
   176
	static CFileSystem* NewL();
sl@0
   177
	TInt Install();
sl@0
   178
	CMountCB* NewMountL() const;
sl@0
   179
	CFileCB* NewFileL() const;
sl@0
   180
	CDirCB* NewDirL() const;
sl@0
   181
	CFormatCB* NewFormatL() const;
sl@0
   182
	void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
sl@0
   183
	TInt DefaultPath(TDes& aPath) const;
sl@0
   184
sl@0
   185
	inline void NullMount(void);
sl@0
   186
private:
sl@0
   187
sl@0
   188
	CCompMountCB* iMount;
sl@0
   189
	};
sl@0
   190
sl@0
   191
sl@0
   192
#include "sc_std.inl"
sl@0
   193