sl@0
|
1 |
// Copyright (c) 1997-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 |
// f32test\fsstress\t_remfsy.h
|
sl@0
|
15 |
//
|
sl@0
|
16 |
//
|
sl@0
|
17 |
|
sl@0
|
18 |
#include <e32twin.h>
|
sl@0
|
19 |
#if !defined(__T_REMFSY_H__)
|
sl@0
|
20 |
#define __T_REMFSY_H__
|
sl@0
|
21 |
#if defined(_UNICODE)
|
sl@0
|
22 |
#define _WTEXT(c) L ## c
|
sl@0
|
23 |
#define _STRC LPCWSTR
|
sl@0
|
24 |
#define _STR LPWSTR
|
sl@0
|
25 |
#else
|
sl@0
|
26 |
#define _WTEXT(c) c
|
sl@0
|
27 |
#define _STRC LPCSTR
|
sl@0
|
28 |
#define _STR LPSTR
|
sl@0
|
29 |
#endif
|
sl@0
|
30 |
|
sl@0
|
31 |
#include <f32fsys.h>
|
sl@0
|
32 |
#include <f32file.h>
|
sl@0
|
33 |
#include <e32test.h>
|
sl@0
|
34 |
#include <e32hal.h>
|
sl@0
|
35 |
#include <e32math.h>
|
sl@0
|
36 |
#if defined (__DEBUG__)|| defined(_DEBUG_RELEASE)
|
sl@0
|
37 |
#include <f32dbg.h>
|
sl@0
|
38 |
#endif
|
sl@0
|
39 |
|
sl@0
|
40 |
|
sl@0
|
41 |
//
|
sl@0
|
42 |
// Common constants used by both EFSRV and the filesystems
|
sl@0
|
43 |
//
|
sl@0
|
44 |
|
sl@0
|
45 |
const TUint KEntryAttIllegal=(KEntryAttVolume|KEntryAttDir);
|
sl@0
|
46 |
const TUint KEntryAttModified=0x20000000;
|
sl@0
|
47 |
const TUint KEntryAttMustBeFile=0x80000000;
|
sl@0
|
48 |
const TInt KCurrentPosition=KMinTInt;
|
sl@0
|
49 |
|
sl@0
|
50 |
|
sl@0
|
51 |
GLDEF_D const TInt KMaxParses=7;
|
sl@0
|
52 |
GLDEF_D const TInt KHeapSize=0x2000;
|
sl@0
|
53 |
GLREF_C void TurnAllocFailureOff();
|
sl@0
|
54 |
GLREF_C void TurnAllocFailureOn();
|
sl@0
|
55 |
GLREF_C void ReportCheckDiskFailure(TInt aRet);
|
sl@0
|
56 |
GLREF_D RTest test;
|
sl@0
|
57 |
GLREF_D TFileName gSessionPath;
|
sl@0
|
58 |
GLREF_D TInt gAllocFailOff;
|
sl@0
|
59 |
GLREF_D TInt gAllocFailOn;
|
sl@0
|
60 |
|
sl@0
|
61 |
#if defined(_DEBUG)
|
sl@0
|
62 |
#define SetAllocFailure(a) SetAllocFailure(a)
|
sl@0
|
63 |
#else
|
sl@0
|
64 |
#define SetAllocFailure(a) IsRomAddress(NULL)
|
sl@0
|
65 |
#define KAllocFailureOn 0
|
sl@0
|
66 |
#define KAllocFailureOff 0
|
sl@0
|
67 |
#endif
|
sl@0
|
68 |
|
sl@0
|
69 |
|
sl@0
|
70 |
enum TPanic
|
sl@0
|
71 |
{
|
sl@0
|
72 |
EFileTimeToSystemTime,
|
sl@0
|
73 |
EFileClose,
|
sl@0
|
74 |
EFileCloseSetAttributes,
|
sl@0
|
75 |
EDirClose,
|
sl@0
|
76 |
EMapCouldNotConnect
|
sl@0
|
77 |
};
|
sl@0
|
78 |
|
sl@0
|
79 |
|
sl@0
|
80 |
class CSessionFs;
|
sl@0
|
81 |
|
sl@0
|
82 |
class CRemoteMountCB : public CMountCB
|
sl@0
|
83 |
{
|
sl@0
|
84 |
public:
|
sl@0
|
85 |
CRemoteMountCB();
|
sl@0
|
86 |
~CRemoteMountCB();
|
sl@0
|
87 |
void MountL(TBool aForceMount);
|
sl@0
|
88 |
TInt ReMount();
|
sl@0
|
89 |
void Dismounted();
|
sl@0
|
90 |
void VolumeL(TVolumeInfo& aVolume) const;
|
sl@0
|
91 |
void SetVolumeL(TDes& aName);
|
sl@0
|
92 |
void MkDirL(const TDesC& aName);
|
sl@0
|
93 |
void RmDirL(const TDesC& aName);
|
sl@0
|
94 |
void DeleteL(const TDesC& aName);
|
sl@0
|
95 |
void RenameL(const TDesC& anOldName,const TDesC& anNewName);
|
sl@0
|
96 |
void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
|
sl@0
|
97 |
void EntryL(const TDesC& aName,TEntry& anEntry) const;
|
sl@0
|
98 |
void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
|
sl@0
|
99 |
void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
|
sl@0
|
100 |
void DirOpenL(const TDesC& aName,CDirCB* aDir);
|
sl@0
|
101 |
void RawReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt anOffset,const RMessagePtr2& aMessage) const;
|
sl@0
|
102 |
void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt anOffset,const RMessagePtr2& aMessage);
|
sl@0
|
103 |
void ReadUidL(const TDesC& aName,TEntry& anEntry) const;
|
sl@0
|
104 |
void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
|
sl@0
|
105 |
void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
|
sl@0
|
106 |
void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
|
sl@0
|
107 |
void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
|
sl@0
|
108 |
private:
|
sl@0
|
109 |
TBool IsRomDrive() const;
|
sl@0
|
110 |
};
|
sl@0
|
111 |
|
sl@0
|
112 |
|
sl@0
|
113 |
class RConsole;
|
sl@0
|
114 |
class CRemoteFileCB : public CFileCB
|
sl@0
|
115 |
{
|
sl@0
|
116 |
public:
|
sl@0
|
117 |
CRemoteFileCB();
|
sl@0
|
118 |
~CRemoteFileCB();
|
sl@0
|
119 |
void RenameL(const TDesC& aNewName);
|
sl@0
|
120 |
void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
|
sl@0
|
121 |
void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
|
sl@0
|
122 |
TInt Address(TInt& aPos) const;
|
sl@0
|
123 |
void SetSizeL(TInt aSize);
|
sl@0
|
124 |
void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
|
sl@0
|
125 |
void FlushDataL();
|
sl@0
|
126 |
void FlushAllL();
|
sl@0
|
127 |
// inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;}
|
sl@0
|
128 |
void CheckPos(TInt aPos);
|
sl@0
|
129 |
private:
|
sl@0
|
130 |
TBool IsRomDrive() const;
|
sl@0
|
131 |
private:
|
sl@0
|
132 |
TInt iCurrentPos;
|
sl@0
|
133 |
TUint8* iFilePtr;
|
sl@0
|
134 |
RConsole iConsole;
|
sl@0
|
135 |
// HANDLE iWinHandle;
|
sl@0
|
136 |
};
|
sl@0
|
137 |
|
sl@0
|
138 |
class CRemoteDirCB : public CDirCB
|
sl@0
|
139 |
{
|
sl@0
|
140 |
public:
|
sl@0
|
141 |
CRemoteDirCB(/*CSessionFs* aSession*/);
|
sl@0
|
142 |
~CRemoteDirCB();
|
sl@0
|
143 |
void ReadL(TEntry& anEntry);
|
sl@0
|
144 |
// inline void SetHandle(HANDLE aHandle) {iWinHandle=aHandle;}
|
sl@0
|
145 |
inline void SetFullName(const TDesC& aName) {iFullName.Set(aName,NULL,NULL);}
|
sl@0
|
146 |
private:
|
sl@0
|
147 |
TBool MatchUid();
|
sl@0
|
148 |
public:
|
sl@0
|
149 |
TEntry iEntry;
|
sl@0
|
150 |
private:
|
sl@0
|
151 |
// HANDLE iWinHandle;
|
sl@0
|
152 |
TParse iFullName;
|
sl@0
|
153 |
};
|
sl@0
|
154 |
|
sl@0
|
155 |
class CRemoteFormatCB : public CFormatCB
|
sl@0
|
156 |
{
|
sl@0
|
157 |
public:
|
sl@0
|
158 |
CRemoteFormatCB(/*CSessionFs* aSession*/);
|
sl@0
|
159 |
~CRemoteFormatCB();
|
sl@0
|
160 |
public:
|
sl@0
|
161 |
virtual void DoFormatStepL();
|
sl@0
|
162 |
};
|
sl@0
|
163 |
|
sl@0
|
164 |
class CRemote : public CFileSystem
|
sl@0
|
165 |
{
|
sl@0
|
166 |
public:
|
sl@0
|
167 |
CRemote();
|
sl@0
|
168 |
TInt Install();
|
sl@0
|
169 |
TInt DefaultPath(TDes& aPath) const;
|
sl@0
|
170 |
void DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const;
|
sl@0
|
171 |
private:
|
sl@0
|
172 |
CMountCB* NewMountL() const; // These were not previously implemented
|
sl@0
|
173 |
CFileCB* NewFileL() const; // They are essential for a CRemote
|
sl@0
|
174 |
CDirCB* NewDirL() const; // object to be instantiated because they are
|
sl@0
|
175 |
CFormatCB* NewFormatL() const; // pure virtual in CFileSystem
|
sl@0
|
176 |
public:
|
sl@0
|
177 |
static CFileSystem* NewL();
|
sl@0
|
178 |
};
|
sl@0
|
179 |
|
sl@0
|
180 |
struct SParse
|
sl@0
|
181 |
{
|
sl@0
|
182 |
const TText* src;
|
sl@0
|
183 |
const TText* rel;
|
sl@0
|
184 |
const TText* def;
|
sl@0
|
185 |
const TText* fullName;
|
sl@0
|
186 |
const TText* drive;
|
sl@0
|
187 |
const TText* path;
|
sl@0
|
188 |
const TText* name;
|
sl@0
|
189 |
const TText* ext;
|
sl@0
|
190 |
};
|
sl@0
|
191 |
|
sl@0
|
192 |
struct SParseServer
|
sl@0
|
193 |
{
|
sl@0
|
194 |
const TText* src;
|
sl@0
|
195 |
const TText* rel;
|
sl@0
|
196 |
const TText* fullName;
|
sl@0
|
197 |
const TText* drive;
|
sl@0
|
198 |
const TText* path;
|
sl@0
|
199 |
const TText* name;
|
sl@0
|
200 |
const TText* ext;
|
sl@0
|
201 |
};
|
sl@0
|
202 |
|
sl@0
|
203 |
|
sl@0
|
204 |
class TMultipleSessionTest
|
sl@0
|
205 |
{
|
sl@0
|
206 |
public:
|
sl@0
|
207 |
TMultipleSessionTest() {};
|
sl@0
|
208 |
TMultipleSessionTest(RFs& aFs): iFs(aFs){};
|
sl@0
|
209 |
void Initialise(RFs& aFs);
|
sl@0
|
210 |
void RunTests(RTest& aTest);
|
sl@0
|
211 |
void testDriveList(RTest& aTest);
|
sl@0
|
212 |
void testDriveInfo(RTest& aTest);
|
sl@0
|
213 |
void testVolumeInfo(RTest& aTest);
|
sl@0
|
214 |
void testPath(RTest& aTest);
|
sl@0
|
215 |
void testInitialisation(RTest& aTest);
|
sl@0
|
216 |
void testSubst(RTest& aTest);
|
sl@0
|
217 |
void CopyFileToTestDirectory(RTest& aTest);
|
sl@0
|
218 |
void MakeAndDeleteFiles(RTest& aTest);
|
sl@0
|
219 |
void FillUpDisk(RTest& aTest);
|
sl@0
|
220 |
void testSetVolume(RTest& aTest);
|
sl@0
|
221 |
// void testPowerDown(RTest& aTest);
|
sl@0
|
222 |
// void testMediaChange(RTest& aTest);
|
sl@0
|
223 |
void DeleteTestDirectory(RTest& aTest);
|
sl@0
|
224 |
TInt CurrentDrive(RTest& aTest);
|
sl@0
|
225 |
void SetSessionPath(TInt aDrive);
|
sl@0
|
226 |
private:
|
sl@0
|
227 |
RFs iFs;
|
sl@0
|
228 |
TBuf<30> iSessionPath;
|
sl@0
|
229 |
};
|
sl@0
|
230 |
|
sl@0
|
231 |
|
sl@0
|
232 |
//
|
sl@0
|
233 |
// WINS - dependent functions
|
sl@0
|
234 |
//
|
sl@0
|
235 |
|
sl@0
|
236 |
GLREF_D const TFileName ZPath;
|
sl@0
|
237 |
|
sl@0
|
238 |
GLREF_C TBool GetEnvValue(TInt aDrive,TDes& aDes);
|
sl@0
|
239 |
GLREF_C TBool MapDrive(TDes& aFileName,TInt aDrive);
|
sl@0
|
240 |
GLREF_C TBool MapDriveInfo(TDriveInfo& anInfo,TInt aDrive);
|
sl@0
|
241 |
GLREF_C TBool MapDriveAttributes(TUint& aDriveAtt,TInt aDrive);
|
sl@0
|
242 |
GLREF_C void CheckAppendL(TDes& aFileName,const TDesC& aName);
|
sl@0
|
243 |
#endif
|
sl@0
|
244 |
|
sl@0
|
245 |
|