author | Pat Downey <patd@symbian.org> |
Wed, 01 Sep 2010 12:34:56 +0100 | |
branch | RCL_3 |
changeset 44 | 3e88ff8f41d5 |
parent 43 | c1f20ce4abcf |
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 |
// f32\sfile\sf_ext.cpp |
|
15 |
// |
|
16 |
// |
|
17 |
||
44 | 18 |
|
0 | 19 |
#include "sf_std.h" |
44 | 20 |
|
0 | 21 |
typedef CProxyDriveFactory*(*TExtensionNew)(); |
22 |
typedef CExtProxyDriveFactory*(*TProxyDriveNew)(); |
|
23 |
||
24 |
||
25 |
/** |
|
26 |
Constructor. |
|
27 |
||
28 |
Initialises drive extension count to zero. |
|
29 |
*/ |
|
30 |
TDriveExtInfo::TDriveExtInfo(){iCount=0;} |
|
31 |
||
32 |
||
33 |
/** |
|
34 |
Constructor. |
|
35 |
||
36 |
Note that the class is intended only as an abstract base for other classes. |
|
37 |
||
38 |
@panic FSERV 51 if the supplied CMountCB pointer is NULL. |
|
39 |
*/ |
|
40 |
CProxyDrive::CProxyDrive(CMountCB* aMount) |
|
41 |
:iMount(aMount) |
|
42 |
{ |
|
43 |
// __ASSERT_DEBUG(iMount!=NULL,Fault(EProxyDriveConstruction)); |
|
44 |
} |
|
45 |
||
46 |
||
47 |
/** |
|
48 |
Destructor. |
|
49 |
||
50 |
Frees resources before destruction of the object. |
|
51 |
*/ |
|
52 |
CProxyDrive::~CProxyDrive() |
|
53 |
{ |
|
41
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
54 |
delete iBody; |
0 | 55 |
} |
56 |
||
57 |
||
58 |
/** |
|
59 |
An interface with which control commands can be passed to |
|
60 |
the appropriate driver layer. |
|
61 |
||
62 |
This base implementation performs no operations. |
|
63 |
||
64 |
@param aMessage Message to be sent. |
|
65 |
@param aCommand Command type. |
|
66 |
@param aParam1 1st parameter of control message. |
|
67 |
@param aParam2 2nd parameter of control message. |
|
68 |
||
69 |
@return KErrNone |
|
70 |
*/ |
|
71 |
EXPORT_C TInt CProxyDrive::ControlIO(const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/) |
|
72 |
// |
|
73 |
// General purpose function for use by specific file systems and extensions |
|
74 |
// |
|
75 |
{ |
|
76 |
return(KErrNone); |
|
77 |
} |
|
78 |
||
79 |
/** |
|
80 |
General purpose read function for use by specific file systems and extensions. |
|
81 |
||
82 |
This base implementation performs no operations. |
|
83 |
||
84 |
@param aPos The address from where the read begins. |
|
85 |
@param aLength The length of the read. |
|
86 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
87 |
@param aThreadHandle The handle-number representing the drive thread. |
|
88 |
@param aOffset Offset into aTrg to read the data from. |
|
89 |
@param aFlags Flags to be passed into the driver. |
|
90 |
||
91 |
@return KErrNone |
|
92 |
*/ |
|
93 |
EXPORT_C TInt CProxyDrive::Read(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aTrg*/,TInt /*aThreadHandle*/,TInt /*aOffset*/, TInt /*aFlags*/) |
|
94 |
{ |
|
95 |
return(KErrNone); |
|
96 |
} |
|
97 |
||
98 |
/** |
|
99 |
General purpose write function for use by specific file systems and extensions. |
|
100 |
||
101 |
This base implementation performs no operations. |
|
102 |
||
103 |
@param aPos The address from where the write begins. |
|
104 |
@param aLength The length of the write. |
|
105 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
106 |
@param aThreadHandle The handle-number representing the drive thread. |
|
107 |
@param aOffset Offset into aSrc to write the data to. |
|
108 |
@param aFlags Flags to be passed into the driver. |
|
109 |
||
110 |
@return KErrNone |
|
111 |
*/ |
|
112 |
EXPORT_C TInt CProxyDrive::Write(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aSrc*/,TInt /*aThreadHandle*/,TInt /*aOffset*/, TInt /*aFlags*/) |
|
113 |
{ |
|
114 |
return(KErrNone); |
|
115 |
} |
|
116 |
||
117 |
||
118 |
/** |
|
119 |
Issue a notification that a physical delete has occurred. |
|
120 |
For example a cluster or partition has been freed. |
|
121 |
||
122 |
This base implementation performs no operations. |
|
123 |
||
124 |
@param aPos The position of the data which is being deleted. |
|
125 |
@param aLength The length of the data which is being deleted. |
|
126 |
||
127 |
@return KErrNone |
|
128 |
*/ |
|
129 |
EXPORT_C TInt CProxyDrive::DeleteNotify(TInt64 /*aPos*/, TInt /*aLength*/) |
|
130 |
{ |
|
131 |
return(KErrNone); |
|
132 |
} |
|
133 |
||
134 |
/** |
|
135 |
An interface with which information can be retrieved about disk errors. |
|
136 |
||
137 |
This base implementation performs no operations. |
|
138 |
||
139 |
@param aErrorInfo Reference to a descriptor containing disk error information. |
|
140 |
||
141 |
@return KErrNone |
|
142 |
*/ |
|
143 |
EXPORT_C TInt CProxyDrive::GetLastErrorInfo(TDes8& /*aErrorInfo*/) |
|
144 |
{ |
|
145 |
return(KErrNotSupported); |
|
146 |
} |
|
147 |
||
148 |
EXPORT_C TInt CProxyDrive::GetLocalDrive(TBusLocalDrive*& aLocDrv) |
|
149 |
{ |
|
150 |
return (GetInterface(EGetLocalDrive, (TAny*&)aLocDrv, (TAny*)this)); // this GetInterface does the dirty work for you... |
|
151 |
} |
|
152 |
||
153 |
EXPORT_C TInt CProxyDrive::Finalise(TBool aIsFinalised) |
|
154 |
{ |
|
155 |
TAny* dummyInterface; |
|
156 |
return (GetInterface(EFinalised, dummyInterface, (TAny*)aIsFinalised)); |
|
157 |
} |
|
158 |
||
159 |
||
160 |
/** |
|
161 |
Called to get a Proxy drive interface. |
|
162 |
||
163 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
164 |
@param aInterface Address of variable that retrieves the specified interface. |
|
165 |
@param aInput Data required for the instantiation of the interface. |
|
166 |
||
167 |
This base implementation performs no operations. |
|
168 |
||
169 |
@return KErrNotSupported |
|
170 |
*/ |
|
171 |
EXPORT_C TInt CProxyDrive::GetInterface(TInt /*aInterfaceId*/,TAny*& /*aInterface*/,TAny* /*aInput*/) |
|
172 |
{ |
|
173 |
return(KErrNotSupported); |
|
174 |
} |
|
175 |
||
176 |
||
41
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
177 |
TInt CProxyDrive::SetAndOpenLibrary(RLibrary aLibrary) |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
178 |
{ |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
179 |
TInt r = KErrNone; |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
180 |
if (iBody) |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
181 |
{ |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
182 |
iBody->iLibrary = aLibrary; |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
183 |
r = iBody->iLibrary.Duplicate(RThread(), EOwnerProcess); |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
184 |
} |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
185 |
return r; |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
186 |
} |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
187 |
|
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
188 |
/** |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
189 |
Gets a copy of the Proxy Drive library (previously opened by OpenLibrary()) prior to deleting the proxy drive itself. |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
190 |
After deleting the proxy drive, RLibrary::Close() should be called on the returned RLibrary object. |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
191 |
*/ |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
192 |
RLibrary CProxyDrive::GetLibrary() |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
193 |
{ |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
194 |
RLibrary lib; |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
195 |
if (iBody) |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
196 |
{ |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
197 |
lib = iBody->iLibrary; |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
198 |
iBody->iLibrary.SetHandle(NULL); |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
199 |
} |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
200 |
return lib; |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
201 |
} |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
202 |
|
0 | 203 |
/** |
204 |
Constructor. |
|
205 |
*/ |
|
206 |
EXPORT_C CLocDrvMountCB::CLocDrvMountCB() {} |
|
207 |
||
208 |
||
209 |
/** |
|
210 |
Destructor. |
|
211 |
||
212 |
Frees assigned Proxy drive before destruction of the object. |
|
213 |
*/ |
|
214 |
EXPORT_C CLocDrvMountCB::~CLocDrvMountCB() |
|
215 |
{ |
|
216 |
__PRINT1(_L("CLocDrvMountCB::~CLocDrvMountCB() 0x%x"),this); |
|
36
bbf8bed59bcb
Revision: 201023
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
22
diff
changeset
|
217 |
if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber())) |
41
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
218 |
{ |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
219 |
RLibrary lib = iProxyDrive->GetLibrary(); |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
220 |
delete iProxyDrive; |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
221 |
lib.Close(); |
0ffb4e86fcc9
Revision: 201027
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
36
diff
changeset
|
222 |
} |
0 | 223 |
} |
224 |
||
225 |
||
226 |
/** |
|
227 |
Creates and initialises the local drive. |
|
228 |
||
229 |
@param aLocDrv The local drive to be created |
|
230 |
||
231 |
@return System wide error code. |
|
232 |
*/ |
|
233 |
EXPORT_C TInt CLocDrvMountCB::CreateLocalDrive(TBusLocalDrive& aLocDrv) |
|
234 |
{ |
|
235 |
__PRINT(_L("CLocDrvMountCB::CreateLocalDrive()")); |
|
236 |
if(iProxyDrive!=NULL) |
|
237 |
return(KErrNone); |
|
238 |
TInt r; |
|
239 |
CProxyDrive* pConcrete=CLocalProxyDrive::New(this,aLocDrv); |
|
240 |
if(pConcrete==NULL) |
|
241 |
{ |
|
242 |
r=KErrNoMemory; |
|
243 |
} |
|
244 |
else |
|
245 |
{ |
|
246 |
// if failure then pConcrete will be deleted by CreateProxyDriveL() |
|
247 |
TRAP(r,iProxyDrive=CreateProxyDriveL(pConcrete,this)); |
|
248 |
} |
|
249 |
if(r==KErrNone) |
|
250 |
r=InitLocalDrive(); |
|
251 |
__PRINT1(_L("CreateLocalDrive r=%d"),r); |
|
252 |
return(r); |
|
253 |
} |
|
254 |
||
255 |
EXPORT_C TInt CLocDrvMountCB::CreateDrive(TInt aDriveNumber) |
|
256 |
/** Create drive |
|
257 |
Ascertain if the drive is mapped to a local drive or a proxy drive, and create the drive |
|
258 |
as appropriate |
|
22
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
259 |
@param aDriveNumber drive number |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
260 |
@return KErrNone on success |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
261 |
KErrArgument if the drive is not mapped to a proxy or a local drive or if the number |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
262 |
is invalid |
0 | 263 |
*/ |
264 |
{ |
|
265 |
// dunno why we are using TInts instead of TUints here |
|
22
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
266 |
__PRINT(_L("CLocDrvMountCB::CreateDrive()")); |
0 | 267 |
|
268 |
if (aDriveNumber<0 || aDriveNumber>=KMaxDrives) return KErrArgument; |
|
269 |
TInt r = KErrNone; |
|
270 |
TInt aDriveLocal = LocalDrives::DriveNumberToLocalDriveNumber(aDriveNumber); |
|
271 |
if (aDriveLocal == KDriveInvalid) return KErrArgument; |
|
272 |
if (aDriveLocal < KMaxLocalDrives) |
|
273 |
{ |
|
274 |
return CreateLocalDrive(LocalDrives::GetLocalDrive(aDriveNumber)); // drive is really local |
|
275 |
} |
|
276 |
else |
|
277 |
{ |
|
278 |
CExtProxyDrive* pProxyDrive = LocalDrives::GetProxyDrive(aDriveNumber); |
|
22
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
279 |
__ASSERT_ALWAYS(pProxyDrive != NULL,User::Panic(_L("CreateDrive() - pProxyDrive == NULL"), -999)); |
0 | 280 |
|
22
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
281 |
TRAP(r, iProxyDrive = CreateProxyDriveL(pProxyDrive,this)); |
2f92ad2dc5db
Revision: 201013
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
282 |
__ASSERT_ALWAYS(r == KErrNone,User::Panic(_L("CreateDrive() - CreateProxyDriveL error"), -999)); |
0 | 283 |
|
284 |
r = InitLocalDrive(); |
|
285 |
} |
|
286 |
||
287 |
return r; |
|
288 |
} |
|
289 |
||
290 |
||
291 |
/** |
|
292 |
Initialise the local drive |
|
293 |
||
294 |
@panic FSERV 52 if initialise when no local drive exists. |
|
295 |
||
296 |
@return system wide error code |
|
297 |
*/ |
|
298 |
EXPORT_C TInt CLocDrvMountCB::InitLocalDrive() |
|
299 |
{ |
|
300 |
__ASSERT_ALWAYS(iProxyDrive!=NULL,Fault(ELocDrvInitLocalDrive)); |
|
301 |
iProxyDrive->SetMount(this); |
|
302 |
return(iProxyDrive->Initialise()); |
|
303 |
} |
|
304 |
||
305 |
/** |
|
306 |
Dismount the local drive |
|
307 |
||
308 |
@panic FSERV 53 if dismount when no local drive exists. |
|
309 |
*/ |
|
310 |
EXPORT_C void CLocDrvMountCB::DismountedLocalDrive() |
|
311 |
{ |
|
312 |
__ASSERT_ALWAYS(iProxyDrive!=NULL,Fault(ELocDrvDismountedLocalDrive)); |
|
313 |
iProxyDrive->Dismounted(); |
|
314 |
} |
|
315 |
||
316 |
||
317 |
/** |
|
318 |
static constructor. |
|
319 |
||
320 |
Instatiates a CLocalProxyDrive objects with the given arguments. |
|
321 |
||
322 |
@param aMount The mount control block |
|
323 |
@param aLocDrv The local drive. |
|
324 |
||
325 |
@return pointer to instantiated CLocalProxyDrive object. |
|
326 |
*/ |
|
327 |
CLocalProxyDrive* CLocalProxyDrive::New(CMountCB* aMount,TBusLocalDrive& aLocDrv) |
|
328 |
{ |
|
44 | 329 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveNew, EF32TraceUidProxyDrive, |
330 |
aMount, aMount->DriveNumber()); |
|
331 |
||
0 | 332 |
CLocalProxyDrive* proxyDrive = new CLocalProxyDrive(aMount,aLocDrv); |
333 |
||
44 | 334 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveNewRet, EF32TraceUidProxyDrive, proxyDrive); |
0 | 335 |
return proxyDrive; |
336 |
} |
|
337 |
||
338 |
/** |
|
339 |
Constructor. |
|
340 |
||
341 |
@param aMount The mount control block. |
|
342 |
@param aLocDrv The local drive. |
|
343 |
*/ |
|
344 |
CLocalProxyDrive::CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv) |
|
345 |
:CProxyDrive(aMount),iLocDrv(aLocDrv) |
|
346 |
{ |
|
347 |
__PRINT(_L("CLocalProxyDrive::CLocalProxyDrive()")); |
|
348 |
} |
|
349 |
||
350 |
||
351 |
/** |
|
352 |
Initialise the connected drive. |
|
353 |
||
354 |
This implementation performs no operations. |
|
355 |
||
356 |
@return KErrNone. |
|
357 |
*/ |
|
358 |
TInt CLocalProxyDrive::Initialise() |
|
359 |
{ |
|
44 | 360 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveInitialise, EF32TraceUidProxyDrive, this); |
361 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveInitialiseRet, EF32TraceUidProxyDrive, KErrNone); |
|
362 |
||
0 | 363 |
return(KErrNone); |
364 |
} |
|
365 |
||
366 |
||
367 |
/** |
|
368 |
Ensures any cached data is flushed before unmounting drive. |
|
369 |
||
370 |
This implementation performs no operations. |
|
371 |
||
372 |
@return KErrNone. |
|
373 |
*/ |
|
374 |
TInt CLocalProxyDrive::Dismounted() |
|
375 |
{ |
|
44 | 376 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDismounted, EF32TraceUidProxyDrive, this); |
377 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDismountedRet, EF32TraceUidProxyDrive, KErrNone); |
|
378 |
||
0 | 379 |
return(KErrNone); |
380 |
} |
|
381 |
||
382 |
||
383 |
/** |
|
384 |
Increase the size of the connected drive by the specified length (in bytes). |
|
385 |
||
386 |
@param aLength The length/size (in bytes) by which the drive is to be increased. |
|
387 |
||
388 |
@return system wide error code. |
|
389 |
*/ |
|
390 |
TInt CLocalProxyDrive::Enlarge(TInt aLength) |
|
391 |
{ |
|
44 | 392 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveEnlarge, EF32TraceUidProxyDrive, this, aLength); |
393 |
||
0 | 394 |
TInt r = iLocDrv.Enlarge(aLength); |
44 | 395 |
|
396 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveEnlargeRet, EF32TraceUidProxyDrive, r); |
|
0 | 397 |
return r; |
398 |
} |
|
399 |
||
400 |
||
401 |
/** |
|
402 |
Reduce the size of the connected drive by removing the specified length |
|
403 |
(in bytes) starting at the specified position. |
|
404 |
Refer to relevant media driver documentation for implementation/restriction |
|
405 |
notes. |
|
406 |
||
407 |
@param aPos The start position of area to be removed. |
|
408 |
@param aLength The length of the data which is being removed. |
|
409 |
||
410 |
@return system wide error code. |
|
411 |
*/ |
|
412 |
TInt CLocalProxyDrive::ReduceSize(TInt aPos, TInt aLength) |
|
413 |
{ |
|
44 | 414 |
TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveReduceSize, EF32TraceUidProxyDrive, this, aPos, aLength); |
415 |
||
0 | 416 |
TInt r = iLocDrv.ReduceSize(aPos,aLength); |
44 | 417 |
|
418 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveReduceSizeRet, EF32TraceUidProxyDrive, r); |
|
0 | 419 |
return r; |
420 |
} |
|
421 |
||
422 |
||
423 |
/** |
|
424 |
Read from the connected drive, and pass flags to driver. |
|
425 |
||
426 |
@param aPos The address from where the read begins. |
|
427 |
@param aLength The length of the read. |
|
428 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
429 |
@param aThreadHandle The handle-number representing the drive thread. |
|
430 |
@param aOffset Offset into aTrg to read the data from. |
|
431 |
@param aFlags Flags to be passed into the driver. |
|
432 |
||
433 |
@return system wide error code. |
|
434 |
*/ |
|
435 |
TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags) |
|
436 |
{ |
|
437 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 438 |
TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead1, EF32TraceUidProxyDrive, |
439 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, aOffset, aFlags); |
|
440 |
||
0 | 441 |
TInt r = iLocDrv.Read(aPos,aLength,aTrg,aThreadHandle,aOffset,aFlags); |
44 | 442 |
|
443 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead1Ret, EF32TraceUidProxyDrive, r); |
|
0 | 444 |
return r; |
445 |
} |
|
446 |
||
447 |
/** |
|
448 |
Read from the connected drive. |
|
449 |
||
450 |
@param aPos The address from where the read begins. |
|
451 |
@param aLength The length of the read. |
|
452 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
453 |
@param aThreadHandle The handle-number representing the drive thread. |
|
454 |
@param aOffset Offset into aTrg to read the data from. |
|
455 |
||
456 |
@return system wide error code. |
|
457 |
*/ |
|
458 |
TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset) |
|
459 |
{ |
|
460 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 461 |
TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead2, EF32TraceUidProxyDrive, |
462 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, anOffset); |
|
463 |
||
0 | 464 |
TInt r = iLocDrv.Read(aPos,aLength,aTrg,aThreadHandle,anOffset); |
44 | 465 |
|
466 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead2Ret, EF32TraceUidProxyDrive, r); |
|
0 | 467 |
return r; |
468 |
} |
|
469 |
||
470 |
/** |
|
471 |
Read from the connected drive. |
|
472 |
||
473 |
@param aPos The address from where the read begins. |
|
474 |
@param aLength The length of the read. |
|
475 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
476 |
||
477 |
@return system wide error code. |
|
478 |
*/ |
|
479 |
TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) |
|
480 |
{ |
|
44 | 481 |
TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead3, EF32TraceUidProxyDrive, |
482 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, &aTrg); |
|
483 |
||
0 | 484 |
TInt r = iLocDrv.Read(aPos,aLength,aTrg); |
44 | 485 |
|
486 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead3Ret, EF32TraceUidProxyDrive, r); |
|
0 | 487 |
return r; |
488 |
} |
|
489 |
||
490 |
||
491 |
/** |
|
492 |
Write to the connected drive and pass flags to driver. |
|
493 |
||
494 |
@param aPos The address from where the write begins. |
|
495 |
@param aLength The length of the write. |
|
496 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
497 |
@param aThreadHandle The handle-number representing the drive thread. |
|
498 |
@param aOffset Offset into aSrc to write the data to. |
|
499 |
@param aFlags Flags to be passed into the driver. |
|
500 |
||
501 |
@return system wide error code. |
|
502 |
*/ |
|
503 |
TInt CLocalProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags) |
|
504 |
{ |
|
505 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 506 |
TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite1, EF32TraceUidProxyDrive, |
507 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, aOffset, aFlags); |
|
508 |
||
0 | 509 |
TInt r = iLocDrv.Write(aPos,aLength,aSrc,aThreadHandle,aOffset,aFlags); |
44 | 510 |
|
511 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite1Ret, EF32TraceUidProxyDrive, r); |
|
512 |
||
0 | 513 |
return r; |
514 |
} |
|
515 |
||
516 |
||
517 |
/** |
|
518 |
Write to the connected drive. |
|
519 |
||
520 |
@param aPos The address from where the write begins. |
|
521 |
@param aLength The length of the write. |
|
522 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
523 |
@param aThreadHandle The handle-number representing the drive thread. |
|
524 |
@param aOffset Offset into aSrc to write the data to. |
|
525 |
||
526 |
@return system wide error code. |
|
527 |
*/ |
|
528 |
TInt CLocalProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset) |
|
529 |
{ |
|
530 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 531 |
TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite2, EF32TraceUidProxyDrive, |
532 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, anOffset); |
|
533 |
||
0 | 534 |
TInt r = iLocDrv.Write(aPos,aLength,aSrc,aThreadHandle,anOffset); |
44 | 535 |
|
536 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite2Ret, EF32TraceUidProxyDrive, r); |
|
0 | 537 |
return r; |
538 |
} |
|
539 |
||
540 |
||
541 |
/** |
|
542 |
Write to the connected drive. |
|
543 |
||
544 |
@param aPos The address from where the write begins. |
|
545 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
546 |
||
547 |
@return system wide error code. |
|
548 |
*/ |
|
549 |
TInt CLocalProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc) |
|
550 |
{ |
|
44 | 551 |
TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite3, EF32TraceUidProxyDrive, |
552 |
this, I64LOW(aPos), I64HIGH(aPos), aSrc.Length(), &aSrc); |
|
553 |
||
0 | 554 |
TInt r = iLocDrv.Write(aPos,aSrc); |
44 | 555 |
|
556 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite3Ret, EF32TraceUidProxyDrive, r); |
|
0 | 557 |
return r; |
558 |
} |
|
559 |
||
560 |
||
561 |
/** |
|
562 |
Get the connected drive's capabilities information. |
|
563 |
||
564 |
@param anInfo A descriptor of the connected drives capabilities. |
|
565 |
||
566 |
@return system wide error code |
|
567 |
*/ |
|
568 |
TInt CLocalProxyDrive::Caps(TDes8& anInfo) |
|
569 |
{ |
|
44 | 570 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveCaps, EF32TraceUidProxyDrive, this); |
571 |
||
0 | 572 |
TInt r = iLocDrv.Caps(anInfo); |
44 | 573 |
|
574 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveCapsRet, EF32TraceUidProxyDrive, r); |
|
0 | 575 |
return r; |
576 |
} |
|
577 |
||
578 |
||
579 |
/** |
|
580 |
Format the connected drive. |
|
581 |
||
582 |
@param anInfo Device specific format information. |
|
583 |
||
584 |
@return system wide error code. |
|
585 |
*/ |
|
586 |
TInt CLocalProxyDrive::Format(TFormatInfo& anInfo) |
|
587 |
{ |
|
44 | 588 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat1, EF32TraceUidProxyDrive, this); |
589 |
||
0 | 590 |
TInt r = iLocDrv.Format(anInfo); |
44 | 591 |
|
592 |
TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat1Ret, EF32TraceUidProxyDrive, |
|
593 |
r, anInfo.iFormatIsCurrent, anInfo.i512ByteSectorsFormatted, anInfo.iMaxBytesPerFormat); |
|
0 | 594 |
return r; |
595 |
} |
|
596 |
||
597 |
||
598 |
/** |
|
599 |
Format the connected drive. |
|
600 |
||
601 |
@param aPos The position of the data which is being formatted. |
|
602 |
@param aLength The length of the data which is being formatted. |
|
603 |
||
604 |
@return system wide error code. |
|
605 |
*/ |
|
606 |
TInt CLocalProxyDrive::Format(TInt64 aPos,TInt aLength) |
|
607 |
{ |
|
44 | 608 |
TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat2, EF32TraceUidProxyDrive, |
609 |
this, I64LOW(aPos), I64HIGH(aPos), aLength); |
|
610 |
||
0 | 611 |
TInt r = iLocDrv.Format(aPos,aLength); |
44 | 612 |
|
613 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat2Ret, EF32TraceUidProxyDrive, r); |
|
0 | 614 |
return r; |
615 |
} |
|
616 |
||
617 |
||
618 |
/** |
|
619 |
Set the mount information on the local drive. |
|
620 |
||
621 |
@param aMountInfo Information passed down to the media driver. The meaning of this information depends on the media driver. |
|
622 |
@param aMountInfoThreadHandle Message thread handle number. |
|
623 |
||
624 |
@return system wide error code. |
|
625 |
*/ |
|
626 |
TInt CLocalProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle) |
|
627 |
{ |
|
44 | 628 |
TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveSetMountInfo, EF32TraceUidProxyDrive, this, aMountInfo, aMountInfoThreadHandle); |
629 |
||
0 | 630 |
TInt r = iLocDrv.SetMountInfo(aMountInfo,aMountInfoThreadHandle); |
44 | 631 |
|
632 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveSetMountInfoRet, EF32TraceUidProxyDrive, r); |
|
0 | 633 |
return r; |
634 |
} |
|
635 |
||
636 |
||
637 |
/** |
|
638 |
Forces a remount on the local drive |
|
639 |
||
640 |
@param aFlags Flags to be passed into the driver. |
|
641 |
||
642 |
@return system wide error code. |
|
643 |
*/ |
|
644 |
TInt CLocalProxyDrive::ForceRemount(TUint aFlags) |
|
645 |
{ |
|
44 | 646 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveForceRemount, EF32TraceUidProxyDrive, this, aFlags); |
647 |
||
0 | 648 |
TInt r = iLocDrv.ForceRemount(aFlags); |
44 | 649 |
|
650 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveForceRemountRet, EF32TraceUidProxyDrive, r); |
|
0 | 651 |
return r; |
652 |
} |
|
653 |
||
654 |
/** |
|
655 |
An interface with which control commands can be passed to |
|
656 |
the appropriate driver layer. |
|
657 |
||
658 |
@param aMessage Message to be sent. |
|
659 |
@param aCommand Command type. |
|
660 |
@param aParam1 1st parameter of control message. |
|
661 |
@param aParam2 2nd parameter of control message. |
|
662 |
||
663 |
@return system wide error code. |
|
664 |
*/ |
|
665 |
TInt CLocalProxyDrive::ControlIO(const RMessagePtr2& /*aMessage*/,TInt aCommand,TAny* aParam1,TAny* aParam2) |
|
666 |
{ |
|
44 | 667 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveControlIO, EF32TraceUidProxyDrive, this); |
668 |
||
0 | 669 |
TInt r = iLocDrv.ControlIO(aCommand,aParam1,aParam2); |
44 | 670 |
|
671 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveControlIORet, EF32TraceUidProxyDrive, r); |
|
0 | 672 |
return r; |
673 |
} |
|
674 |
||
675 |
||
676 |
/** |
|
677 |
Unlocks a password-enabled device. |
|
678 |
||
679 |
@param aPassword A descriptor containing the existing password. |
|
680 |
@param aStorePassword If ETrue, the password is added to the password store. |
|
681 |
||
682 |
@return system wide error code. |
|
683 |
*/ |
|
684 |
TInt CLocalProxyDrive::Unlock(TMediaPassword &aPassword, TBool aStorePassword) |
|
685 |
{ |
|
44 | 686 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveUnlock, EF32TraceUidProxyDrive, this, aStorePassword); |
687 |
||
0 | 688 |
TInt r = iLocDrv.Unlock(aPassword,aStorePassword); |
44 | 689 |
|
690 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveUnlockRet, EF32TraceUidProxyDrive, r); |
|
0 | 691 |
return r; |
692 |
} |
|
693 |
||
694 |
||
695 |
/** |
|
696 |
Locks a password-enabled device with the new password. |
|
697 |
||
698 |
@param aOldPassword A descriptor containing the existing password. |
|
699 |
@param aNewPassword A descriptor containing the new password. |
|
700 |
@param aStorePassword If ETrue, the password is added to the password store. |
|
701 |
||
702 |
@return system wide error code. |
|
703 |
*/ |
|
704 |
TInt CLocalProxyDrive::Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword) |
|
705 |
{ |
|
44 | 706 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveLock, EF32TraceUidProxyDrive, this, aStorePassword); |
707 |
||
0 | 708 |
TInt r = iLocDrv.SetPassword(aOldPassword,aNewPassword,aStorePassword); |
44 | 709 |
|
710 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveLockRet, EF32TraceUidProxyDrive, r); |
|
0 | 711 |
return r; |
712 |
} |
|
713 |
||
714 |
||
715 |
/** |
|
716 |
Clears a password from a device - controller sets password to null. |
|
717 |
||
718 |
@param aPassword A descriptor containing the password. |
|
719 |
||
720 |
@return system wide error code. |
|
721 |
*/ |
|
722 |
TInt CLocalProxyDrive::Clear(TMediaPassword &aPassword) |
|
723 |
{ |
|
44 | 724 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveClear, EF32TraceUidProxyDrive, this); |
725 |
||
0 | 726 |
TInt r = iLocDrv.Clear(aPassword); |
44 | 727 |
|
728 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveClearRet, EF32TraceUidProxyDrive, r); |
|
0 | 729 |
return r; |
730 |
} |
|
731 |
||
732 |
/** |
|
733 |
Forcibly unlock a password-enabled drive. |
|
734 |
||
735 |
@return system wide error code. |
|
736 |
*/ |
|
737 |
TInt CLocalProxyDrive::ErasePassword() |
|
738 |
{ |
|
44 | 739 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveErasePassword, EF32TraceUidProxyDrive, this); |
740 |
||
0 | 741 |
TInt r = iLocDrv.ErasePassword(); |
44 | 742 |
|
743 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveErasePasswordRet, EF32TraceUidProxyDrive, r); |
|
0 | 744 |
return r; |
745 |
} |
|
746 |
||
747 |
/** |
|
748 |
Notify the media driver that an area of the partition has been deleted. |
|
749 |
Used by some media drivers (e.g. NAND flash) for garbage collection. |
|
750 |
||
751 |
@param aPos The position of the data which is being deleted. |
|
752 |
@param aLength The length of the data which is being deleted. |
|
44 | 753 |
|
0 | 754 |
@return System wide error code. |
755 |
*/ |
|
756 |
TInt CLocalProxyDrive::DeleteNotify(TInt64 aPos, TInt aLength) |
|
757 |
{ |
|
44 | 758 |
TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDeleteNotify, EF32TraceUidProxyDrive, |
759 |
this, I64LOW(aPos), I64HIGH(aPos), aLength); |
|
760 |
||
0 | 761 |
TInt r = iLocDrv.DeleteNotify(aPos, aLength); |
44 | 762 |
|
763 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDeleteNotifyRet, EF32TraceUidProxyDrive, r); |
|
0 | 764 |
return r; |
765 |
} |
|
766 |
||
767 |
||
768 |
/** |
|
769 |
Retrieve disk error information. |
|
770 |
||
771 |
@param aErrorInfo Reference to a descriptor containing disk error information. |
|
772 |
||
773 |
@return System wide error code. |
|
774 |
*/ |
|
775 |
TInt CLocalProxyDrive::GetLastErrorInfo(TDes8 &aErrorInfo) |
|
776 |
{ |
|
44 | 777 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetLastErrorInfo, EF32TraceUidProxyDrive, this); |
778 |
||
0 | 779 |
TInt r = iLocDrv.GetLastErrorInfo(aErrorInfo); |
44 | 780 |
|
781 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetLastErrorInfoRet, EF32TraceUidProxyDrive, r); |
|
0 | 782 |
return r; |
783 |
} |
|
784 |
||
785 |
||
786 |
TInt CLocalProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput) |
|
787 |
{ |
|
44 | 788 |
TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetInterface, EF32TraceUidProxyDrive, |
789 |
this, aInterfaceId, aInput); |
|
790 |
||
0 | 791 |
TInt r; |
792 |
switch(aInterfaceId) |
|
793 |
{ |
|
794 |
case EGetLocalDrive: |
|
795 |
__ASSERT_ALWAYS((CProxyDrive*)aInput==this,Fault(ELocDrvInvalidLocalDrive)); |
|
796 |
(TBusLocalDrive*&)aInterface=&iLocDrv; |
|
797 |
r = KErrNone; |
|
798 |
break; |
|
799 |
||
800 |
case ELocalBufferSupport: |
|
801 |
aInterface = NULL; |
|
802 |
r = KErrNone; |
|
803 |
break; |
|
804 |
||
805 |
default: |
|
806 |
r= CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput); |
|
807 |
} |
|
44 | 808 |
|
809 |
TRACERET2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetInterfaceRet, EF32TraceUidProxyDrive, r, aInterface); |
|
0 | 810 |
return r; |
811 |
} |
|
812 |
||
813 |
||
814 |
||
815 |
/** |
|
816 |
Constructor. |
|
817 |
||
818 |
@panic FSERV 54 if the supplied CMountCB pointer is NULL. |
|
819 |
*/ |
|
820 |
EXPORT_C CBaseExtProxyDrive::CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount) |
|
821 |
:CProxyDrive(aMount),iProxy(aProxyDrive) |
|
822 |
{ |
|
823 |
__ASSERT_DEBUG(iProxy!=NULL,Fault(EBaseExtConstruction)); |
|
824 |
} |
|
825 |
||
826 |
/** |
|
827 |
Destructor. |
|
828 |
||
829 |
Frees resources before destruction of the object. |
|
830 |
*/ |
|
831 |
EXPORT_C CBaseExtProxyDrive::~CBaseExtProxyDrive() |
|
832 |
{ |
|
833 |
delete(iProxy); |
|
834 |
} |
|
835 |
||
836 |
||
837 |
/** |
|
838 |
Initialise the proxy drive. |
|
839 |
||
840 |
This implementation performs no operations. |
|
841 |
||
842 |
@return system wide error code. |
|
843 |
*/ |
|
844 |
EXPORT_C TInt CBaseExtProxyDrive::Initialise() |
|
845 |
{ |
|
44 | 846 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveInitialise, EF32TraceUidProxyDrive, this); |
847 |
||
0 | 848 |
TInt r = iProxy->Initialise(); |
44 | 849 |
|
850 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveInitialiseRet, EF32TraceUidProxyDrive, r); |
|
0 | 851 |
return r; |
852 |
} |
|
853 |
||
854 |
||
855 |
/** |
|
856 |
Calls Dismounted() on the proxy drive. |
|
857 |
||
858 |
@return KErrNone. |
|
859 |
*/ |
|
860 |
EXPORT_C TInt CBaseExtProxyDrive::Dismounted() |
|
861 |
{ |
|
44 | 862 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDismounted, EF32TraceUidProxyDrive, this); |
863 |
||
0 | 864 |
TInt r = iProxy->Dismounted(); |
44 | 865 |
|
866 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDismountedRet, EF32TraceUidProxyDrive, r); |
|
0 | 867 |
return r; |
868 |
} |
|
869 |
||
870 |
/** |
|
871 |
Increase the size of the proxy drive by the specified length (in bytes). |
|
872 |
||
873 |
@param aLength The length (in bytes) of which the drive is to be increased by. |
|
874 |
||
875 |
@return system wide error code. |
|
876 |
*/ |
|
877 |
EXPORT_C TInt CBaseExtProxyDrive::Enlarge(TInt aLength) |
|
878 |
{ |
|
44 | 879 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveEnlarge, EF32TraceUidProxyDrive, this, aLength); |
880 |
||
0 | 881 |
TInt r = iProxy->Enlarge(aLength); |
44 | 882 |
|
883 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveEnlargeRet, EF32TraceUidProxyDrive, r); |
|
0 | 884 |
return r; |
885 |
} |
|
886 |
||
887 |
||
888 |
/** |
|
889 |
Reduce the size of the proxy drive by removing the specified length |
|
890 |
(in bytes) starting at the specified position. |
|
891 |
Refer to relevant media driver documentation for implementation/restriction |
|
892 |
notes. |
|
893 |
||
894 |
@param aPos The start position of area to be removed. |
|
895 |
@param aLength The length/size (in bytes) by which the drive is to be reduced. |
|
896 |
||
897 |
@return system wide error code. |
|
898 |
*/ |
|
899 |
EXPORT_C TInt CBaseExtProxyDrive::ReduceSize(TInt aPos, TInt aLength) |
|
900 |
{ |
|
44 | 901 |
TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveReduceSize, EF32TraceUidProxyDrive, this, aPos, aLength); |
902 |
||
0 | 903 |
TInt r = iProxy->ReduceSize(aPos,aLength); |
44 | 904 |
|
905 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveReduceSizeRet, EF32TraceUidProxyDrive, r); |
|
0 | 906 |
return r; |
907 |
} |
|
908 |
||
909 |
||
910 |
/** |
|
911 |
Read from the proxy drive, and pass flags to driver. |
|
912 |
||
913 |
@param aPos The address from where the read begins. |
|
914 |
@param aLength The length of the read. |
|
915 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
916 |
@param aThreadHandle The handle-number representing the drive thread. |
|
917 |
@param aOffset Offset into aTrg to read the data from. |
|
918 |
@param aFlags Flags to be passed into the driver. |
|
919 |
||
920 |
@return system wide error code. |
|
921 |
*/ |
|
922 |
EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags) |
|
923 |
{ |
|
924 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 925 |
TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead1, EF32TraceUidProxyDrive, |
926 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, aOffset, aFlags); |
|
927 |
||
0 | 928 |
TInt r = iProxy->Read(aPos,aLength,aTrg,aThreadHandle,aOffset,aFlags); |
44 | 929 |
|
930 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead1Ret, EF32TraceUidProxyDrive, r); |
|
931 |
||
0 | 932 |
return r; |
933 |
} |
|
934 |
||
935 |
||
936 |
/** |
|
937 |
Read from the proxy drive. |
|
938 |
||
939 |
@param aPos The address from where the read begins. |
|
940 |
@param aLength The length of the read. |
|
941 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
942 |
@param aThreadHandle The handle-number representing the drive thread. |
|
943 |
@param aOffset Offset into aTrg to read the data from. |
|
944 |
||
945 |
@return system wide error code. |
|
946 |
*/ |
|
947 |
EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset) |
|
948 |
{ |
|
949 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 950 |
TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead2, EF32TraceUidProxyDrive, |
951 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, anOffset); |
|
952 |
||
0 | 953 |
TInt r = iProxy->Read(aPos,aLength,aTrg,aThreadHandle,anOffset); |
44 | 954 |
|
955 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead2Ret, EF32TraceUidProxyDrive, r); |
|
0 | 956 |
return r; |
957 |
} |
|
958 |
||
959 |
||
960 |
/** |
|
961 |
Read from the proxy drive. |
|
962 |
||
963 |
@param aPos The address from where the read begins. |
|
964 |
@param aLength The length of the read. |
|
965 |
@param aTrg A descriptor of the memory buffer from which to read. |
|
966 |
||
967 |
@return system wide error code. |
|
968 |
*/ |
|
969 |
EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg) |
|
970 |
{ |
|
44 | 971 |
TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead3, EF32TraceUidProxyDrive, |
972 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, &aTrg); |
|
973 |
||
0 | 974 |
TInt r = iProxy->Read(aPos,aLength,aTrg); |
44 | 975 |
|
976 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead3Ret, EF32TraceUidProxyDrive, r); |
|
0 | 977 |
return r; |
978 |
} |
|
979 |
||
980 |
||
981 |
/** |
|
982 |
Write to the proxy drive and pass flags to driver. |
|
983 |
||
984 |
@param aPos The address from where the write begins. |
|
985 |
@param aLength The length of the write. |
|
986 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
987 |
@param aThreadHandle The handle-number representing the drive thread. |
|
988 |
@param aOffset Offset into aSrc to write the data to. |
|
989 |
@param aFlags Flags to be passed into the driver. |
|
990 |
||
991 |
@return system wide error code. |
|
992 |
*/ |
|
993 |
EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags) |
|
994 |
{ |
|
995 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 996 |
TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite1, EF32TraceUidProxyDrive, |
997 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, aOffset, aFlags); |
|
998 |
||
0 | 999 |
TInt r = iProxy->Write(aPos,aLength,aSrc,aThreadHandle,aOffset,aFlags); |
44 | 1000 |
|
1001 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite1Ret, EF32TraceUidProxyDrive, r); |
|
0 | 1002 |
return r; |
1003 |
} |
|
1004 |
||
1005 |
||
1006 |
/** |
|
1007 |
Write to the proxy drive. |
|
1008 |
||
1009 |
@param aPos The address from where the write begins. |
|
1010 |
@param aLength The length of the write. |
|
1011 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
1012 |
@param aThreadHandle The handle-number representing the drive thread. |
|
1013 |
@param aOffset Offset into aSrc to write the data to. |
|
1014 |
||
1015 |
@return system wide error code. |
|
1016 |
*/ |
|
1017 |
EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset) |
|
1018 |
{ |
|
1019 |
TRACETHREADIDH(aThreadHandle); |
|
44 | 1020 |
TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite2, EF32TraceUidProxyDrive, |
1021 |
this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, anOffset); |
|
1022 |
||
0 | 1023 |
TInt r = iProxy->Write(aPos,aLength,aSrc,aThreadHandle,anOffset); |
44 | 1024 |
|
1025 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite2Ret, EF32TraceUidProxyDrive, r); |
|
0 | 1026 |
return r; |
1027 |
} |
|
1028 |
||
1029 |
||
1030 |
/** |
|
1031 |
Write to the proxy drive. |
|
1032 |
||
1033 |
@param aPos The address from where the write begins. |
|
1034 |
@param aSrc A descriptor of the memory buffer from which to write. |
|
1035 |
||
1036 |
@return system wide error code. |
|
1037 |
*/ |
|
1038 |
EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc) |
|
1039 |
{ |
|
44 | 1040 |
TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite3, EF32TraceUidProxyDrive, |
1041 |
this, I64LOW(aPos), I64HIGH(aPos), aSrc.Length(), &aSrc); |
|
1042 |
||
0 | 1043 |
TInt r = iProxy->Write(aPos,aSrc); |
44 | 1044 |
|
1045 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite3Ret, EF32TraceUidProxyDrive, r); |
|
0 | 1046 |
return r; |
1047 |
} |
|
1048 |
||
1049 |
||
1050 |
/** |
|
1051 |
Get the proxy drive's capabilities information. |
|
1052 |
||
1053 |
@param anInfo A descriptor of the connected drives capabilities. |
|
1054 |
||
1055 |
@return system wide error code |
|
1056 |
*/ |
|
1057 |
EXPORT_C TInt CBaseExtProxyDrive::Caps(TDes8& anInfo) |
|
1058 |
{ |
|
44 | 1059 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveCaps, EF32TraceUidProxyDrive, this); |
1060 |
||
0 | 1061 |
TInt r = iProxy->Caps(anInfo); |
44 | 1062 |
|
1063 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveCapsRet, EF32TraceUidProxyDrive, r); |
|
0 | 1064 |
return r; |
1065 |
} |
|
1066 |
||
1067 |
||
1068 |
/** |
|
1069 |
Format the connected drive. |
|
1070 |
||
1071 |
@param anInfo Device specific format information. |
|
1072 |
||
1073 |
@return system wide error code. |
|
1074 |
*/ |
|
1075 |
EXPORT_C TInt CBaseExtProxyDrive::Format(TFormatInfo& anInfo) |
|
1076 |
{ |
|
44 | 1077 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat1, EF32TraceUidProxyDrive, this); |
1078 |
||
0 | 1079 |
TInt r = iProxy->Format(anInfo); |
44 | 1080 |
|
1081 |
TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat1Ret, EF32TraceUidProxyDrive, |
|
1082 |
r, anInfo.iFormatIsCurrent, anInfo.i512ByteSectorsFormatted, anInfo.iMaxBytesPerFormat); |
|
0 | 1083 |
return r; |
1084 |
} |
|
1085 |
||
1086 |
||
1087 |
/** |
|
1088 |
Format the proxy drive. |
|
1089 |
||
1090 |
@param aPos The position of the data which is being formatted. |
|
1091 |
@param aLength The length of the data which is being formatted. |
|
1092 |
||
1093 |
@return system wide error code. |
|
1094 |
*/ |
|
1095 |
EXPORT_C TInt CBaseExtProxyDrive::Format(TInt64 aPos,TInt aLength) |
|
1096 |
{ |
|
44 | 1097 |
TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat2, EF32TraceUidProxyDrive, |
1098 |
this, I64LOW(aPos), I64HIGH(aPos), aLength); |
|
1099 |
||
0 | 1100 |
TInt r = iProxy->Format(aPos,aLength); |
44 | 1101 |
|
1102 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat2Ret, EF32TraceUidProxyDrive, r); |
|
0 | 1103 |
return r; |
1104 |
} |
|
1105 |
||
1106 |
||
1107 |
/** |
|
1108 |
Set the mount information on the proxy drive. |
|
1109 |
||
1110 |
@param aMountInfo Information passed down to the media driver. The meaning of this information depends on the media driver. |
|
1111 |
@param aMountInfoThreadHandle Message thread handle number. |
|
1112 |
||
1113 |
@return system wide error code. |
|
1114 |
*/ |
|
1115 |
EXPORT_C TInt CBaseExtProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle) |
|
1116 |
{ |
|
44 | 1117 |
TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveSetMountInfo, EF32TraceUidProxyDrive, this, aMountInfo, aMountInfoThreadHandle); |
1118 |
||
0 | 1119 |
TInt r = iProxy->SetMountInfo(aMountInfo,aMountInfoThreadHandle); |
44 | 1120 |
|
1121 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveSetMountInfoRet, EF32TraceUidProxyDrive, r); |
|
0 | 1122 |
return r; |
1123 |
} |
|
1124 |
||
1125 |
||
1126 |
/** |
|
1127 |
Forces a remount on the proxy drive |
|
1128 |
||
1129 |
@param aFlags Flags to be passed into the driver. |
|
1130 |
||
1131 |
@return system wide error code. |
|
1132 |
*/ |
|
1133 |
EXPORT_C TInt CBaseExtProxyDrive::ForceRemount(TUint aFlags) |
|
1134 |
{ |
|
44 | 1135 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveForceRemount, EF32TraceUidProxyDrive, this, aFlags); |
1136 |
||
0 | 1137 |
TInt r = iProxy->ForceRemount(aFlags); |
44 | 1138 |
|
1139 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveForceRemountRet, EF32TraceUidProxyDrive, r); |
|
0 | 1140 |
return r; |
1141 |
} |
|
1142 |
||
1143 |
||
1144 |
/** |
|
1145 |
Unlocks a password-enabled proxy drive. |
|
1146 |
||
1147 |
@param aPassword A descriptor containing the existing password. |
|
1148 |
@param aStorePassword If ETrue, the password is added to the password store. |
|
1149 |
||
1150 |
@return system wide error code. |
|
1151 |
*/ |
|
1152 |
EXPORT_C TInt CBaseExtProxyDrive::Unlock(TMediaPassword &aPassword, TBool aStorePassword) |
|
1153 |
{ |
|
44 | 1154 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveUnlock, EF32TraceUidProxyDrive, this, aStorePassword); |
1155 |
||
0 | 1156 |
TInt r = iProxy->Unlock(aPassword,aStorePassword); |
44 | 1157 |
|
1158 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveUnlockRet, EF32TraceUidProxyDrive, r); |
|
0 | 1159 |
return r; |
1160 |
} |
|
1161 |
||
1162 |
||
1163 |
/** |
|
1164 |
Locks a password-enabled proxy drive with the new password. |
|
1165 |
||
1166 |
@param aOldPassword A descriptor containing the existing password. |
|
1167 |
@param aNewPassword A descriptor containing the new password. |
|
1168 |
@param aStorePassword If ETrue, the password is added to the password store. |
|
1169 |
||
1170 |
@return system wide error code. |
|
1171 |
*/ |
|
1172 |
EXPORT_C TInt CBaseExtProxyDrive::Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword) |
|
1173 |
{ |
|
44 | 1174 |
TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveLock, EF32TraceUidProxyDrive, this, aStorePassword); |
1175 |
||
0 | 1176 |
TInt r = iProxy->Lock(aOldPassword,aNewPassword,aStorePassword); |
44 | 1177 |
|
1178 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveLockRet, EF32TraceUidProxyDrive, r); |
|
0 | 1179 |
return r; |
1180 |
} |
|
1181 |
||
1182 |
||
1183 |
/** |
|
1184 |
Clears a password from a proxy drive - controller sets password to null. |
|
1185 |
||
1186 |
@param aPassword A descriptor containing the password. |
|
1187 |
||
1188 |
@return system wide error code. |
|
1189 |
*/ |
|
1190 |
EXPORT_C TInt CBaseExtProxyDrive::Clear(TMediaPassword &aPassword) |
|
1191 |
{ |
|
44 | 1192 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveClear, EF32TraceUidProxyDrive, this); |
1193 |
||
0 | 1194 |
TInt r = iProxy->Clear(aPassword); |
44 | 1195 |
|
1196 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveClearRet, EF32TraceUidProxyDrive, r); |
|
0 | 1197 |
return r; |
1198 |
} |
|
1199 |
||
1200 |
/** |
|
1201 |
Forcibly unlock a password-enabled proxy drive. |
|
1202 |
||
1203 |
@return system wide error code. |
|
1204 |
*/ |
|
1205 |
EXPORT_C TInt CBaseExtProxyDrive::ErasePassword() |
|
1206 |
{ |
|
44 | 1207 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveErasePassword, EF32TraceUidProxyDrive, this); |
1208 |
||
0 | 1209 |
TInt r = iProxy->ErasePassword(); |
44 | 1210 |
|
1211 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveErasePasswordRet, EF32TraceUidProxyDrive, r); |
|
0 | 1212 |
return r; |
1213 |
} |
|
1214 |
||
1215 |
/** |
|
1216 |
An interface with which control commands can be passed to |
|
1217 |
the appropriate driver layer. |
|
1218 |
||
1219 |
@param aMessage Message to be sent. |
|
1220 |
@param aCommand Command type. |
|
1221 |
@param aParam1 1st parameter of control message. |
|
1222 |
@param aParam2 2nd parameter of control message. |
|
1223 |
||
1224 |
@return system wide error code. |
|
1225 |
*/ |
|
1226 |
EXPORT_C TInt CBaseExtProxyDrive::ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2) |
|
1227 |
{ |
|
44 | 1228 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveControlIO, EF32TraceUidProxyDrive, this); |
1229 |
||
0 | 1230 |
TInt r = iProxy->ControlIO(aMessage,aCommand,aParam1,aParam2); |
44 | 1231 |
|
1232 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveControlIORet, EF32TraceUidProxyDrive, r); |
|
0 | 1233 |
return r; |
1234 |
} |
|
1235 |
||
1236 |
||
1237 |
/** |
|
1238 |
Initialise the provided interface extension. |
|
1239 |
||
1240 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
1241 |
@param aInterface Address of variable that retrieves the specified interface. |
|
1242 |
@param aInput Data required for the instantiation of the interface. |
|
1243 |
||
1244 |
@return system wide error code. |
|
1245 |
*/ |
|
1246 |
EXPORT_C TInt CBaseExtProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput) |
|
1247 |
{ |
|
44 | 1248 |
TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetInterface, EF32TraceUidProxyDrive, |
1249 |
this, aInterfaceId, aInput); |
|
1250 |
||
0 | 1251 |
TInt r; |
1252 |
if (aInterfaceId==EGetLocalDrive) |
|
1253 |
{ |
|
1254 |
r = iProxy->GetLocalDrive((TBusLocalDrive*&)aInterface); // iProxy is of type CLocalProxyDrive, so OK to reenter |
|
1255 |
} |
|
1256 |
else |
|
1257 |
r = CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput); |
|
44 | 1258 |
|
1259 |
TRACERET2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetInterfaceRet, EF32TraceUidProxyDrive, r, aInterface); |
|
0 | 1260 |
return r; |
1261 |
} |
|
1262 |
||
1263 |
||
1264 |
/** |
|
1265 |
Retrieve proxy drive disk error information. |
|
1266 |
||
1267 |
@param aErrorInfo Reference to a descriptor containing disk error information. |
|
1268 |
||
1269 |
@return System wide error code. |
|
1270 |
*/ |
|
1271 |
EXPORT_C TInt CBaseExtProxyDrive::GetLastErrorInfo(TDes8 &aErrorInfo) |
|
1272 |
{ |
|
44 | 1273 |
TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetLastErrorInfo, EF32TraceUidProxyDrive, this); |
1274 |
||
0 | 1275 |
TInt r = iProxy->GetLastErrorInfo(aErrorInfo); |
44 | 1276 |
|
1277 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetLastErrorInfoRet, EF32TraceUidProxyDrive, r); |
|
0 | 1278 |
return r; |
1279 |
} |
|
1280 |
||
1281 |
||
1282 |
/** |
|
1283 |
Issue a notification that a physical delete has occurred. |
|
1284 |
For example a cluster or partition has been freed. |
|
1285 |
||
1286 |
@param aPos The position of the data which is being deleted. |
|
1287 |
@param aLength The length of the data which is being deleted. |
|
1288 |
||
1289 |
@return System wide error code. |
|
1290 |
*/ |
|
1291 |
EXPORT_C TInt CBaseExtProxyDrive::DeleteNotify(TInt64 aPos, TInt aLength) |
|
1292 |
{ |
|
44 | 1293 |
TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDeleteNotify, EF32TraceUidProxyDrive, |
1294 |
this, I64LOW(aPos), I64HIGH(aPos), aLength); |
|
1295 |
||
0 | 1296 |
TInt r = iProxy->DeleteNotify(aPos, aLength); |
44 | 1297 |
|
1298 |
TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDeleteNotifyRet, EF32TraceUidProxyDrive, r); |
|
0 | 1299 |
return r; |
1300 |
} |
|
1301 |
||
1302 |
||
1303 |
/** |
|
1304 |
Constructor. |
|
1305 |
*/ |
|
1306 |
EXPORT_C CProxyDriveFactory::CProxyDriveFactory() |
|
1307 |
{} |
|
1308 |
||
1309 |
||
1310 |
/** |
|
1311 |
Remove the Proxy driver factory. |
|
1312 |
||
1313 |
This implementation performs no operations. |
|
1314 |
||
1315 |
@return KErrNone |
|
1316 |
*/ |
|
1317 |
EXPORT_C TInt CProxyDriveFactory::Remove() |
|
1318 |
{ |
|
1319 |
return(KErrNone); |
|
1320 |
} |
|
1321 |
||
1322 |
GLDEF_C CExtProxyDriveFactory* GetProxyDriveFactory(const TDesC& aName) |
|
1323 |
// |
|
1324 |
// Lookup an extension by name. |
|
1325 |
// |
|
1326 |
{ |
|
1327 |
||
1328 |
TInt h=0; |
|
1329 |
TInt r=ProxyDrives->FindByName(h,aName); |
|
1330 |
if (r!=KErrNone) |
|
1331 |
return(NULL); |
|
1332 |
return((CExtProxyDriveFactory*)ProxyDrives->At(h)); |
|
1333 |
} |
|
1334 |
||
1335 |
||
1336 |
// construct a extension proxy drive device |
|
1337 |
EXPORT_C CExtProxyDriveFactory::CExtProxyDriveFactory() |
|
1338 |
{ |
|
1339 |
} |
|
1340 |
||
1341 |
||
1342 |
EXPORT_C TInt CExtProxyDriveFactory::Remove() |
|
1343 |
{ |
|
1344 |
return KErrNone; |
|
1345 |
} |
|
1346 |
||
1347 |
||
1348 |
EXPORT_C void CExtProxyDriveFactory::AsyncEnumerate() |
|
1349 |
{ |
|
1350 |
} |
|
1351 |
||
1352 |
||
1353 |
/** |
|
1354 |
Create a proxy drive using the local proxy drive passed in |
|
1355 |
and any extensions that have been added to the drive. |
|
1356 |
||
1357 |
@param aConcreteDrive local proxy drive |
|
1358 |
@param aMount local proxy drive mount control block |
|
1359 |
||
1360 |
@return pointer to instantiated CProxyDrive object. |
|
1361 |
*/ |
|
1362 |
EXPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount) |
|
1363 |
{ |
|
1364 |
__PRINT(_L("CreateProxyDriveL()")); |
|
1365 |
__ASSERT_DEBUG(aMount!=NULL,Fault(ECreateProxyDriveL)); |
|
1366 |
TDrive& drive=TheDrives[aMount->Drive().DriveNumber()]; |
|
1367 |
if(drive.ExtInfo().iCount==0) |
|
1368 |
return(aConcreteDrive); |
|
1369 |
||
1370 |
TBool extSupported = drive.FSys().IsExtensionSupported(); |
|
44 | 1371 |
TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemIsExtensionSupported, EF32TraceUidProxyDrive, extSupported); |
0 | 1372 |
if(!extSupported) |
1373 |
{ |
|
1374 |
delete(aConcreteDrive); |
|
1375 |
User::Leave(KErrAccessDenied); |
|
1376 |
} |
|
1377 |
CProxyDrive* pOrig=aConcreteDrive; |
|
1378 |
CProxyDrive* pFinal=NULL; |
|
1379 |
__ASSERT_DEBUG(drive.ExtInfo().iCount<=KMaxExtensionCount,Fault(EExtensionInfoCount2)); |
|
1380 |
for(TInt i=0;i<drive.ExtInfo().iCount;++i) |
|
1381 |
{ |
|
1382 |
__PRINT1TEMP(_L("adding extension %S"),drive.ExtInfo().iInfo[i].iFactory->Name()); |
|
1383 |
__PRINT1(_L("extension is primary = %d"),drive.ExtInfo().iInfo[i].iIsPrimary); |
|
1384 |
TRAPD(r,pFinal=drive.ExtInfo().iInfo[i].iFactory->NewProxyDriveL(pOrig,aMount)); |
|
1385 |
if(r!=KErrNone) |
|
1386 |
{ |
|
1387 |
delete(pOrig); |
|
1388 |
User::Leave(r); |
|
1389 |
} |
|
1390 |
pOrig=pFinal; |
|
1391 |
} |
|
1392 |
return(pOrig); |
|
1393 |
} |
|
1394 |
||
1395 |
/** |
|
1396 |
Lookup a proxy drive extension by name. |
|
1397 |
||
1398 |
@param aName name of extension to be found |
|
1399 |
||
1400 |
@return system wide error code |
|
1401 |
*/ |
|
1402 |
CProxyDriveFactory* GetExtension(const TDesC& aName) |
|
1403 |
{ |
|
1404 |
||
1405 |
TInt h=0; |
|
1406 |
TInt r=Extensions->FindByName(h,aName); |
|
1407 |
if (r!=KErrNone) |
|
1408 |
return(NULL); |
|
1409 |
return((CProxyDriveFactory*)Extensions->At(h)); |
|
1410 |
} |
|
1411 |
||
1412 |
||
1413 |
// construct a extension proxy drive |
|
1414 |
EXPORT_C CExtProxyDrive::CExtProxyDrive(CMountCB* aMount,CExtProxyDriveFactory* aDevice) |
|
1415 |
: CProxyDrive(aMount), |
|
1416 |
iFactory(aDevice) |
|
1417 |
{ |
|
1418 |
} |
|
1419 |
||
1420 |
// delete a extension proxy drive |
|
1421 |
EXPORT_C CExtProxyDrive::~CExtProxyDrive() |
|
1422 |
{ |
|
1423 |
if(iMediaChangeNotifier) |
|
1424 |
{ |
|
1425 |
delete iMediaChangeNotifier; |
|
1426 |
} |
|
1427 |
} |
|
1428 |
||
1429 |
||
1430 |
EXPORT_C TInt CExtProxyDrive::NotifyChange(TDes8 &/*aChanged*/, TRequestStatus* /*aStatus*/) |
|
1431 |
{ |
|
1432 |
return KErrNotSupported; |
|
1433 |
} |
|
1434 |
||
1435 |
EXPORT_C void CExtProxyDrive::NotifyChangeCancel() |
|
1436 |
{ |
|
1437 |
} |
|
1438 |
||
1439 |
EXPORT_C TInt CExtProxyDrive::SetInfo(const RMessage2& /*aMsg*/, TAny* /*aMessageParam2*/, TAny* /*aMessageParam3*/) |
|
1440 |
{ |
|
1441 |
return KErrNone; |
|
1442 |
} |
|
1443 |
||
1444 |
/** |
|
1445 |
Initialise the provided interface extension. |
|
1446 |
||
1447 |
@param aInterfaceId Interface identifier of the interface to be retrieved. |
|
1448 |
@param aInterface Address of variable that retrieves the specified interface. |
|
1449 |
@param aInput Data required for the instantiation of the interface. |
|
1450 |
||
1451 |
@return system wide error code. |
|
1452 |
*/ |
|
1453 |
EXPORT_C TInt CExtProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput) |
|
1454 |
{ |
|
1455 |
return(CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput)); |
|
1456 |
} |
|
1457 |
||
1458 |
TInt CExtProxyDrive::SetupMediaChange() |
|
1459 |
{ |
|
1460 |
if(iMediaChangeNotifier) |
|
1461 |
{ |
|
1462 |
TRAPD(err, iMediaChangeNotifier->RequestL()); |
|
1463 |
return err; |
|
1464 |
} |
|
1465 |
||
1466 |
TRAPD(err, iMediaChangeNotifier = CExtNotifyMediaChange::NewL(this)); |
|
1467 |
||
1468 |
return(err == KErrNotSupported ? KErrNone : err); |
|
1469 |
} |
|
1470 |
||
1471 |
TInt TFsAddExtension::DoRequestL(CFsRequest* aRequest) |
|
1472 |
// |
|
1473 |
// Add an extension |
|
1474 |
// |
|
1475 |
{ |
|
1476 |
__PRINT(_L("TFsAddExtension::DoRequestL(CFsRequest* aRequest)")); |
|
1477 |
||
1478 |
RLibrary lib; |
|
1479 |
// Get library handle |
|
1480 |
lib.SetHandle(aRequest->Message().Int0()); |
|
1481 |
if (lib.Type()[1]!=TUid::Uid(KFileSystemUidValue)) |
|
1482 |
return KErrNotSupported; |
|
1483 |
||
1484 |
TExtensionNew e=(TExtensionNew)lib.Lookup(1); |
|
1485 |
if (!e) |
|
1486 |
return KErrCorrupt; |
|
1487 |
CProxyDriveFactory* pP=(*e)(); |
|
1488 |
if(!pP) |
|
1489 |
return KErrNoMemory; |
|
1490 |
TInt r=pP->Install(); |
|
1491 |
__PRINT1TEMP(_L("InstallExtension %S"),pP->Name()); |
|
1492 |
if (r==KErrNone) |
|
1493 |
{ |
|
1494 |
__PRINT(_L("TRAP(r,Extensions->AddL(pP,ETrue))")); |
|
1495 |
TRAP(r,Extensions->AddL(pP,ETrue)) |
|
1496 |
__PRINT1TEMP(_L("r == %d"), r); |
|
1497 |
if(r!=KErrNone) |
|
1498 |
pP->Remove(); |
|
1499 |
} |
|
1500 |
__PRINT1TEMP(_L("r == %d"), r); |
|
1501 |
if (r==KErrNone) |
|
1502 |
pP->SetLibrary(lib); |
|
1503 |
else |
|
1504 |
pP->Close(); |
|
1505 |
return(r); |
|
1506 |
} |
|
1507 |
||
1508 |
||
1509 |
TInt TFsAddExtension::Initialise(CFsRequest* aRequest) |
|
1510 |
// |
|
1511 |
// |
|
1512 |
// |
|
1513 |
{ |
|
1514 |
TSecurityPolicy policy(RProcess().SecureId(), ECapabilityTCB); |
|
1515 |
if (!policy.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Add File System Extension"))) |
|
1516 |
return KErrPermissionDenied; |
|
1517 |
return KErrNone; |
|
1518 |
} |
|
1519 |
||
1520 |
TInt TFsAddProxyDrive::DoRequestL(CFsRequest* aRequest) |
|
1521 |
// |
|
1522 |
// Load a proxy drive |
|
1523 |
// |
|
1524 |
{ |
|
1525 |
__PRINT(_L("TFsAddProxyDrive::DoRequestL(CFsRequest* aRequest)")); |
|
1526 |
||
1527 |
RLibrary lib; |
|
1528 |
// Get library handle |
|
1529 |
lib.SetHandle(aRequest->Message().Int0()); |
|
1530 |
if (lib.Type()[1]!=TUid::Uid(KFileSystemUidValue)) |
|
1531 |
return KErrNotSupported; |
|
1532 |
||
1533 |
TProxyDriveNew e=(TProxyDriveNew)lib.Lookup(1); |
|
1534 |
if (!e) |
|
1535 |
return KErrCorrupt; |
|
1536 |
CExtProxyDriveFactory* pP=(*e)(); |
|
1537 |
if(!pP) |
|
1538 |
return KErrNoMemory; |
|
1539 |
TInt r=pP->Install(); |
|
1540 |
__PRINT1TEMP(_L("Install Proxy Drive %S"),pP->Name()); |
|
1541 |
if (r==KErrNone) |
|
1542 |
{ |
|
1543 |
__PRINT(_L("TRAP(r,ProxyDrives->AddL(pP,ETrue))")); |
|
1544 |
TRAP(r,ProxyDrives->AddL(pP,ETrue)) |
|
1545 |
__PRINT1TEMP(_L("r == %d"), r); |
|
1546 |
if(r!=KErrNone) |
|
1547 |
pP->Remove(); |
|
1548 |
} |
|
1549 |
__PRINT1TEMP(_L("r == %d"), r); |
|
1550 |
if (r==KErrNone) |
|
1551 |
pP->SetLibrary(lib); |
|
1552 |
else |
|
1553 |
pP->Close(); |
|
1554 |
return(r); |
|
1555 |
} |
|
1556 |
||
1557 |
||
1558 |
TInt TFsAddProxyDrive::Initialise(CFsRequest* aRequest) |
|
1559 |
// |
|
1560 |
// |
|
1561 |
// |
|
1562 |
{ |
|
1563 |
TSecurityPolicy policy(RProcess().SecureId(), ECapabilityTCB); |
|
1564 |
if (!policy.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Add File System Proxy Drive"))) |
|
1565 |
return KErrPermissionDenied; |
|
1566 |
return KErrNone; |
|
1567 |
} |
|
1568 |
||
1569 |
TInt TFsMountExtension::DoRequestL(CFsRequest* aRequest) |
|
1570 |
// |
|
1571 |
// Mount an extension |
|
1572 |
// |
|
1573 |
{ |
|
1574 |
TFullName name; |
|
1575 |
aRequest->ReadL(KMsgPtr0,name); |
|
1576 |
CProxyDriveFactory* pE=GetExtension(name); |
|
1577 |
if (pE==NULL) |
|
1578 |
return(KErrNotFound); |
|
1579 |
return(aRequest->Drive()->MountExtension(pE,EFalse)); |
|
1580 |
} |
|
1581 |
||
1582 |
TInt TFsMountExtension::Initialise(CFsRequest* aRequest) |
|
1583 |
// |
|
1584 |
// |
|
1585 |
// |
|
1586 |
{ |
|
1587 |
TInt r=ValidateDrive(aRequest->Message().Int1(),aRequest); |
|
1588 |
if(r!=KErrNone) |
|
1589 |
return(r); |
|
1590 |
if(aRequest->Drive()->IsSubsted()) |
|
1591 |
return(KErrNotSupported); |
|
1592 |
return(r); |
|
1593 |
} |
|
1594 |
||
1595 |
||
1596 |
TInt TFsDismountExtension::DoRequestL(CFsRequest* aRequest) |
|
1597 |
// |
|
1598 |
// Dismount extension |
|
1599 |
// |
|
1600 |
{ |
|
1601 |
TFullName name; |
|
1602 |
aRequest->ReadL(KMsgPtr0,name); |
|
1603 |
CProxyDriveFactory* pE=GetExtension(name); |
|
1604 |
if (pE==NULL) |
|
1605 |
return(KErrNotFound); |
|
1606 |
return(aRequest->Drive()->DismountExtension(pE,EFalse)); |
|
1607 |
} |
|
1608 |
||
1609 |
||
1610 |
TInt TFsDismountExtension::Initialise(CFsRequest* aRequest) |
|
1611 |
// |
|
1612 |
// |
|
1613 |
// |
|
1614 |
{ |
|
1615 |
if (!KCapFsDismountExtension.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Dismount File Extension"))) |
|
1616 |
return KErrPermissionDenied; |
|
1617 |
TInt r=ValidateDrive(aRequest->Message().Int1(),aRequest); |
|
1618 |
if(r!=KErrNone) |
|
1619 |
return(r); |
|
1620 |
if(aRequest->Drive()->IsSubsted()) |
|
1621 |
return(KErrNotSupported); |
|
1622 |
return(r); |
|
1623 |
} |
|
1624 |
||
1625 |
TInt TFsRemoveExtension::DoRequestL(CFsRequest* aRequest) |
|
1626 |
// |
|
1627 |
// Remove an extension |
|
1628 |
// |
|
1629 |
{ |
|
1630 |
TFullName name; |
|
1631 |
aRequest->ReadL(KMsgPtr0,name); |
|
1632 |
CProxyDriveFactory* pE=GetExtension(name); |
|
1633 |
if (pE==NULL) |
|
1634 |
return(KErrNotFound); |
|
1635 |
TInt r=pE->Remove(); |
|
1636 |
if (r!=KErrNone) |
|
1637 |
return(r); |
|
1638 |
RLibrary lib=pE->Library(); |
|
1639 |
pE->Close(); |
|
1640 |
lib.Close(); |
|
1641 |
return(KErrNone); |
|
1642 |
} |
|
1643 |
||
1644 |
||
1645 |
TInt TFsRemoveExtension::Initialise(CFsRequest* aRequest) |
|
1646 |
// |
|
1647 |
// |
|
1648 |
// |
|
1649 |
{ |
|
1650 |
if (!KCapFsRemoveExtension.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Remove File Extension"))) |
|
1651 |
return KErrPermissionDenied; |
|
1652 |
return KErrNone; |
|
1653 |
} |
|
1654 |
||
1655 |
TInt TFsRemoveProxyDrive::DoRequestL(CFsRequest* aRequest) |
|
1656 |
// |
|
1657 |
// Remove a proxy drive |
|
1658 |
// |
|
1659 |
{ |
|
1660 |
TFullName name; |
|
1661 |
aRequest->ReadL(KMsgPtr0,name); |
|
1662 |
||
1663 |
CExtProxyDriveFactory* pD=GetProxyDriveFactory(name); |
|
1664 |
// are there any mounted drives using this extension? |
|
1665 |
if (LocalDrives::IsProxyDriveInUse(pD)) return KErrInUse; |
|
1666 |
if (pD==NULL) |
|
1667 |
return(KErrNotFound); |
|
1668 |
TInt r=pD->Remove(); |
|
1669 |
if (r!=KErrNone) |
|
1670 |
return(r); |
|
1671 |
RLibrary lib=pD->Library(); |
|
1672 |
pD->Close(); |
|
1673 |
lib.Close(); |
|
1674 |
||
1675 |
return(KErrNone); |
|
1676 |
} |
|
1677 |
||
1678 |
||
1679 |
TInt TFsRemoveProxyDrive::Initialise(CFsRequest* aRequest) |
|
1680 |
// |
|
1681 |
// |
|
1682 |
// |
|
1683 |
{ |
|
1684 |
if (!KCapFsRemoveProxyDrive.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Remove Proxy Drive"))) |
|
1685 |
return KErrPermissionDenied; |
|
1686 |
return KErrNone; |
|
1687 |
} |
|
1688 |
||
1689 |
TInt TFsExtensionName::DoRequestL(CFsRequest* aRequest) |
|
1690 |
// |
|
1691 |
// Return the name of an extension for a given drive and extension chain position |
|
1692 |
// |
|
1693 |
{ |
|
1694 |
TFullName name; |
|
1695 |
TInt r=aRequest->Drive()->ExtensionName(name,aRequest->Message().Int2()); |
|
1696 |
if(r==KErrNone) |
|
1697 |
aRequest->WriteL(KMsgPtr0,name); |
|
1698 |
return(r); |
|
1699 |
} |
|
1700 |
||
1701 |
TInt TFsExtensionName::Initialise(CFsRequest* aRequest) |
|
1702 |
// |
|
1703 |
// |
|
1704 |
// |
|
1705 |
{ |
|
1706 |
TInt r=ValidateDrive(aRequest->Message().Int1(),aRequest); |
|
1707 |
if(r!=KErrNone) |
|
1708 |
return(r); |
|
1709 |
if(aRequest->Drive()->IsSubsted()) |
|
1710 |
return(KErrNotSupported); |
|
1711 |
return(r); |
|
1712 |
} |
|
1713 |
||
1714 |
TInt TFsDismountProxyDrive::DoRequestL(CFsRequest* aRequest) |
|
1715 |
// |
|
1716 |
// Dismount a proxy extension |
|
1717 |
// |
|
1718 |
{ |
|
1719 |
||
1720 |
__PRINT(_L("TFsDismountProxyDrive::DoRequestL")); |
|
1721 |
||
1722 |
return aRequest->Drive()->DismountProxyDrive(); |
|
1723 |
} |
|
1724 |
||
1725 |
||
1726 |
TInt TFsDismountProxyDrive::Initialise(CFsRequest* aRequest) |
|
1727 |
// |
|
1728 |
// |
|
1729 |
// |
|
1730 |
{ |
|
1731 |
if (!KCapFsDismountProxyDrive.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Dismount Proxy Drive"))) |
|
1732 |
return KErrPermissionDenied; |
|
1733 |
||
1734 |
TInt r=ValidateDrive(aRequest->Message().Int0(),aRequest); |
|
1735 |
if(r!=KErrNone) |
|
1736 |
return(r); |
|
1737 |
||
1738 |
return KErrNone; |
|
1739 |
} |
|
1740 |