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 |
// f32test\ext\emptyext.cpp
|
sl@0
|
15 |
// extension which simply records/prints out accesses to each function
|
sl@0
|
16 |
//
|
sl@0
|
17 |
//
|
sl@0
|
18 |
|
sl@0
|
19 |
#include <f32fsys.h>
|
sl@0
|
20 |
|
sl@0
|
21 |
|
sl@0
|
22 |
class CEmptyExtProxyDrive : public CBaseExtProxyDrive
|
sl@0
|
23 |
{
|
sl@0
|
24 |
public:
|
sl@0
|
25 |
static CEmptyExtProxyDrive* NewL(CProxyDrive* aProxyDrive, CMountCB* aMount);
|
sl@0
|
26 |
~CEmptyExtProxyDrive();
|
sl@0
|
27 |
public:
|
sl@0
|
28 |
virtual TInt Initialise();
|
sl@0
|
29 |
virtual TInt Dismounted();
|
sl@0
|
30 |
virtual TInt Enlarge(TInt aLength);
|
sl@0
|
31 |
virtual TInt ReduceSize(TInt aPos, TInt aLength);
|
sl@0
|
32 |
virtual TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset);
|
sl@0
|
33 |
virtual TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg);
|
sl@0
|
34 |
virtual TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset);
|
sl@0
|
35 |
virtual TInt Write(TInt64 aPos,const TDesC8& aSrc);
|
sl@0
|
36 |
virtual TInt Caps(TDes8& anInfo);
|
sl@0
|
37 |
virtual TInt Format(TFormatInfo& anInfo);
|
sl@0
|
38 |
private:
|
sl@0
|
39 |
CEmptyExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount);
|
sl@0
|
40 |
private:
|
sl@0
|
41 |
TInt iInitialise;
|
sl@0
|
42 |
TInt iDismounted;
|
sl@0
|
43 |
TInt iEnlarge;
|
sl@0
|
44 |
TInt iReduceSize;
|
sl@0
|
45 |
TInt iReadThread;
|
sl@0
|
46 |
TInt iRead;
|
sl@0
|
47 |
TInt iWriteThread;
|
sl@0
|
48 |
TInt iWrite;
|
sl@0
|
49 |
TInt iCaps;
|
sl@0
|
50 |
TInt iFormat;
|
sl@0
|
51 |
};
|
sl@0
|
52 |
|
sl@0
|
53 |
class CEmptyProxyDriveFactory : public CProxyDriveFactory
|
sl@0
|
54 |
{
|
sl@0
|
55 |
public:
|
sl@0
|
56 |
CEmptyProxyDriveFactory();
|
sl@0
|
57 |
virtual TInt Install();
|
sl@0
|
58 |
virtual CProxyDrive* NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount);
|
sl@0
|
59 |
};
|
sl@0
|
60 |
|
sl@0
|
61 |
CEmptyExtProxyDrive* CEmptyExtProxyDrive::NewL(CProxyDrive* aProxyDrive, CMountCB* aMount)
|
sl@0
|
62 |
//
|
sl@0
|
63 |
//
|
sl@0
|
64 |
//
|
sl@0
|
65 |
{
|
sl@0
|
66 |
CEmptyExtProxyDrive* temp=new(ELeave) CEmptyExtProxyDrive(aProxyDrive,aMount);
|
sl@0
|
67 |
return(temp);
|
sl@0
|
68 |
}
|
sl@0
|
69 |
|
sl@0
|
70 |
|
sl@0
|
71 |
CEmptyExtProxyDrive::CEmptyExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount):CBaseExtProxyDrive(aProxyDrive,aMount)
|
sl@0
|
72 |
{
|
sl@0
|
73 |
RDebug::Print(_L("CEmptyExtProxyDrive::CEmptyExtProxyDrive"));
|
sl@0
|
74 |
}
|
sl@0
|
75 |
|
sl@0
|
76 |
CEmptyExtProxyDrive::~CEmptyExtProxyDrive()
|
sl@0
|
77 |
//
|
sl@0
|
78 |
//
|
sl@0
|
79 |
//
|
sl@0
|
80 |
{
|
sl@0
|
81 |
// print out the figures obtained
|
sl@0
|
82 |
RDebug::Print(_L("Initialise = %d"),iInitialise);
|
sl@0
|
83 |
RDebug::Print(_L("Dismounted = %d"),iDismounted);
|
sl@0
|
84 |
RDebug::Print(_L("Enlarge = %d"),iEnlarge);
|
sl@0
|
85 |
RDebug::Print(_L("ReduceSize = %d"),iReduceSize);
|
sl@0
|
86 |
RDebug::Print(_L("Read Thread = %d"),iReadThread);
|
sl@0
|
87 |
RDebug::Print(_L("Read = %d"),iRead);
|
sl@0
|
88 |
RDebug::Print(_L("Write Thread = %d"),iWriteThread);
|
sl@0
|
89 |
RDebug::Print(_L("Write = %d"),iWrite);
|
sl@0
|
90 |
RDebug::Print(_L("Format = %d"),iFormat);
|
sl@0
|
91 |
}
|
sl@0
|
92 |
|
sl@0
|
93 |
TInt CEmptyExtProxyDrive::Initialise()
|
sl@0
|
94 |
//
|
sl@0
|
95 |
//
|
sl@0
|
96 |
//
|
sl@0
|
97 |
{
|
sl@0
|
98 |
RDebug::Print(_L("CEmptyExtProxyDrive::Initialise()"));
|
sl@0
|
99 |
++iInitialise;
|
sl@0
|
100 |
return(CBaseExtProxyDrive::Initialise());
|
sl@0
|
101 |
}
|
sl@0
|
102 |
|
sl@0
|
103 |
TInt CEmptyExtProxyDrive::Dismounted()
|
sl@0
|
104 |
//
|
sl@0
|
105 |
//
|
sl@0
|
106 |
//
|
sl@0
|
107 |
{
|
sl@0
|
108 |
RDebug::Print(_L("CEmptyExtProxyDrive::Dismounted()"));
|
sl@0
|
109 |
++iDismounted;
|
sl@0
|
110 |
return(CBaseExtProxyDrive::Dismounted());
|
sl@0
|
111 |
}
|
sl@0
|
112 |
|
sl@0
|
113 |
TInt CEmptyExtProxyDrive::Enlarge(TInt aLength)
|
sl@0
|
114 |
//
|
sl@0
|
115 |
//
|
sl@0
|
116 |
//
|
sl@0
|
117 |
{
|
sl@0
|
118 |
++iEnlarge;
|
sl@0
|
119 |
return(CBaseExtProxyDrive::Enlarge(aLength));
|
sl@0
|
120 |
}
|
sl@0
|
121 |
|
sl@0
|
122 |
|
sl@0
|
123 |
TInt CEmptyExtProxyDrive::ReduceSize(TInt aPos, TInt aLength)
|
sl@0
|
124 |
//
|
sl@0
|
125 |
//
|
sl@0
|
126 |
//
|
sl@0
|
127 |
{
|
sl@0
|
128 |
++iReduceSize;
|
sl@0
|
129 |
return(CBaseExtProxyDrive::ReduceSize(aPos,aLength));
|
sl@0
|
130 |
}
|
sl@0
|
131 |
|
sl@0
|
132 |
TInt CEmptyExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)
|
sl@0
|
133 |
//
|
sl@0
|
134 |
//
|
sl@0
|
135 |
//
|
sl@0
|
136 |
{
|
sl@0
|
137 |
++iReadThread;
|
sl@0
|
138 |
return(CBaseExtProxyDrive::Read(aPos,aLength,aTrg,aThreadHandle,anOffset));
|
sl@0
|
139 |
}
|
sl@0
|
140 |
|
sl@0
|
141 |
TInt CEmptyExtProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg)
|
sl@0
|
142 |
//
|
sl@0
|
143 |
//
|
sl@0
|
144 |
//
|
sl@0
|
145 |
{
|
sl@0
|
146 |
++iRead;
|
sl@0
|
147 |
return(CBaseExtProxyDrive::Read(aPos,aLength,aTrg));
|
sl@0
|
148 |
}
|
sl@0
|
149 |
|
sl@0
|
150 |
TInt CEmptyExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)
|
sl@0
|
151 |
//
|
sl@0
|
152 |
//
|
sl@0
|
153 |
//
|
sl@0
|
154 |
{
|
sl@0
|
155 |
++iWriteThread;
|
sl@0
|
156 |
return(CBaseExtProxyDrive::Write(aPos,aLength,aSrc,aThreadHandle,anOffset));
|
sl@0
|
157 |
}
|
sl@0
|
158 |
|
sl@0
|
159 |
TInt CEmptyExtProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
|
sl@0
|
160 |
//
|
sl@0
|
161 |
//
|
sl@0
|
162 |
//
|
sl@0
|
163 |
{
|
sl@0
|
164 |
++iWrite;
|
sl@0
|
165 |
return(CBaseExtProxyDrive::Write(aPos,aSrc));
|
sl@0
|
166 |
}
|
sl@0
|
167 |
|
sl@0
|
168 |
TInt CEmptyExtProxyDrive::Caps(TDes8& anInfo)
|
sl@0
|
169 |
//
|
sl@0
|
170 |
//
|
sl@0
|
171 |
//
|
sl@0
|
172 |
{
|
sl@0
|
173 |
++iCaps;
|
sl@0
|
174 |
return(CBaseExtProxyDrive::Caps(anInfo));
|
sl@0
|
175 |
}
|
sl@0
|
176 |
|
sl@0
|
177 |
TInt CEmptyExtProxyDrive::Format(TFormatInfo& anInfo)
|
sl@0
|
178 |
//
|
sl@0
|
179 |
//
|
sl@0
|
180 |
//
|
sl@0
|
181 |
{
|
sl@0
|
182 |
++iFormat;
|
sl@0
|
183 |
return(CBaseExtProxyDrive::Format(anInfo));
|
sl@0
|
184 |
}
|
sl@0
|
185 |
|
sl@0
|
186 |
|
sl@0
|
187 |
CEmptyProxyDriveFactory::CEmptyProxyDriveFactory()
|
sl@0
|
188 |
//
|
sl@0
|
189 |
//
|
sl@0
|
190 |
//
|
sl@0
|
191 |
{
|
sl@0
|
192 |
RDebug::Print(_L("CEmptyProxyDriveFactory::CEmptyProxyDriveFactory"));
|
sl@0
|
193 |
}
|
sl@0
|
194 |
|
sl@0
|
195 |
TInt CEmptyProxyDriveFactory::Install()
|
sl@0
|
196 |
//
|
sl@0
|
197 |
//
|
sl@0
|
198 |
//
|
sl@0
|
199 |
{
|
sl@0
|
200 |
_LIT(KEmptyName,"Empty");
|
sl@0
|
201 |
return(SetName(&KEmptyName));
|
sl@0
|
202 |
}
|
sl@0
|
203 |
|
sl@0
|
204 |
CProxyDrive* CEmptyProxyDriveFactory::NewProxyDriveL(CProxyDrive* aProxy,CMountCB* aMount)
|
sl@0
|
205 |
//
|
sl@0
|
206 |
//
|
sl@0
|
207 |
//
|
sl@0
|
208 |
{
|
sl@0
|
209 |
return(CEmptyExtProxyDrive::NewL(aProxy,aMount));
|
sl@0
|
210 |
}
|
sl@0
|
211 |
|
sl@0
|
212 |
extern "C" {
|
sl@0
|
213 |
|
sl@0
|
214 |
EXPORT_C CProxyDriveFactory* CreateFileSystem()
|
sl@0
|
215 |
//
|
sl@0
|
216 |
// Create a new file system
|
sl@0
|
217 |
//
|
sl@0
|
218 |
{
|
sl@0
|
219 |
return(new CEmptyProxyDriveFactory());
|
sl@0
|
220 |
}
|
sl@0
|
221 |
}
|
sl@0
|
222 |
|
sl@0
|
223 |
|