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