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