First public contribution.
1 // Copyright (c) 2003-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.
21 IMPORT_C TUint32 DebugRegister();
22 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
23 #define __PRINT(t) {if (DebugRegister()&KCOMPFS) RDebug::Print(t);}
24 #define __PRINT1(t,a) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a);}
25 #define __PRINT2(t,a,b) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b);}
26 #define __PRINT3(t,a,b,c) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b,c);}
27 #define __PRINT4(t,a,b,c,d) {if (DebugRegister()&KCOMPFS) RDebug::Print(t,a,b,c,d);}
31 #define __PRINT2(t,a,b)
32 #define __PRINT3(t,a,b,c)
33 #define __PRINT4(t,a,b,c,d)
42 ECompDirStoreLongEntryNameL,
48 inline TCompMount(CFileSystem* aFs, CMountCB* aMount);
58 class CCompFileSystem;
59 class CCompMountCB : public CMountCB, public CMountCB::MFileAccessor
62 void MountL(TBool aForceMount);
65 void VolumeL(TVolumeInfo& aVolume) const;
66 void SetVolumeL(TDes& aName);
67 void MkDirL(const TDesC& aName);
68 void RmDirL(const TDesC& aName);
69 void DeleteL(const TDesC& aName);
70 void RenameL(const TDesC& anOldName,const TDesC& anNewName);
71 void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
72 void EntryL(const TDesC& aName,TEntry& anEntry) const;
73 void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
74 void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
75 void DirOpenL(const TDesC& aName,CDirCB* aDir);
76 void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const;
77 void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage);
78 void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
79 void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
80 void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
81 void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
83 inline void SetMountNumber(TInt aNum);
85 virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
86 virtual TInt GetFileUniqueId(const TDesC& aName, TInt64& aUniqueId);
87 virtual TInt Spare3(TInt aVal, TAny* aPtr1, TAny* aPtr2);
88 virtual TInt Spare2(TInt aVal, TAny* aPtr1, TAny* aPtr2);
89 virtual TInt Spare1(TInt aVal, TAny* aPtr1, TAny* aPtr2);
92 CCompMountCB(CCompFileSystem * aOwner) {iFileSystem=aOwner;}
95 inline CMountCB* RomMount() const;
96 inline void NullCompFileSystem(void);
98 // TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
99 TInt AddFsToCompositeMount(CFileSystem* aFileSystem);
102 CCompFileSystem * iFileSystem;
104 RArray<TCompMount> iMounts;
106 friend class CCompFileSystem;
107 friend class CCompDirCB;
113 class CCompDirCB : public CDirCB
116 void ReadL(TEntry& anEntry);
117 void StoreLongEntryNameL(const TDesC& aName);
119 TInt InitDir(CDirCB* aTrg, CMountCB* aMount);
120 TInt InitDir(CMountCB* aMount);
128 TBool IsDuplicate(TFileName& aFilename);
130 RPointerArray<CDirCB> iDirs;
133 friend class CCompFileSystem;
134 friend class CCompMountCB;
140 class CCompFileCB : public CFileCB
146 void RenameL(const TDesC& aNewName);
147 void ReadL(TInt aPos,TInt& aLength,const TAny* aDes);
148 void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
149 void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
150 TInt Address(TInt& aPos) const;
151 void SetSizeL(TInt aSize);
152 void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
156 inline void SetTrueFile(CFileCB* aFile);
157 inline CFileCB* TrueFile() const;
161 virtual TInt GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput);
171 class CCompFileSystem : public CFileSystem
176 static CFileSystem* NewL();
178 CMountCB* NewMountL() const;
179 CFileCB* NewFileL() const;
180 CDirCB* NewDirL() const;
181 CFormatCB* NewFormatL() const;
182 void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
183 TInt DefaultPath(TDes& aPath) const;
185 inline void NullMount(void);
188 CCompMountCB* iMount;
192 #include "sc_std.inl"