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