First public contribution.
1 // Copyright (c) 1997-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.
14 // f32test\fsstress\t_remfsy.h
19 #if !defined(__T_REMFSY_H__)
20 #define __T_REMFSY_H__
22 #define _WTEXT(c) L ## c
36 #if defined (__DEBUG__)|| defined(_DEBUG_RELEASE)
42 // Common constants used by both EFSRV and the filesystems
45 const TUint KEntryAttIllegal=(KEntryAttVolume|KEntryAttDir);
46 const TUint KEntryAttModified=0x20000000;
47 const TUint KEntryAttMustBeFile=0x80000000;
48 const TInt KCurrentPosition=KMinTInt;
51 GLDEF_D const TInt KMaxParses=7;
52 GLDEF_D const TInt KHeapSize=0x2000;
53 GLREF_C void TurnAllocFailureOff();
54 GLREF_C void TurnAllocFailureOn();
55 GLREF_C void ReportCheckDiskFailure(TInt aRet);
57 GLREF_D TFileName gSessionPath;
58 GLREF_D TInt gAllocFailOff;
59 GLREF_D TInt gAllocFailOn;
62 #define SetAllocFailure(a) SetAllocFailure(a)
64 #define SetAllocFailure(a) IsRomAddress(NULL)
65 #define KAllocFailureOn 0
66 #define KAllocFailureOff 0
72 EFileTimeToSystemTime,
74 EFileCloseSetAttributes,
82 class CRemoteMountCB : public CMountCB
87 void MountL(TBool aForceMount);
90 void VolumeL(TVolumeInfo& aVolume) const;
91 void SetVolumeL(TDes& aName);
92 void MkDirL(const TDesC& aName);
93 void RmDirL(const TDesC& aName);
94 void DeleteL(const TDesC& aName);
95 void RenameL(const TDesC& anOldName,const TDesC& anNewName);
96 void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
97 void EntryL(const TDesC& aName,TEntry& anEntry) const;
98 void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
99 void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
100 void DirOpenL(const TDesC& aName,CDirCB* aDir);
101 void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const;
102 void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage);
103 void ReadUidL(const TDesC& aName,TEntry& anEntry) const;
104 void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
105 void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
106 void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
107 void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
109 TBool IsRomDrive() const;
114 class CRemoteFileCB : public CFileCB
119 void RenameL(const TDesC& aNewName);
120 void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
121 void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
122 TInt Address(TInt& aPos) const;
123 void SetSizeL(TInt aSize);
124 void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
127 // inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;}
128 void CheckPos(TInt aPos);
130 TBool IsRomDrive() const;
135 // HANDLE iWinHandle;
138 class CRemoteDirCB : public CDirCB
141 CRemoteDirCB(/*CSessionFs* aSession*/);
143 void ReadL(TEntry& anEntry);
144 // inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;}
145 inline void SetFullName(const TDesC& aName) {iFullName.Set(aName,NULL,NULL);}
151 // HANDLE iWinHandle;
155 class CRemoteFormatCB : public CFormatCB
158 CRemoteFormatCB(/*CSessionFs* aSession*/);
161 virtual void DoFormatStepL();
164 class CRemote : public CFileSystem
169 TInt DefaultPath(TDes& aPath) const;
170 void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
172 CMountCB* NewMountL() const; // These were not previously implemented
173 CFileCB* NewFileL() const; // They are essential for a CRemote
174 CDirCB* NewDirL() const; // object to be instantiated because they are
175 CFormatCB* NewFormatL() const; // pure virtual in CFileSystem
177 static CFileSystem* NewL();
185 const TText* fullName;
196 const TText* fullName;
204 class TMultipleSessionTest
207 TMultipleSessionTest() {};
208 TMultipleSessionTest(RFs& aFs): iFs(aFs){};
209 void Initialise(RFs& aFs);
210 void RunTests(RTest& aTest);
211 void testDriveList(RTest& aTest);
212 void testDriveInfo(RTest& aTest);
213 void testVolumeInfo(RTest& aTest);
214 void testPath(RTest& aTest);
215 void testInitialisation(RTest& aTest);
216 void testSubst(RTest& aTest);
217 void CopyFileToTestDirectory(RTest& aTest);
218 void MakeAndDeleteFiles(RTest& aTest);
219 void FillUpDisk(RTest& aTest);
220 void testSetVolume(RTest& aTest);
221 // void testPowerDown(RTest& aTest);
222 // void testMediaChange(RTest& aTest);
223 void DeleteTestDirectory(RTest& aTest);
224 TInt CurrentDrive(RTest& aTest);
225 void SetSessionPath(TInt aDrive);
228 TBuf<30> iSessionPath;
233 // WINS - dependent functions
236 GLREF_D const TFileName ZPath;
238 GLREF_C TBool GetEnvValue(TInt aDrive,TDes& aDes);
239 GLREF_C TBool MapDrive(TDes& aFileName,TInt aDrive);
240 GLREF_C TBool MapDriveInfo(TDriveInfo& anInfo,TInt aDrive);
241 GLREF_C TBool MapDriveAttributes(TUint& aDriveAtt,TInt aDrive);
242 GLREF_C void CheckAppendL(TDes& aFileName,const TDesC& aName);