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