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 |
// Contains all of the delay filesystem classes.
|
sl@0
|
15 |
//
|
sl@0
|
16 |
|
sl@0
|
17 |
//! @file f32test\concur\cfafsdly.h
|
sl@0
|
18 |
|
sl@0
|
19 |
#ifndef __CFAFSDLY_H__
|
sl@0
|
20 |
#define __CFAFSDLY_H__
|
sl@0
|
21 |
|
sl@0
|
22 |
#include <f32file.h>
|
sl@0
|
23 |
#include "common.h"
|
sl@0
|
24 |
#include <f32fsys.h>
|
sl@0
|
25 |
#include <f32ver.h>
|
sl@0
|
26 |
#include <f32dbg.h>
|
sl@0
|
27 |
#include <e32svr.h>
|
sl@0
|
28 |
|
sl@0
|
29 |
const TInt KMaxFiles = 10; ///< Maximum number of files in the filesystem
|
sl@0
|
30 |
const TInt KMaxFileLen = 8192; ///< Maximum length of an individual file
|
sl@0
|
31 |
|
sl@0
|
32 |
class TTestFile
|
sl@0
|
33 |
/// Describe a file, including the data.
|
sl@0
|
34 |
{
|
sl@0
|
35 |
public:
|
sl@0
|
36 |
TTestFile();
|
sl@0
|
37 |
void Entry(TEntry& aEntry) const;
|
sl@0
|
38 |
public:
|
sl@0
|
39 |
TFileName iName; ///< name of the file.
|
sl@0
|
40 |
TUint8 iData[KMaxFileLen]; ///< data in the file (fixed maximum length).
|
sl@0
|
41 |
TInt iSize; ///< current size of the file (length of data).
|
sl@0
|
42 |
TTime iTime; ///< timestamp of last modification.
|
sl@0
|
43 |
};
|
sl@0
|
44 |
|
sl@0
|
45 |
class TTestDir
|
sl@0
|
46 |
/// Holds the directory for the filesystem (there is only one!), including all
|
sl@0
|
47 |
/// of the files with their data. Only practical for a simple test system.
|
sl@0
|
48 |
{
|
sl@0
|
49 |
public:
|
sl@0
|
50 |
TTestDir();
|
sl@0
|
51 |
TTestFile* Create(const TDesC& aName);
|
sl@0
|
52 |
TTestFile* Find(const TDesC& aName);
|
sl@0
|
53 |
const TTestFile* Find(const TDesC& aName) const;
|
sl@0
|
54 |
void Delete(const TDesC& aName);
|
sl@0
|
55 |
TTestFile* Entry(TInt aIndex);
|
sl@0
|
56 |
private:
|
sl@0
|
57 |
TTestFile iFile[KMaxFiles]; ///< All of the file data.
|
sl@0
|
58 |
};
|
sl@0
|
59 |
|
sl@0
|
60 |
class CTestMountCB : public CMountCB
|
sl@0
|
61 |
/// Data and functions associated with a mounted filesystem. It is allocated
|
sl@0
|
62 |
/// by the file server when the filesystem is mounted and destroyed when it is
|
sl@0
|
63 |
/// unmounted (hence losing all of the data in files in this case).
|
sl@0
|
64 |
{
|
sl@0
|
65 |
public:
|
sl@0
|
66 |
CTestMountCB();
|
sl@0
|
67 |
~CTestMountCB();
|
sl@0
|
68 |
void MountL(TBool aForceMount);
|
sl@0
|
69 |
TInt ReMount();
|
sl@0
|
70 |
void Dismounted();
|
sl@0
|
71 |
void VolumeL(TVolumeInfo& aVolume) const;
|
sl@0
|
72 |
void SetVolumeL(TDes& aName);
|
sl@0
|
73 |
void MkDirL(const TDesC& aName);
|
sl@0
|
74 |
void RmDirL(const TDesC& aName);
|
sl@0
|
75 |
void DeleteL(const TDesC& aName);
|
sl@0
|
76 |
void RenameL(const TDesC& anOldName,const TDesC& anNewName);
|
sl@0
|
77 |
void ReplaceL(const TDesC& anOldName,const TDesC& anNewName);
|
sl@0
|
78 |
void EntryL(const TDesC& aName,TEntry& anEntry) const;
|
sl@0
|
79 |
void SetEntryL(const TDesC& aName,const TTime& aTime,TUint aSetAttMask,TUint learAttMask);
|
sl@0
|
80 |
void FileOpenL(const TDesC& aName,TUint aMode,TFileOpen anOpen,CFileCB* aFile);
|
sl@0
|
81 |
void DirOpenL(const TDesC& aName,CDirCB* aDir);
|
sl@0
|
82 |
void RawReadL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage) const;
|
sl@0
|
83 |
void RawWriteL(TInt64 aPos,TInt aLength,const TAny* aDes,TInt anOffset,const RMessagePtr2& aMessage);
|
sl@0
|
84 |
void ReadUidL(const TDesC& aName,TEntry& anEntry) const;
|
sl@0
|
85 |
void GetShortNameL(const TDesC& aLongName,TDes& aShortName);
|
sl@0
|
86 |
void GetLongNameL(const TDesC& aShortName,TDes& aLongName);
|
sl@0
|
87 |
void IsFileInRom(const TDesC& aFileName,TUint8*& aFileStart);
|
sl@0
|
88 |
void ReadSectionL(const TDesC& aName,TInt aPos,TAny* aTrg,TInt aLength,const RMessagePtr2& aMessage);
|
sl@0
|
89 |
private:
|
sl@0
|
90 |
TTestDir iDir; ///< The directory information, including all files and their data.
|
sl@0
|
91 |
};
|
sl@0
|
92 |
|
sl@0
|
93 |
|
sl@0
|
94 |
|
sl@0
|
95 |
class CTestFileCB : public CFileCB
|
sl@0
|
96 |
/// Data about a specific open file.
|
sl@0
|
97 |
{
|
sl@0
|
98 |
public:
|
sl@0
|
99 |
CTestFileCB();
|
sl@0
|
100 |
~CTestFileCB();
|
sl@0
|
101 |
void RenameL(const TDesC& aNewName);
|
sl@0
|
102 |
void ReadL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
|
sl@0
|
103 |
void WriteL(TInt aPos,TInt& aLength,const TAny* aDes,const RMessagePtr2& aMessage);
|
sl@0
|
104 |
TInt Address(TInt& aPos) const;
|
sl@0
|
105 |
void SetSizeL(TInt aSize);
|
sl@0
|
106 |
void SetEntryL(const TTime& aTime,TUint aSetAttMask,TUint aClearAttMask);
|
sl@0
|
107 |
void FlushDataL();
|
sl@0
|
108 |
void FlushAllL();
|
sl@0
|
109 |
void CheckPos(TInt aPos);
|
sl@0
|
110 |
|
sl@0
|
111 |
public:
|
sl@0
|
112 |
TUint8 iPadding[128]; // in case we're passed a CFATFileCB
|
sl@0
|
113 |
TTestFile* iFile; ///< Points to the file structure of the open file.
|
sl@0
|
114 |
TUint8* iData; ///< Points to the data area of the file.
|
sl@0
|
115 |
};
|
sl@0
|
116 |
|
sl@0
|
117 |
class CTestDirCB : public CDirCB
|
sl@0
|
118 |
/// Data for accessing a directory for search etc.
|
sl@0
|
119 |
{
|
sl@0
|
120 |
public:
|
sl@0
|
121 |
CTestDirCB();
|
sl@0
|
122 |
~CTestDirCB();
|
sl@0
|
123 |
void ReadL(TEntry& anEntry);
|
sl@0
|
124 |
|
sl@0
|
125 |
public:
|
sl@0
|
126 |
TFileName iName; ///< Name of the current file.
|
sl@0
|
127 |
TTestDir* iDir; ///< Pointer to the directory data.
|
sl@0
|
128 |
TInt iIndex; ///< Current position in the directory.
|
sl@0
|
129 |
};
|
sl@0
|
130 |
|
sl@0
|
131 |
class CTestFormatCB : public CFormatCB
|
sl@0
|
132 |
/// Functions for formatting the filesystem. Not used.
|
sl@0
|
133 |
{
|
sl@0
|
134 |
public:
|
sl@0
|
135 |
CTestFormatCB();
|
sl@0
|
136 |
~CTestFormatCB();
|
sl@0
|
137 |
void DoFormatStepL();
|
sl@0
|
138 |
};
|
sl@0
|
139 |
|
sl@0
|
140 |
class CTestFileSystem : public CFileSystem
|
sl@0
|
141 |
/// Describes the filesysem, and creates a new one when it is mounted.
|
sl@0
|
142 |
{
|
sl@0
|
143 |
public:
|
sl@0
|
144 |
CTestFileSystem();
|
sl@0
|
145 |
~CTestFileSystem();
|
sl@0
|
146 |
TInt Install();
|
sl@0
|
147 |
TInt DefaultPath(TDes& aPath) const;
|
sl@0
|
148 |
void DriveInfo(TDriveInfo& anInfo, TInt aDriveNumber) const;
|
sl@0
|
149 |
TBusLocalDrive& DriveNumberToLocalDrive(TInt aDriveNumber);
|
sl@0
|
150 |
TInt GetInterface(TInt aInterfaceId, TAny*& aInterface,TAny* aInput);
|
sl@0
|
151 |
private:
|
sl@0
|
152 |
CMountCB* NewMountL() const;
|
sl@0
|
153 |
CFileCB* NewFileL() const;
|
sl@0
|
154 |
CDirCB* NewDirL() const;
|
sl@0
|
155 |
CFormatCB* NewFormatL() const;
|
sl@0
|
156 |
public:
|
sl@0
|
157 |
static CFileSystem* NewL();
|
sl@0
|
158 |
};
|
sl@0
|
159 |
|
sl@0
|
160 |
#endif
|