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