Update contrib.
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 // Contains all of the delay filesystem classes.
17 //! @file f32test\concur\cfafsdly.h
19 #ifndef __CFAFSDLY_H__
20 #define __CFAFSDLY_H__
29 const TInt KMaxFiles = 10; ///< Maximum number of files in the filesystem
30 const TInt KMaxFileLen = 8192; ///< Maximum length of an individual file
33 /// Describe a file, including the data.
37 void Entry(TEntry& aEntry) const;
39 TFileName iName; ///< name of the file.
40 TUint8 iData[KMaxFileLen]; ///< data in the file (fixed maximum length).
41 TInt iSize; ///< current size of the file (length of data).
42 TTime iTime; ///< timestamp of last modification.
46 /// Holds the directory for the filesystem (there is only one!), including all
47 /// of the files with their data. Only practical for a simple test system.
51 TTestFile* Create(const TDesC& aName);
52 TTestFile* Find(const TDesC& aName);
53 const TTestFile* Find(const TDesC& aName) const;
54 void Delete(const TDesC& aName);
55 TTestFile* Entry(TInt aIndex);
57 TTestFile iFile[KMaxFiles]; ///< All of the file data.
60 class CTestMountCB : public CMountCB
61 /// Data and functions associated with a mounted filesystem. It is allocated
62 /// by the file server when the filesystem is mounted and destroyed when it is
63 /// unmounted (hence losing all of the data in files in this case).
68 void MountL(TBool aForceMount);
71 void VolumeL(TVolumeInfo& aVolume) const;
72 void SetVolumeL(TDes& aName);
73 void MkDirL(const TDesC& aName);
74 void RmDirL(const TDesC& aName);
75 void DeleteL(const TDesC& aName);
76 void RenameL(const TDesC& anOldName,const TDesC& anNewName);
77 void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
78 void EntryL(const TDesC& aName,TEntry& anEntry) const;
79 void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint learAttMask);
80 void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
81 void DirOpenL(const TDesC& aName,CDirCB* aDir);
82 void RawReadL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage) const;
83 void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage);
84 void ReadUidL(const TDesC& aName,TEntry& anEntry) const;
85 void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
86 void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
87 void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
88 void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
90 TTestDir iDir; ///< The directory information, including all files and their data.
95 class CTestFileCB : public CFileCB
96 /// Data about a specific open file.
101 void RenameL(const TDesC& aNewName);
102 void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
103 void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
104 TInt Address(TInt& aPos) const;
105 void SetSizeL(TInt aSize);
106 void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
109 void CheckPos(TInt aPos);
112 TUint8 iPadding[128]; // in case we're passed a CFATFileCB
113 TTestFile* iFile; ///< Points to the file structure of the open file.
114 TUint8* iData; ///< Points to the data area of the file.
117 class CTestDirCB : public CDirCB
118 /// Data for accessing a directory for search etc.
123 void ReadL(TEntry& anEntry);
126 TFileName iName; ///< Name of the current file.
127 TTestDir* iDir; ///< Pointer to the directory data.
128 TInt iIndex; ///< Current position in the directory.
131 class CTestFormatCB : public CFormatCB
132 /// Functions for formatting the filesystem. Not used.
137 void DoFormatStepL();
140 class CTestFileSystem : public CFileSystem
141 /// Describes the filesysem, and creates a new one when it is mounted.
147 TInt DefaultPath(TDes& aPath) const;
148 void DriveInfo(TDriveInfo& anInfo, TInt aDriveNumber) const;
149 TBusLocalDrive& DriveNumberToLocalDrive(TInt aDriveNumber);
150 TInt GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput);
152 CMountCB* NewMountL() const;
153 CFileCB* NewFileL() const;
154 CDirCB* NewDirL() const;
155 CFormatCB* NewFormatL() const;
157 static CFileSystem* NewL();