sl@0
|
1 |
// Copyright (c) 2002-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 |
// @file f32test\concur\cfafsdly.cpp
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
|
sl@0
|
18 |
#include "cfafsdly.h"
|
sl@0
|
19 |
#include "cfafsdlyif.h"
|
sl@0
|
20 |
#include "cfafshmem.h"
|
sl@0
|
21 |
|
sl@0
|
22 |
IMPORT_C TUint32 DebugRegister();
|
sl@0
|
23 |
|
sl@0
|
24 |
const TInt KMajorVersionNumber=1;
|
sl@0
|
25 |
const TInt KMinorVersionNumber=0;
|
sl@0
|
26 |
|
sl@0
|
27 |
class TTestDebug
|
sl@0
|
28 |
/// Class containing debugging functions.
|
sl@0
|
29 |
{
|
sl@0
|
30 |
public:
|
sl@0
|
31 |
static void Printf(TRefByValue<const TDesC> aFmt, ...)
|
sl@0
|
32 |
{
|
sl@0
|
33 |
if (DebugRegister() & KDLYTRC)
|
sl@0
|
34 |
{
|
sl@0
|
35 |
VA_LIST list;
|
sl@0
|
36 |
VA_START(list, aFmt);
|
sl@0
|
37 |
TBuf<256>buf;
|
sl@0
|
38 |
buf.FormatList(aFmt, list);
|
sl@0
|
39 |
RDebug::Print(_L("%S"), &buf);
|
sl@0
|
40 |
}
|
sl@0
|
41 |
}
|
sl@0
|
42 |
static void After(TInt usec)
|
sl@0
|
43 |
{
|
sl@0
|
44 |
RTimer timer;
|
sl@0
|
45 |
timer.CreateLocal();
|
sl@0
|
46 |
TRequestStatus stat;
|
sl@0
|
47 |
timer.After(stat, usec);
|
sl@0
|
48 |
User::WaitForRequest(stat);
|
sl@0
|
49 |
timer.Close();
|
sl@0
|
50 |
}
|
sl@0
|
51 |
private:
|
sl@0
|
52 |
};
|
sl@0
|
53 |
|
sl@0
|
54 |
TTestFile::TTestFile()
|
sl@0
|
55 |
/// Initialise a file (clear the size).
|
sl@0
|
56 |
{
|
sl@0
|
57 |
iSize = 0;
|
sl@0
|
58 |
}
|
sl@0
|
59 |
|
sl@0
|
60 |
void TTestFile::Entry(TEntry& aEntry) const
|
sl@0
|
61 |
/// Set up a standard entry item for the file. Note that it strips off any
|
sl@0
|
62 |
/// path from the name of the file.
|
sl@0
|
63 |
/// @param aEntry Item to receive data about the file.
|
sl@0
|
64 |
{
|
sl@0
|
65 |
TInt i = iName.LocateReverse('\\');
|
sl@0
|
66 |
if (i == KErrNotFound)
|
sl@0
|
67 |
i = 0;
|
sl@0
|
68 |
else
|
sl@0
|
69 |
++i;
|
sl@0
|
70 |
aEntry.iName = iName.Mid(i);
|
sl@0
|
71 |
aEntry.iAtt = KEntryAttNormal;
|
sl@0
|
72 |
aEntry.iSize = iSize;
|
sl@0
|
73 |
aEntry.iModified = iTime;
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
|
sl@0
|
77 |
TTestDir::TTestDir()
|
sl@0
|
78 |
{
|
sl@0
|
79 |
}
|
sl@0
|
80 |
|
sl@0
|
81 |
TTestFile* TTestDir::Create(const TDesC& aName)
|
sl@0
|
82 |
/// Create a new file, if there is any space left.
|
sl@0
|
83 |
/// @param aName Name of the file to be created.
|
sl@0
|
84 |
/// @return Pointer to the file structure if it there is space, NULL if not.
|
sl@0
|
85 |
{
|
sl@0
|
86 |
TInt i;
|
sl@0
|
87 |
for (i = 0; i < KMaxFiles; i++)
|
sl@0
|
88 |
{
|
sl@0
|
89 |
if (iFile[i].iName.Length() == 0)
|
sl@0
|
90 |
{
|
sl@0
|
91 |
iFile[i].iName = aName;
|
sl@0
|
92 |
iFile[i].iSize = 0;
|
sl@0
|
93 |
return &iFile[i];
|
sl@0
|
94 |
}
|
sl@0
|
95 |
}
|
sl@0
|
96 |
return NULL;
|
sl@0
|
97 |
}
|
sl@0
|
98 |
|
sl@0
|
99 |
const TTestFile* TTestDir::Find(const TDesC& aName) const
|
sl@0
|
100 |
/// Find a file by name.
|
sl@0
|
101 |
/// @param aName Name of file to find (no wildcards).
|
sl@0
|
102 |
/// @return Pointer to the file structure if it is found, NULL if not.
|
sl@0
|
103 |
{
|
sl@0
|
104 |
TInt i;
|
sl@0
|
105 |
for (i = 0; i < KMaxFiles; i++)
|
sl@0
|
106 |
{
|
sl@0
|
107 |
if (aName == iFile[i].iName)
|
sl@0
|
108 |
{
|
sl@0
|
109 |
return &iFile[i];
|
sl@0
|
110 |
}
|
sl@0
|
111 |
}
|
sl@0
|
112 |
return NULL;
|
sl@0
|
113 |
}
|
sl@0
|
114 |
|
sl@0
|
115 |
TTestFile* TTestDir::Find(const TDesC& aName)
|
sl@0
|
116 |
/// Find a file by name.
|
sl@0
|
117 |
/// @param aName Name of file to find (no wildcards).
|
sl@0
|
118 |
/// @return Pointer to the file structure if it is found, NULL if not.
|
sl@0
|
119 |
{
|
sl@0
|
120 |
TInt i;
|
sl@0
|
121 |
for (i = 0; i < KMaxFiles; i++)
|
sl@0
|
122 |
{
|
sl@0
|
123 |
if (aName == iFile[i].iName)
|
sl@0
|
124 |
{
|
sl@0
|
125 |
return &iFile[i];
|
sl@0
|
126 |
}
|
sl@0
|
127 |
}
|
sl@0
|
128 |
return NULL;
|
sl@0
|
129 |
}
|
sl@0
|
130 |
|
sl@0
|
131 |
void TTestDir::Delete(const TDesC& aName)
|
sl@0
|
132 |
/// Delete a file by name (no wildcards) by setting its name to zero length.
|
sl@0
|
133 |
/// No error is returned if it doesn't exist.
|
sl@0
|
134 |
/// @param aName Name of file to delete (no wildcards).
|
sl@0
|
135 |
{
|
sl@0
|
136 |
TInt i;
|
sl@0
|
137 |
for (i = 0; i < KMaxFiles; i++)
|
sl@0
|
138 |
{
|
sl@0
|
139 |
if (aName == iFile[i].iName)
|
sl@0
|
140 |
{
|
sl@0
|
141 |
iFile[i].iName.SetLength(0);
|
sl@0
|
142 |
iFile[i].iSize = 0;
|
sl@0
|
143 |
}
|
sl@0
|
144 |
}
|
sl@0
|
145 |
}
|
sl@0
|
146 |
|
sl@0
|
147 |
TTestFile* TTestDir::Entry(TInt aIndex)
|
sl@0
|
148 |
/// Return a pointer to the specified file by number, or NULL if the index
|
sl@0
|
149 |
/// is out of range.
|
sl@0
|
150 |
{
|
sl@0
|
151 |
return (aIndex >= 0 && aIndex < KMaxFiles ? &iFile[aIndex] : NULL);
|
sl@0
|
152 |
}
|
sl@0
|
153 |
|
sl@0
|
154 |
CTestFileSystem::CTestFileSystem()
|
sl@0
|
155 |
///
|
sl@0
|
156 |
/// Constructor
|
sl@0
|
157 |
///
|
sl@0
|
158 |
{
|
sl@0
|
159 |
__DECLARE_NAME(_S("CTestFileSystem"));
|
sl@0
|
160 |
TTestDebug::Printf(_L("CTestFileSystem::CTestFileSystem()\n"));
|
sl@0
|
161 |
}
|
sl@0
|
162 |
|
sl@0
|
163 |
CTestFileSystem::~CTestFileSystem()
|
sl@0
|
164 |
///
|
sl@0
|
165 |
/// Destructor
|
sl@0
|
166 |
///
|
sl@0
|
167 |
{
|
sl@0
|
168 |
TTestDebug::Printf(_L("CTestFileSystem::~CTestFileSystem()\n"));
|
sl@0
|
169 |
}
|
sl@0
|
170 |
|
sl@0
|
171 |
TInt CTestFileSystem::Install()
|
sl@0
|
172 |
///
|
sl@0
|
173 |
/// Install the file system
|
sl@0
|
174 |
///
|
sl@0
|
175 |
{
|
sl@0
|
176 |
TTestDebug::Printf(_L("CTestFileSystem::Install()\n"));
|
sl@0
|
177 |
iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KF32BuildVersionNumber);
|
sl@0
|
178 |
TPtrC name=_L("DelayFS");
|
sl@0
|
179 |
return(SetName(&name));
|
sl@0
|
180 |
}
|
sl@0
|
181 |
|
sl@0
|
182 |
CMountCB* CTestFileSystem::NewMountL() const
|
sl@0
|
183 |
///
|
sl@0
|
184 |
/// Create a new mount control block
|
sl@0
|
185 |
///
|
sl@0
|
186 |
{
|
sl@0
|
187 |
TTestDebug::Printf(_L("CTestFileSystem::NewMountL()\n"));
|
sl@0
|
188 |
return (new(ELeave) CTestMountCB);
|
sl@0
|
189 |
}
|
sl@0
|
190 |
|
sl@0
|
191 |
CFileCB* CTestFileSystem::NewFileL() const
|
sl@0
|
192 |
///
|
sl@0
|
193 |
/// Create a new file
|
sl@0
|
194 |
///
|
sl@0
|
195 |
{
|
sl@0
|
196 |
TTestDebug::Printf(_L("CTestFileSystem::NewFileL()\n"));
|
sl@0
|
197 |
return (new(ELeave) CTestFileCB);
|
sl@0
|
198 |
}
|
sl@0
|
199 |
|
sl@0
|
200 |
CDirCB* CTestFileSystem::NewDirL() const
|
sl@0
|
201 |
///
|
sl@0
|
202 |
/// create a new directory lister
|
sl@0
|
203 |
///
|
sl@0
|
204 |
{
|
sl@0
|
205 |
TTestDebug::Printf(_L("CTestFileSystem::NewDirL()\n"));
|
sl@0
|
206 |
return (new(ELeave) CTestDirCB);
|
sl@0
|
207 |
}
|
sl@0
|
208 |
|
sl@0
|
209 |
CFormatCB* CTestFileSystem::NewFormatL() const
|
sl@0
|
210 |
///
|
sl@0
|
211 |
/// Create a new media formatter
|
sl@0
|
212 |
///
|
sl@0
|
213 |
{
|
sl@0
|
214 |
TTestDebug::Printf(_L("CTestFileSystem::NewFormatL()\n"));
|
sl@0
|
215 |
return (new(ELeave) CTestFormatCB);
|
sl@0
|
216 |
}
|
sl@0
|
217 |
|
sl@0
|
218 |
TInt CTestFileSystem::DefaultPath(TDes& aPath) const
|
sl@0
|
219 |
///
|
sl@0
|
220 |
/// Return the intial default path
|
sl@0
|
221 |
///
|
sl@0
|
222 |
{
|
sl@0
|
223 |
TTestDebug::Printf(_L("CTestFileSystem::DefaultPath(%S)\n"), aPath.Ptr());
|
sl@0
|
224 |
aPath=_L("C:\\");
|
sl@0
|
225 |
return (KErrNone);
|
sl@0
|
226 |
}
|
sl@0
|
227 |
|
sl@0
|
228 |
void CTestFileSystem::DriveInfo(TDriveInfo& anInfo,TInt aDriveNumber) const
|
sl@0
|
229 |
///
|
sl@0
|
230 |
/// Return drive info - iDriveAtt already set
|
sl@0
|
231 |
///
|
sl@0
|
232 |
{
|
sl@0
|
233 |
TTestDebug::Printf(_L("CTestFileSystem::DriveInfo(%d)\n"), aDriveNumber);
|
sl@0
|
234 |
anInfo.iMediaAtt = KMediaAttFormattable;
|
sl@0
|
235 |
anInfo.iType = EMediaHardDisk;
|
sl@0
|
236 |
// anInfo.iDriveAtt = KDriveAttRemote | KDriveAttRemovable;
|
sl@0
|
237 |
anInfo.iDriveAtt = KDriveAttRemote;
|
sl@0
|
238 |
}
|
sl@0
|
239 |
|
sl@0
|
240 |
TBusLocalDrive& CTestFileSystem::DriveNumberToLocalDrive(TInt aDriveNumber)
|
sl@0
|
241 |
///
|
sl@0
|
242 |
/// Return the local drive associated with aDriveNumber
|
sl@0
|
243 |
///
|
sl@0
|
244 |
{
|
sl@0
|
245 |
TTestDebug::Printf(_L("CTestFileSystem::DriveNumberToLocalDrive()\n"));
|
sl@0
|
246 |
return(GetLocalDrive(aDriveNumber));
|
sl@0
|
247 |
}
|
sl@0
|
248 |
|
sl@0
|
249 |
/**
|
sl@0
|
250 |
Reports whether the specified interface is supported - if it is,
|
sl@0
|
251 |
the supplied interface object is modified to it
|
sl@0
|
252 |
|
sl@0
|
253 |
@param aInterfaceId The interface of interest
|
sl@0
|
254 |
@param aInterface The interface object
|
sl@0
|
255 |
@return KErrNone if the interface is supported, otherwise KErrNotFound
|
sl@0
|
256 |
|
sl@0
|
257 |
@see CFileSystem::GetInterface()
|
sl@0
|
258 |
*/
|
sl@0
|
259 |
TInt CTestFileSystem::GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput)
|
sl@0
|
260 |
{
|
sl@0
|
261 |
switch(aInterfaceId)
|
sl@0
|
262 |
{
|
sl@0
|
263 |
case CFileSystem::EProxyDriveSupport: // The Filesystem supports proxy drives
|
sl@0
|
264 |
return KErrNone;
|
sl@0
|
265 |
|
sl@0
|
266 |
default:
|
sl@0
|
267 |
return(CFileSystem::GetInterface(aInterfaceId, aInterface, aInput));
|
sl@0
|
268 |
}
|
sl@0
|
269 |
}
|
sl@0
|
270 |
|
sl@0
|
271 |
CFileSystem* CTestFileSystem::NewL()
|
sl@0
|
272 |
///
|
sl@0
|
273 |
/// Create a new filesystem and return the pointer to its structure.
|
sl@0
|
274 |
///
|
sl@0
|
275 |
{
|
sl@0
|
276 |
CFileSystem* testFSys = new(ELeave) CTestFileSystem;
|
sl@0
|
277 |
return testFSys;
|
sl@0
|
278 |
}
|
sl@0
|
279 |
|
sl@0
|
280 |
|
sl@0
|
281 |
/////////////////////////////////////////////////////////////////////////////
|
sl@0
|
282 |
|
sl@0
|
283 |
static void cvtbuff(TBuf<64>& aOut, const TDesC8& aIn)
|
sl@0
|
284 |
/// Copy an 8-bit buffer to a generic one.
|
sl@0
|
285 |
/// @param aOut Generic text buffer.
|
sl@0
|
286 |
/// @param aIn 8-bit buffer to be copied.
|
sl@0
|
287 |
{
|
sl@0
|
288 |
TInt i;
|
sl@0
|
289 |
TInt n = aIn.Length();
|
sl@0
|
290 |
if (n > 64)
|
sl@0
|
291 |
n = 64;
|
sl@0
|
292 |
aOut.SetLength(n);
|
sl@0
|
293 |
for (i = 0; i < n; i++)
|
sl@0
|
294 |
aOut[i] = TText(aIn[i]);
|
sl@0
|
295 |
}
|
sl@0
|
296 |
|
sl@0
|
297 |
CTestFileCB::CTestFileCB() : CFileCB(), iFile(NULL), iData(NULL)
|
sl@0
|
298 |
{
|
sl@0
|
299 |
TTestDebug::Printf(_L("CTestFileCB::CTestFileCB()\n"));
|
sl@0
|
300 |
};
|
sl@0
|
301 |
|
sl@0
|
302 |
CTestFileCB::~CTestFileCB()
|
sl@0
|
303 |
{
|
sl@0
|
304 |
CTestFileCB* file = (CTestFileCB*)this;
|
sl@0
|
305 |
if (file->iFile)
|
sl@0
|
306 |
TTestDebug::Printf(_L("CTestFileCB::~CTestFileCB(%S)\n"), &file->iFile->iName);
|
sl@0
|
307 |
else
|
sl@0
|
308 |
TTestDebug::Printf(_L("CTestFileCB::~CTestFileCB()\n"));
|
sl@0
|
309 |
};
|
sl@0
|
310 |
|
sl@0
|
311 |
void CTestFileCB::RenameL(const TDesC& aNewName)
|
sl@0
|
312 |
/// Rename a file (not supported).
|
sl@0
|
313 |
{
|
sl@0
|
314 |
TTestDebug::Printf(_L("CTestFileCB::RenameL(%S)\n"), aNewName.Ptr());
|
sl@0
|
315 |
}
|
sl@0
|
316 |
|
sl@0
|
317 |
void CTestFileCB::ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage)
|
sl@0
|
318 |
/// Read from a file. This introduces a fixed delay of 1 second (by default;
|
sl@0
|
319 |
/// 10mS if KDLYFAST bit is set in the debug register), gets the data from the
|
sl@0
|
320 |
/// file area and optionally traces it.
|
sl@0
|
321 |
{
|
sl@0
|
322 |
// set up lengths
|
sl@0
|
323 |
TInt max = (aPos > iSize ? 0 : iSize - aPos);
|
sl@0
|
324 |
TInt len = (aLength > max ? max : aLength);
|
sl@0
|
325 |
// set up return data
|
sl@0
|
326 |
THMem dataBuffer(aDes, aMessage);
|
sl@0
|
327 |
dataBuffer.Write(iData+aPos, len, 0);
|
sl@0
|
328 |
aLength = len;
|
sl@0
|
329 |
/// now output traces
|
sl@0
|
330 |
TTestDebug::Printf(_L("CTestFileCB::ReadL(%4d, %4d, %.8X)\n"), aPos, aLength, aDes);
|
sl@0
|
331 |
TPtr8 pbuf(iData+aPos, len, max);
|
sl@0
|
332 |
TBuf<64> buf;
|
sl@0
|
333 |
cvtbuff(buf, pbuf);
|
sl@0
|
334 |
TTestDebug::After(DebugRegister() & KDLYFAST ? 10000 : 1000000);
|
sl@0
|
335 |
TTestDebug::Printf(_L("CTestFileCB::ReadL(%4d, %4d, %.8X=%.32S) exit\n"), aPos, aLength, aDes, &buf);
|
sl@0
|
336 |
}
|
sl@0
|
337 |
|
sl@0
|
338 |
void CTestFileCB::WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage)
|
sl@0
|
339 |
/// Write to a file. This introduces a fixed delay of 1 second (by default;
|
sl@0
|
340 |
/// 10mS if KDLYFAST bit is set in the debug register), puts the data into the
|
sl@0
|
341 |
/// file area if there is room and optionally traces it.
|
sl@0
|
342 |
{
|
sl@0
|
343 |
// Set the modified attribute (so Flush() makes its way through)
|
sl@0
|
344 |
iAtt |= KEntryAttModified;
|
sl@0
|
345 |
// set up maximum length
|
sl@0
|
346 |
TInt max = (aPos > KMaxFileLen ? 0 : KMaxFileLen - aPos);
|
sl@0
|
347 |
TInt len = (aLength > max ? max : aLength);
|
sl@0
|
348 |
TInt pos = aPos + len;
|
sl@0
|
349 |
// copy the data
|
sl@0
|
350 |
THMem dataBuffer(aDes, aMessage);
|
sl@0
|
351 |
dataBuffer.Read(iData+aPos, len, 0);
|
sl@0
|
352 |
if (pos > iSize)
|
sl@0
|
353 |
iSize = pos;
|
sl@0
|
354 |
iFile->iSize = iSize;
|
sl@0
|
355 |
aLength = len;
|
sl@0
|
356 |
// trace it
|
sl@0
|
357 |
TPtr8 pbuf(iData+aPos, len, max);
|
sl@0
|
358 |
TBuf<64> buf;
|
sl@0
|
359 |
cvtbuff(buf, pbuf);
|
sl@0
|
360 |
TTestDebug::Printf(_L("CTestFileCB::WriteL(%4d, %4d, %.8X=%.32S)\n"), aPos, aLength, aDes, &buf);
|
sl@0
|
361 |
TTestDebug::After(DebugRegister() & KDLYFAST ? 10000 : 1000000);
|
sl@0
|
362 |
TTestDebug::Printf(_L("CTestFileCB::WriteL(%4d, %4d, %.8X) exit\n"), aPos, aLength, aDes);
|
sl@0
|
363 |
}
|
sl@0
|
364 |
|
sl@0
|
365 |
TInt CTestFileCB::Address(TInt& aPos) const
|
sl@0
|
366 |
/// Does nothing.
|
sl@0
|
367 |
{
|
sl@0
|
368 |
TTestDebug::Printf(_L("CTestFileCB::Address(%d)\n"), aPos);
|
sl@0
|
369 |
return 0;
|
sl@0
|
370 |
}
|
sl@0
|
371 |
|
sl@0
|
372 |
void CTestFileCB::SetSizeL(TInt aSize)
|
sl@0
|
373 |
/// Does nothing
|
sl@0
|
374 |
{
|
sl@0
|
375 |
TTestDebug::Printf(_L("CTestFileCB::SetSizeL(%d)\n"), aSize);
|
sl@0
|
376 |
}
|
sl@0
|
377 |
|
sl@0
|
378 |
void CTestFileCB::SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask)
|
sl@0
|
379 |
/// Does nothing
|
sl@0
|
380 |
{
|
sl@0
|
381 |
TTestDebug::Printf(_L("CTestFileCB::SetEntryL(%.8X, %.8X, %.8X)\n"), aTime.Int64(), aSetAttMask, aClearAttMask);
|
sl@0
|
382 |
}
|
sl@0
|
383 |
|
sl@0
|
384 |
void CTestFileCB::FlushDataL()
|
sl@0
|
385 |
/// Flushes the file (well, actually does nothing other than introduce a fixed delay
|
sl@0
|
386 |
// of 2.5 seconds (by default; 10mS if KDLYFAST bit is set in the debug register).
|
sl@0
|
387 |
{
|
sl@0
|
388 |
TTestDebug::Printf(_L("CTestFileCB::FlushDataL()\n"));
|
sl@0
|
389 |
if(iAtt & KEntryAttModified)
|
sl@0
|
390 |
{
|
sl@0
|
391 |
iAtt &= ~KEntryAttModified;
|
sl@0
|
392 |
TTestDebug::After(3500000);
|
sl@0
|
393 |
}
|
sl@0
|
394 |
}
|
sl@0
|
395 |
|
sl@0
|
396 |
void CTestFileCB::FlushAllL()
|
sl@0
|
397 |
/// Does nothing.
|
sl@0
|
398 |
{
|
sl@0
|
399 |
TTestDebug::Printf(_L("CTestFileCB::FlushAllL()\n"));
|
sl@0
|
400 |
}
|
sl@0
|
401 |
|
sl@0
|
402 |
void CTestFileCB::CheckPos(TInt aPos)
|
sl@0
|
403 |
/// Does nothing.
|
sl@0
|
404 |
{
|
sl@0
|
405 |
TTestDebug::Printf(_L("CTestFileCB::CheckPos(%d)\n"), aPos);
|
sl@0
|
406 |
}
|
sl@0
|
407 |
|
sl@0
|
408 |
/////////////////////////////////////////////////////////////////////////////
|
sl@0
|
409 |
|
sl@0
|
410 |
CTestMountCB::CTestMountCB() : CMountCB()
|
sl@0
|
411 |
{
|
sl@0
|
412 |
TTestDebug::Printf(_L("CTestMountCB::CTestMountCB()\n"));
|
sl@0
|
413 |
iSize = KMaxFileLen;
|
sl@0
|
414 |
SetVolumeName(HBufC::NewL(0));
|
sl@0
|
415 |
};
|
sl@0
|
416 |
|
sl@0
|
417 |
CTestMountCB::~CTestMountCB()
|
sl@0
|
418 |
{
|
sl@0
|
419 |
TTestDebug::Printf(_L("CTestMountCB::~CTestMountCB()\n"));
|
sl@0
|
420 |
};
|
sl@0
|
421 |
|
sl@0
|
422 |
void CTestMountCB::MountL(TBool aForceMount)
|
sl@0
|
423 |
/// Does nothing.
|
sl@0
|
424 |
{
|
sl@0
|
425 |
if (aForceMount)
|
sl@0
|
426 |
TTestDebug::Printf(_L("CTestMountCB::MountL(forced)\n"));
|
sl@0
|
427 |
else
|
sl@0
|
428 |
TTestDebug::Printf(_L("CTestMountCB::MountL()\n"));
|
sl@0
|
429 |
}
|
sl@0
|
430 |
|
sl@0
|
431 |
TInt CTestMountCB::ReMount()
|
sl@0
|
432 |
/// Does nothing.
|
sl@0
|
433 |
{
|
sl@0
|
434 |
TTestDebug::Printf(_L("CTestMountCB::ReMount()\n"));
|
sl@0
|
435 |
return KErrNone;
|
sl@0
|
436 |
}
|
sl@0
|
437 |
|
sl@0
|
438 |
void CTestMountCB::Dismounted()
|
sl@0
|
439 |
/// Does nothing.
|
sl@0
|
440 |
{
|
sl@0
|
441 |
TTestDebug::Printf(_L("CTestMountCB::Dismounted()\n"));
|
sl@0
|
442 |
}
|
sl@0
|
443 |
|
sl@0
|
444 |
void CTestMountCB::VolumeL(TVolumeInfo& aVolume) const
|
sl@0
|
445 |
/// Gets data about the volume -- the name is fixed and the size and free
|
sl@0
|
446 |
/// space remaining are constant.
|
sl@0
|
447 |
{
|
sl@0
|
448 |
TTestDebug::Printf(_L("CTestMountCB::VolumeL()\n"));
|
sl@0
|
449 |
aVolume.iName = _L("DelayTest");
|
sl@0
|
450 |
aVolume.iSize = KMaxFileLen;
|
sl@0
|
451 |
aVolume.iFree = KMaxFileLen;
|
sl@0
|
452 |
}
|
sl@0
|
453 |
|
sl@0
|
454 |
void CTestMountCB::SetVolumeL(TDes& aName)
|
sl@0
|
455 |
/// Does nothing.
|
sl@0
|
456 |
{
|
sl@0
|
457 |
TTestDebug::Printf(_L("CTestMountCB::SetVolumeL(%S)\n"), &aName);
|
sl@0
|
458 |
}
|
sl@0
|
459 |
|
sl@0
|
460 |
void CTestMountCB::MkDirL(const TDesC& aName)
|
sl@0
|
461 |
{
|
sl@0
|
462 |
TTestDebug::Printf(_L("CTestMountCB::MkDirL(%S)\n"), &aName);
|
sl@0
|
463 |
User::Leave(KErrNotSupported);
|
sl@0
|
464 |
}
|
sl@0
|
465 |
|
sl@0
|
466 |
void CTestMountCB::RmDirL(const TDesC& aName)
|
sl@0
|
467 |
/// Does nothing.
|
sl@0
|
468 |
{
|
sl@0
|
469 |
TTestDebug::Printf(_L("CTestMountCB::RmDirL(%S)\n"), &aName);
|
sl@0
|
470 |
}
|
sl@0
|
471 |
|
sl@0
|
472 |
void CTestMountCB::DeleteL(const TDesC& aName)
|
sl@0
|
473 |
{
|
sl@0
|
474 |
TTestDebug::Printf(_L("CTestMountCB::DeleteL(%S)\n"), &aName);
|
sl@0
|
475 |
iDir.Delete(aName);
|
sl@0
|
476 |
}
|
sl@0
|
477 |
|
sl@0
|
478 |
void CTestMountCB::RenameL(const TDesC& anOldName,const TDesC& anNewName)
|
sl@0
|
479 |
/// Does nothing.
|
sl@0
|
480 |
{
|
sl@0
|
481 |
TTestDebug::Printf(_L("CTestMountCB::RenameL(%S, %S)\n"), &anOldName, &anNewName);
|
sl@0
|
482 |
}
|
sl@0
|
483 |
|
sl@0
|
484 |
void CTestMountCB::ReplaceL(const TDesC& /*anOldName*/,const TDesC& /*anNewName*/)
|
sl@0
|
485 |
/// Does nothing.
|
sl@0
|
486 |
{
|
sl@0
|
487 |
TTestDebug::Printf(_L("CTestMountCB::ReplaceL()\n"));
|
sl@0
|
488 |
}
|
sl@0
|
489 |
|
sl@0
|
490 |
void CTestMountCB::EntryL(const TDesC& aName, TEntry& aEntry) const
|
sl@0
|
491 |
/// Gets the data associated with the specified file.
|
sl@0
|
492 |
{
|
sl@0
|
493 |
const TTestFile* e = iDir.Find(aName);
|
sl@0
|
494 |
if (e)
|
sl@0
|
495 |
{
|
sl@0
|
496 |
e->Entry(aEntry);
|
sl@0
|
497 |
}
|
sl@0
|
498 |
else
|
sl@0
|
499 |
{
|
sl@0
|
500 |
aEntry.iName = _L("");
|
sl@0
|
501 |
aEntry.iAtt = 0;
|
sl@0
|
502 |
aEntry.iSize = 0;
|
sl@0
|
503 |
aEntry.iType = TUidType();
|
sl@0
|
504 |
TTestDebug::Printf(_L("CTestMountCB::EntryL(%S) leave KErrNotFound\n"), &aName);
|
sl@0
|
505 |
User::Leave(KErrNone);
|
sl@0
|
506 |
}
|
sl@0
|
507 |
TTestDebug::Printf(_L("CTestMountCB::EntryL(%S, %S)\n"), &aName, &aEntry.iName);
|
sl@0
|
508 |
}
|
sl@0
|
509 |
|
sl@0
|
510 |
void CTestMountCB::SetEntryL(const TDesC& aName, const TTime& aTime, TUint aSetAttMask, TUint aClearAttMask)
|
sl@0
|
511 |
/// Does nothing.
|
sl@0
|
512 |
{
|
sl@0
|
513 |
TTestDebug::Printf(_L("CTestMountCB::SetEntryL(%S, %.8X, %.8X, %.8X)\n"),
|
sl@0
|
514 |
&aName, aTime.Int64(), aSetAttMask, aClearAttMask);
|
sl@0
|
515 |
}
|
sl@0
|
516 |
|
sl@0
|
517 |
void CTestMountCB::FileOpenL(const TDesC& aName, TUint aMode, TFileOpen aOpen, CFileCB* aFile)
|
sl@0
|
518 |
/// Opens a file in the specified mode (the mode is ignored after this,
|
sl@0
|
519 |
/// both read and write will work with any open file). If a file is opened
|
sl@0
|
520 |
/// for writing then it will be overwritten without comment. The timestamp
|
sl@0
|
521 |
/// of the file will be set when it is opened for writing.
|
sl@0
|
522 |
/// @param aName Name of the file.
|
sl@0
|
523 |
/// @param aMode Read, write etc.
|
sl@0
|
524 |
/// @param aOpen ???
|
sl@0
|
525 |
/// @param aFile Pointer to the already allocated file descriptor area.
|
sl@0
|
526 |
{
|
sl@0
|
527 |
TTestDebug::Printf(_L("CTestMountCB::FileOpenL(%S, %.8X, %.8X, %.8X)\n"),
|
sl@0
|
528 |
&aName, aMode, aOpen, aFile);
|
sl@0
|
529 |
CTestFileCB* file = (CTestFileCB*)aFile;
|
sl@0
|
530 |
if (aMode & EFileWrite)
|
sl@0
|
531 |
{
|
sl@0
|
532 |
TTestDebug::Printf(_L("Open for writing\n"));
|
sl@0
|
533 |
file->iFile = iDir.Find(aName);
|
sl@0
|
534 |
if (!file->iFile)
|
sl@0
|
535 |
file->iFile = iDir.Create(aName);
|
sl@0
|
536 |
if (file->iFile)
|
sl@0
|
537 |
{
|
sl@0
|
538 |
TTime now;
|
sl@0
|
539 |
now.HomeTime();
|
sl@0
|
540 |
file->iFile->iTime = now.DateTime();
|
sl@0
|
541 |
file->iData = file->iFile->iData;
|
sl@0
|
542 |
}
|
sl@0
|
543 |
else
|
sl@0
|
544 |
User::Leave(KErrDiskFull);
|
sl@0
|
545 |
}
|
sl@0
|
546 |
else
|
sl@0
|
547 |
{
|
sl@0
|
548 |
TTestDebug::Printf(_L("Open for reading\n"));
|
sl@0
|
549 |
file->iFile = iDir.Find(aName);
|
sl@0
|
550 |
if (file->iFile)
|
sl@0
|
551 |
{
|
sl@0
|
552 |
file->iData = file->iFile->iData;
|
sl@0
|
553 |
aFile->SetSize(file->iFile->iSize);
|
sl@0
|
554 |
}
|
sl@0
|
555 |
else
|
sl@0
|
556 |
User::Leave(KErrNotFound);
|
sl@0
|
557 |
}
|
sl@0
|
558 |
}
|
sl@0
|
559 |
|
sl@0
|
560 |
void CTestMountCB::DirOpenL(const TDesC& aName, CDirCB* aDir)
|
sl@0
|
561 |
/// Opens the directory for reading etc.
|
sl@0
|
562 |
/// @param aName Name to look for.
|
sl@0
|
563 |
/// @param aDir Pointer to already allocated directory descriptor area.
|
sl@0
|
564 |
{
|
sl@0
|
565 |
CTestDirCB& dir = *(CTestDirCB*)aDir;
|
sl@0
|
566 |
dir.iName = aName;
|
sl@0
|
567 |
dir.iDir = &iDir;
|
sl@0
|
568 |
dir.iIndex = 0;
|
sl@0
|
569 |
TTestDebug::Printf(_L("CTestMountCB::DirOpenL(%S)\n"), &aName);
|
sl@0
|
570 |
}
|
sl@0
|
571 |
|
sl@0
|
572 |
void CTestMountCB::RawReadL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aDes*/,
|
sl@0
|
573 |
TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/) const
|
sl@0
|
574 |
/// Does nothing.
|
sl@0
|
575 |
{
|
sl@0
|
576 |
TTestDebug::Printf(_L("CTestMountCB::RawReadL()\n"));
|
sl@0
|
577 |
}
|
sl@0
|
578 |
|
sl@0
|
579 |
void CTestMountCB::RawWriteL(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aDes*/,
|
sl@0
|
580 |
TInt /*anOffset*/,const RMessagePtr2& /*aMessage*/)
|
sl@0
|
581 |
/// Does nothing.
|
sl@0
|
582 |
{
|
sl@0
|
583 |
TTestDebug::Printf(_L("CTestMountCB::RawWriteL()\n"));
|
sl@0
|
584 |
}
|
sl@0
|
585 |
|
sl@0
|
586 |
void CTestMountCB::ReadUidL(const TDesC& /*aName*/,TEntry& /*anEntry*/) const
|
sl@0
|
587 |
/// Does nothing.
|
sl@0
|
588 |
{
|
sl@0
|
589 |
TTestDebug::Printf(_L("CTestMountCB::ReadUidL()\n"));
|
sl@0
|
590 |
}
|
sl@0
|
591 |
|
sl@0
|
592 |
void CTestMountCB::GetShortNameL(const TDesC& /*aLongName*/,TDes& /*aShortName*/)
|
sl@0
|
593 |
/// Does nothing.
|
sl@0
|
594 |
{
|
sl@0
|
595 |
TTestDebug::Printf(_L("CTestMountCB::GetShortNameL()\n"));
|
sl@0
|
596 |
}
|
sl@0
|
597 |
|
sl@0
|
598 |
void CTestMountCB::GetLongNameL(const TDesC& /*aShortName*/,TDes& /*aLongName*/)
|
sl@0
|
599 |
/// Does nothing.
|
sl@0
|
600 |
{
|
sl@0
|
601 |
TTestDebug::Printf(_L("CTestMountCB::GetLongNameL()\n"));
|
sl@0
|
602 |
}
|
sl@0
|
603 |
|
sl@0
|
604 |
void CTestMountCB::IsFileInRom(const TDesC& /*aFileName*/,TUint8*& /*aFileStart*/)
|
sl@0
|
605 |
/// Does nothing.
|
sl@0
|
606 |
{
|
sl@0
|
607 |
TTestDebug::Printf(_L("CTestMountCB::IsFileInRom()\n"));
|
sl@0
|
608 |
}
|
sl@0
|
609 |
|
sl@0
|
610 |
void CTestMountCB::ReadSectionL(const TDesC& /*aName*/,TInt /*aPos*/,TAny* /*aTrg*/,
|
sl@0
|
611 |
TInt /*aLength*/,const RMessagePtr2& /*aMessage*/)
|
sl@0
|
612 |
/// Does nothing.
|
sl@0
|
613 |
{
|
sl@0
|
614 |
TTestDebug::Printf(_L("CTestMountCB::ReadSectionL()\n"));
|
sl@0
|
615 |
}
|
sl@0
|
616 |
|
sl@0
|
617 |
|
sl@0
|
618 |
//////////////////////////////////////////////////////////////
|
sl@0
|
619 |
|
sl@0
|
620 |
CTestDirCB::CTestDirCB() : CDirCB()
|
sl@0
|
621 |
{
|
sl@0
|
622 |
TTestDebug::Printf(_L("CTestDirCB::CTestDirCB()\n"));
|
sl@0
|
623 |
};
|
sl@0
|
624 |
|
sl@0
|
625 |
CTestDirCB::~CTestDirCB()
|
sl@0
|
626 |
{
|
sl@0
|
627 |
TTestDebug::Printf(_L("CTestDirCB::~CTestDirCB()\n"));
|
sl@0
|
628 |
};
|
sl@0
|
629 |
|
sl@0
|
630 |
void CTestDirCB::ReadL(TEntry& aEntry)
|
sl@0
|
631 |
/// Read a directory entry. It looks for the next entry which has
|
sl@0
|
632 |
/// a name starting with the name specified when opening the directory
|
sl@0
|
633 |
/// (this may be a pathname, for instance).
|
sl@0
|
634 |
{
|
sl@0
|
635 |
TTestFile* e = NULL;
|
sl@0
|
636 |
TInt len = iName.Length();
|
sl@0
|
637 |
while ((e = iDir->Entry(iIndex))!=0 &&
|
sl@0
|
638 |
(e->iName.Length() <= len || e->iName.Left(len) != iName))
|
sl@0
|
639 |
{
|
sl@0
|
640 |
iIndex++;
|
sl@0
|
641 |
}
|
sl@0
|
642 |
if (e)
|
sl@0
|
643 |
{
|
sl@0
|
644 |
e->Entry(aEntry);
|
sl@0
|
645 |
iIndex++;
|
sl@0
|
646 |
}
|
sl@0
|
647 |
else
|
sl@0
|
648 |
{
|
sl@0
|
649 |
aEntry.iName = _L("");
|
sl@0
|
650 |
aEntry.iAtt = 0;
|
sl@0
|
651 |
aEntry.iSize = 0;
|
sl@0
|
652 |
aEntry.iType = TUidType();
|
sl@0
|
653 |
TTestDebug::Printf(_L("CTestDirCB::ReadL() leave KErrNotFound"));
|
sl@0
|
654 |
User::Leave(KErrNone);
|
sl@0
|
655 |
}
|
sl@0
|
656 |
TTestDebug::Printf(_L("CTestDirCB::ReadL(%S)\n"), &aEntry.iName);
|
sl@0
|
657 |
}
|
sl@0
|
658 |
|
sl@0
|
659 |
|
sl@0
|
660 |
//////////////////////////////////////////////////////////////
|
sl@0
|
661 |
|
sl@0
|
662 |
CTestFormatCB::CTestFormatCB() : CFormatCB()
|
sl@0
|
663 |
{
|
sl@0
|
664 |
TTestDebug::Printf(_L("CTestFormatCB::CTestFormatCB()\n"));
|
sl@0
|
665 |
};
|
sl@0
|
666 |
|
sl@0
|
667 |
CTestFormatCB::~CTestFormatCB()
|
sl@0
|
668 |
{
|
sl@0
|
669 |
TTestDebug::Printf(_L("CTestFormatCB::~CTestFormatCB()\n"));
|
sl@0
|
670 |
};
|
sl@0
|
671 |
|
sl@0
|
672 |
void CTestFormatCB::DoFormatStepL()
|
sl@0
|
673 |
/// Does nothing.
|
sl@0
|
674 |
{
|
sl@0
|
675 |
TTestDebug::Printf(_L("CTestFormatCB::DoFormatStepL()\n"));
|
sl@0
|
676 |
}
|
sl@0
|
677 |
|
sl@0
|
678 |
//////////////////////////////////////////////////////////////
|
sl@0
|
679 |
|
sl@0
|
680 |
extern "C" {
|
sl@0
|
681 |
|
sl@0
|
682 |
EXPORT_C CFileSystem* CreateFileSystem()
|
sl@0
|
683 |
///
|
sl@0
|
684 |
/// Create a new file system.
|
sl@0
|
685 |
///
|
sl@0
|
686 |
{
|
sl@0
|
687 |
TTestDebug::Printf(_L("CreateFileSystem()\n"));
|
sl@0
|
688 |
return(CTestFileSystem::NewL());
|
sl@0
|
689 |
}
|
sl@0
|
690 |
}
|
sl@0
|
691 |
|
sl@0
|
692 |
|