Update contrib.
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".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // f32\sfile\sf_ext.cpp
21 typedef CProxyDriveFactory*(*TExtensionNew)();
22 typedef CExtProxyDriveFactory*(*TProxyDriveNew)();
28 Initialises drive extension count to zero.
30 TDriveExtInfo::TDriveExtInfo(){iCount=0;}
36 Note that the class is intended only as an abstract base for other classes.
38 @panic FSERV 51 if the supplied CMountCB pointer is NULL.
40 CProxyDrive::CProxyDrive(CMountCB* aMount)
43 // __ASSERT_DEBUG(iMount!=NULL,Fault(EProxyDriveConstruction));
50 Frees resources before destruction of the object.
52 CProxyDrive::~CProxyDrive()
59 An interface with which control commands can be passed to
60 the appropriate driver layer.
62 This base implementation performs no operations.
64 @param aMessage Message to be sent.
65 @param aCommand Command type.
66 @param aParam1 1st parameter of control message.
67 @param aParam2 2nd parameter of control message.
71 EXPORT_C TInt CProxyDrive::ControlIO(const RMessagePtr2& /*aMessage*/,TInt /*aCommand*/,TAny* /*aParam1*/,TAny* /*aParam2*/)
73 // General purpose function for use by specific file systems and extensions
80 General purpose read function for use by specific file systems and extensions.
82 This base implementation performs no operations.
84 @param aPos The address from where the read begins.
85 @param aLength The length of the read.
86 @param aTrg A descriptor of the memory buffer from which to read.
87 @param aThreadHandle The handle-number representing the drive thread.
88 @param aOffset Offset into aTrg to read the data from.
89 @param aFlags Flags to be passed into the driver.
93 EXPORT_C TInt CProxyDrive::Read(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aTrg*/,TInt /*aThreadHandle*/,TInt /*aOffset*/, TInt /*aFlags*/)
99 General purpose write function for use by specific file systems and extensions.
101 This base implementation performs no operations.
103 @param aPos The address from where the write begins.
104 @param aLength The length of the write.
105 @param aSrc A descriptor of the memory buffer from which to write.
106 @param aThreadHandle The handle-number representing the drive thread.
107 @param aOffset Offset into aSrc to write the data to.
108 @param aFlags Flags to be passed into the driver.
112 EXPORT_C TInt CProxyDrive::Write(TInt64 /*aPos*/,TInt /*aLength*/,const TAny* /*aSrc*/,TInt /*aThreadHandle*/,TInt /*aOffset*/, TInt /*aFlags*/)
119 Issue a notification that a physical delete has occurred.
120 For example a cluster or partition has been freed.
122 This base implementation performs no operations.
124 @param aPos The position of the data which is being deleted.
125 @param aLength The length of the data which is being deleted.
129 EXPORT_C TInt CProxyDrive::DeleteNotify(TInt64 /*aPos*/, TInt /*aLength*/)
135 An interface with which information can be retrieved about disk errors.
137 This base implementation performs no operations.
139 @param aErrorInfo Reference to a descriptor containing disk error information.
143 EXPORT_C TInt CProxyDrive::GetLastErrorInfo(TDes8& /*aErrorInfo*/)
145 return(KErrNotSupported);
148 EXPORT_C TInt CProxyDrive::GetLocalDrive(TBusLocalDrive*& aLocDrv)
150 return (GetInterface(EGetLocalDrive, (TAny*&)aLocDrv, (TAny*)this)); // this GetInterface does the dirty work for you...
153 EXPORT_C TInt CProxyDrive::Finalise(TBool aIsFinalised)
155 TAny* dummyInterface;
156 return (GetInterface(EFinalised, dummyInterface, (TAny*)aIsFinalised));
161 Called to get a Proxy drive interface.
163 @param aInterfaceId Interface identifier of the interface to be retrieved.
164 @param aInterface Address of variable that retrieves the specified interface.
165 @param aInput Data required for the instantiation of the interface.
167 This base implementation performs no operations.
169 @return KErrNotSupported
171 EXPORT_C TInt CProxyDrive::GetInterface(TInt /*aInterfaceId*/,TAny*& /*aInterface*/,TAny* /*aInput*/)
173 return(KErrNotSupported);
180 EXPORT_C CLocDrvMountCB::CLocDrvMountCB() {}
186 Frees assigned Proxy drive before destruction of the object.
188 EXPORT_C CLocDrvMountCB::~CLocDrvMountCB()
190 __PRINT1(_L("CLocDrvMountCB::~CLocDrvMountCB() 0x%x"),this);
191 if(iProxyDrive && !LocalDrives::IsProxyDrive(Drive().DriveNumber()) && LocalDrives::IsValidDriveMapping(Drive().DriveNumber()))
197 Creates and initialises the local drive.
199 @param aLocDrv The local drive to be created
201 @return System wide error code.
203 EXPORT_C TInt CLocDrvMountCB::CreateLocalDrive(TBusLocalDrive& aLocDrv)
205 __PRINT(_L("CLocDrvMountCB::CreateLocalDrive()"));
206 if(iProxyDrive!=NULL)
209 CProxyDrive* pConcrete=CLocalProxyDrive::New(this,aLocDrv);
216 // if failure then pConcrete will be deleted by CreateProxyDriveL()
217 TRAP(r,iProxyDrive=CreateProxyDriveL(pConcrete,this));
221 __PRINT1(_L("CreateLocalDrive r=%d"),r);
225 EXPORT_C TInt CLocDrvMountCB::CreateDrive(TInt aDriveNumber)
227 Ascertain if the drive is mapped to a local drive or a proxy drive, and create the drive
229 @param aDriveNumer drive number
230 @return KErrNone on success
231 KErrArgument is the drive is not mapped to a proxy or a local drive or if the number
235 // dunno why we are using TInts instead of TUints here
236 __PRINT(_L("CLocDrvMountCB::CreateLocalDrive()"));
238 if (aDriveNumber<0 || aDriveNumber>=KMaxDrives) return KErrArgument;
240 TInt aDriveLocal = LocalDrives::DriveNumberToLocalDriveNumber(aDriveNumber);
241 if (aDriveLocal == KDriveInvalid) return KErrArgument;
242 if (aDriveLocal < KMaxLocalDrives)
244 return CreateLocalDrive(LocalDrives::GetLocalDrive(aDriveNumber)); // drive is really local
248 CExtProxyDrive* pProxyDrive = LocalDrives::GetProxyDrive(aDriveNumber);
249 __ASSERT_ALWAYS(pProxyDrive != NULL,User::Panic(_L("CreateDrive - pProxyDrive == NULL"), -999));
251 iProxyDrive = CreateProxyDriveL(pProxyDrive, this);
252 __ASSERT_ALWAYS(iProxyDrive != NULL,User::Panic(_L("CreateDrive - CreateProxyDrive returned NULL"), -999));
254 r = InitLocalDrive();
262 Initialise the local drive
264 @panic FSERV 52 if initialise when no local drive exists.
266 @return system wide error code
268 EXPORT_C TInt CLocDrvMountCB::InitLocalDrive()
270 __ASSERT_ALWAYS(iProxyDrive!=NULL,Fault(ELocDrvInitLocalDrive));
271 iProxyDrive->SetMount(this);
272 return(iProxyDrive->Initialise());
276 Dismount the local drive
278 @panic FSERV 53 if dismount when no local drive exists.
280 EXPORT_C void CLocDrvMountCB::DismountedLocalDrive()
282 __ASSERT_ALWAYS(iProxyDrive!=NULL,Fault(ELocDrvDismountedLocalDrive));
283 iProxyDrive->Dismounted();
284 iProxyDrive->SetMount(NULL);
291 Instatiates a CLocalProxyDrive objects with the given arguments.
293 @param aMount The mount control block
294 @param aLocDrv The local drive.
296 @return pointer to instantiated CLocalProxyDrive object.
298 CLocalProxyDrive* CLocalProxyDrive::New(CMountCB* aMount,TBusLocalDrive& aLocDrv)
300 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveNew, EF32TraceUidProxyDrive,
301 aMount, aMount->DriveNumber());
303 CLocalProxyDrive* proxyDrive = new CLocalProxyDrive(aMount,aLocDrv);
305 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveNewRet, EF32TraceUidProxyDrive, proxyDrive);
312 @param aMount The mount control block.
313 @param aLocDrv The local drive.
315 CLocalProxyDrive::CLocalProxyDrive(CMountCB* aMount,TBusLocalDrive& aLocDrv)
316 :CProxyDrive(aMount),iLocDrv(aLocDrv)
318 __PRINT(_L("CLocalProxyDrive::CLocalProxyDrive()"));
323 Initialise the connected drive.
325 This implementation performs no operations.
329 TInt CLocalProxyDrive::Initialise()
331 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveInitialise, EF32TraceUidProxyDrive, this);
332 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveInitialiseRet, EF32TraceUidProxyDrive, KErrNone);
339 Ensures any cached data is flushed before unmounting drive.
341 This implementation performs no operations.
345 TInt CLocalProxyDrive::Dismounted()
347 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDismounted, EF32TraceUidProxyDrive, this);
348 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDismountedRet, EF32TraceUidProxyDrive, KErrNone);
355 Increase the size of the connected drive by the specified length (in bytes).
357 @param aLength The length/size (in bytes) by which the drive is to be increased.
359 @return system wide error code.
361 TInt CLocalProxyDrive::Enlarge(TInt aLength)
363 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveEnlarge, EF32TraceUidProxyDrive, this, aLength);
365 TInt r = iLocDrv.Enlarge(aLength);
367 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveEnlargeRet, EF32TraceUidProxyDrive, r);
373 Reduce the size of the connected drive by removing the specified length
374 (in bytes) starting at the specified position.
375 Refer to relevant media driver documentation for implementation/restriction
378 @param aPos The start position of area to be removed.
379 @param aLength The length of the data which is being removed.
381 @return system wide error code.
383 TInt CLocalProxyDrive::ReduceSize(TInt aPos, TInt aLength)
385 TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveReduceSize, EF32TraceUidProxyDrive, this, aPos, aLength);
387 TInt r = iLocDrv.ReduceSize(aPos,aLength);
389 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveReduceSizeRet, EF32TraceUidProxyDrive, r);
395 Read from the connected drive, and pass flags to driver.
397 @param aPos The address from where the read begins.
398 @param aLength The length of the read.
399 @param aTrg A descriptor of the memory buffer from which to read.
400 @param aThreadHandle The handle-number representing the drive thread.
401 @param aOffset Offset into aTrg to read the data from.
402 @param aFlags Flags to be passed into the driver.
404 @return system wide error code.
406 TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset, TInt aFlags)
408 TRACETHREADIDH(aThreadHandle);
409 TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead1, EF32TraceUidProxyDrive,
410 this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, aOffset, aFlags);
412 TInt r = iLocDrv.Read(aPos,aLength,aTrg,aThreadHandle,aOffset,aFlags);
414 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead1Ret, EF32TraceUidProxyDrive, r);
419 Read from the connected drive.
421 @param aPos The address from where the read begins.
422 @param aLength The length of the read.
423 @param aTrg A descriptor of the memory buffer from which to read.
424 @param aThreadHandle The handle-number representing the drive thread.
425 @param aOffset Offset into aTrg to read the data from.
427 @return system wide error code.
429 TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)
431 TRACETHREADIDH(aThreadHandle);
432 TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead2, EF32TraceUidProxyDrive,
433 this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, anOffset);
435 TInt r = iLocDrv.Read(aPos,aLength,aTrg,aThreadHandle,anOffset);
437 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead2Ret, EF32TraceUidProxyDrive, r);
442 Read from the connected drive.
444 @param aPos The address from where the read begins.
445 @param aLength The length of the read.
446 @param aTrg A descriptor of the memory buffer from which to read.
448 @return system wide error code.
450 TInt CLocalProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg)
452 TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead3, EF32TraceUidProxyDrive,
453 this, I64LOW(aPos), I64HIGH(aPos), aLength, &aTrg);
455 TInt r = iLocDrv.Read(aPos,aLength,aTrg);
457 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveRead3Ret, EF32TraceUidProxyDrive, r);
463 Write to the connected drive and pass flags to driver.
465 @param aPos The address from where the write begins.
466 @param aLength The length of the write.
467 @param aSrc A descriptor of the memory buffer from which to write.
468 @param aThreadHandle The handle-number representing the drive thread.
469 @param aOffset Offset into aSrc to write the data to.
470 @param aFlags Flags to be passed into the driver.
472 @return system wide error code.
474 TInt CLocalProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags)
476 TRACETHREADIDH(aThreadHandle);
477 TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite1, EF32TraceUidProxyDrive,
478 this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, aOffset, aFlags);
480 TInt r = iLocDrv.Write(aPos,aLength,aSrc,aThreadHandle,aOffset,aFlags);
482 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite1Ret, EF32TraceUidProxyDrive, r);
489 Write to the connected drive.
491 @param aPos The address from where the write begins.
492 @param aLength The length of the write.
493 @param aSrc A descriptor of the memory buffer from which to write.
494 @param aThreadHandle The handle-number representing the drive thread.
495 @param aOffset Offset into aSrc to write the data to.
497 @return system wide error code.
499 TInt CLocalProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)
501 TRACETHREADIDH(aThreadHandle);
502 TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite2, EF32TraceUidProxyDrive,
503 this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, anOffset);
505 TInt r = iLocDrv.Write(aPos,aLength,aSrc,aThreadHandle,anOffset);
507 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite2Ret, EF32TraceUidProxyDrive, r);
513 Write to the connected drive.
515 @param aPos The address from where the write begins.
516 @param aSrc A descriptor of the memory buffer from which to write.
518 @return system wide error code.
520 TInt CLocalProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
522 TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite3, EF32TraceUidProxyDrive,
523 this, I64LOW(aPos), I64HIGH(aPos), aSrc.Length(), &aSrc);
525 TInt r = iLocDrv.Write(aPos,aSrc);
527 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveWrite3Ret, EF32TraceUidProxyDrive, r);
533 Get the connected drive's capabilities information.
535 @param anInfo A descriptor of the connected drives capabilities.
537 @return system wide error code
539 TInt CLocalProxyDrive::Caps(TDes8& anInfo)
541 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveCaps, EF32TraceUidProxyDrive, this);
543 TInt r = iLocDrv.Caps(anInfo);
545 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveCapsRet, EF32TraceUidProxyDrive, r);
551 Format the connected drive.
553 @param anInfo Device specific format information.
555 @return system wide error code.
557 TInt CLocalProxyDrive::Format(TFormatInfo& anInfo)
559 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat1, EF32TraceUidProxyDrive, this);
561 TInt r = iLocDrv.Format(anInfo);
563 TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat1Ret, EF32TraceUidProxyDrive,
564 r, anInfo.iFormatIsCurrent, anInfo.i512ByteSectorsFormatted, anInfo.iMaxBytesPerFormat);
570 Format the connected drive.
572 @param aPos The position of the data which is being formatted.
573 @param aLength The length of the data which is being formatted.
575 @return system wide error code.
577 TInt CLocalProxyDrive::Format(TInt64 aPos,TInt aLength)
579 TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat2, EF32TraceUidProxyDrive,
580 this, I64LOW(aPos), I64HIGH(aPos), aLength);
582 TInt r = iLocDrv.Format(aPos,aLength);
584 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveFormat2Ret, EF32TraceUidProxyDrive, r);
590 Set the mount information on the local drive.
592 @param aMountInfo Information passed down to the media driver. The meaning of this information depends on the media driver.
593 @param aMountInfoThreadHandle Message thread handle number.
595 @return system wide error code.
597 TInt CLocalProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle)
599 TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveSetMountInfo, EF32TraceUidProxyDrive, this, aMountInfo, aMountInfoThreadHandle);
601 TInt r = iLocDrv.SetMountInfo(aMountInfo,aMountInfoThreadHandle);
603 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveSetMountInfoRet, EF32TraceUidProxyDrive, r);
609 Forces a remount on the local drive
611 @param aFlags Flags to be passed into the driver.
613 @return system wide error code.
615 TInt CLocalProxyDrive::ForceRemount(TUint aFlags)
617 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveForceRemount, EF32TraceUidProxyDrive, this, aFlags);
619 TInt r = iLocDrv.ForceRemount(aFlags);
621 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveForceRemountRet, EF32TraceUidProxyDrive, r);
626 An interface with which control commands can be passed to
627 the appropriate driver layer.
629 @param aMessage Message to be sent.
630 @param aCommand Command type.
631 @param aParam1 1st parameter of control message.
632 @param aParam2 2nd parameter of control message.
634 @return system wide error code.
636 TInt CLocalProxyDrive::ControlIO(const RMessagePtr2& /*aMessage*/,TInt aCommand,TAny* aParam1,TAny* aParam2)
638 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveControlIO, EF32TraceUidProxyDrive, this);
640 TInt r = iLocDrv.ControlIO(aCommand,aParam1,aParam2);
642 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveControlIORet, EF32TraceUidProxyDrive, r);
648 Unlocks a password-enabled device.
650 @param aPassword A descriptor containing the existing password.
651 @param aStorePassword If ETrue, the password is added to the password store.
653 @return system wide error code.
655 TInt CLocalProxyDrive::Unlock(TMediaPassword &aPassword, TBool aStorePassword)
657 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveUnlock, EF32TraceUidProxyDrive, this, aStorePassword);
659 TInt r = iLocDrv.Unlock(aPassword,aStorePassword);
661 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveUnlockRet, EF32TraceUidProxyDrive, r);
667 Locks a password-enabled device with the new password.
669 @param aOldPassword A descriptor containing the existing password.
670 @param aNewPassword A descriptor containing the new password.
671 @param aStorePassword If ETrue, the password is added to the password store.
673 @return system wide error code.
675 TInt CLocalProxyDrive::Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)
677 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveLock, EF32TraceUidProxyDrive, this, aStorePassword);
679 TInt r = iLocDrv.SetPassword(aOldPassword,aNewPassword,aStorePassword);
681 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveLockRet, EF32TraceUidProxyDrive, r);
687 Clears a password from a device - controller sets password to null.
689 @param aPassword A descriptor containing the password.
691 @return system wide error code.
693 TInt CLocalProxyDrive::Clear(TMediaPassword &aPassword)
695 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveClear, EF32TraceUidProxyDrive, this);
697 TInt r = iLocDrv.Clear(aPassword);
699 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveClearRet, EF32TraceUidProxyDrive, r);
704 Forcibly unlock a password-enabled drive.
706 @return system wide error code.
708 TInt CLocalProxyDrive::ErasePassword()
710 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveErasePassword, EF32TraceUidProxyDrive, this);
712 TInt r = iLocDrv.ErasePassword();
714 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveErasePasswordRet, EF32TraceUidProxyDrive, r);
719 Notify the media driver that an area of the partition has been deleted.
720 Used by some media drivers (e.g. NAND flash) for garbage collection.
722 @param aPos The position of the data which is being deleted.
723 @param aLength The length of the data which is being deleted.
725 @return System wide error code.
727 TInt CLocalProxyDrive::DeleteNotify(TInt64 aPos, TInt aLength)
729 TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDeleteNotify, EF32TraceUidProxyDrive,
730 this, I64LOW(aPos), I64HIGH(aPos), aLength);
732 TInt r = iLocDrv.DeleteNotify(aPos, aLength);
734 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveDeleteNotifyRet, EF32TraceUidProxyDrive, r);
740 Retrieve disk error information.
742 @param aErrorInfo Reference to a descriptor containing disk error information.
744 @return System wide error code.
746 TInt CLocalProxyDrive::GetLastErrorInfo(TDes8 &aErrorInfo)
748 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetLastErrorInfo, EF32TraceUidProxyDrive, this);
750 TInt r = iLocDrv.GetLastErrorInfo(aErrorInfo);
752 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetLastErrorInfoRet, EF32TraceUidProxyDrive, r);
757 TInt CLocalProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput)
759 TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetInterface, EF32TraceUidProxyDrive,
760 this, aInterfaceId, aInput);
766 __ASSERT_ALWAYS((CProxyDrive*)aInput==this,Fault(ELocDrvInvalidLocalDrive));
767 (TBusLocalDrive*&)aInterface=&iLocDrv;
771 case ELocalBufferSupport:
777 r= CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput);
780 TRACERET2(UTF::EBorder, UTraceModuleProxyDrive::ECLocalProxyDriveGetInterfaceRet, EF32TraceUidProxyDrive, r, aInterface);
789 @panic FSERV 54 if the supplied CMountCB pointer is NULL.
791 EXPORT_C CBaseExtProxyDrive::CBaseExtProxyDrive(CProxyDrive* aProxyDrive, CMountCB* aMount)
792 :CProxyDrive(aMount),iProxy(aProxyDrive)
794 __ASSERT_DEBUG(iProxy!=NULL,Fault(EBaseExtConstruction));
800 Frees resources before destruction of the object.
802 EXPORT_C CBaseExtProxyDrive::~CBaseExtProxyDrive()
809 Initialise the proxy drive.
811 This implementation performs no operations.
813 @return system wide error code.
815 EXPORT_C TInt CBaseExtProxyDrive::Initialise()
817 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveInitialise, EF32TraceUidProxyDrive, this);
819 TInt r = iProxy->Initialise();
821 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveInitialiseRet, EF32TraceUidProxyDrive, r);
827 Calls Dismounted() on the proxy drive.
831 EXPORT_C TInt CBaseExtProxyDrive::Dismounted()
833 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDismounted, EF32TraceUidProxyDrive, this);
835 TInt r = iProxy->Dismounted();
837 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDismountedRet, EF32TraceUidProxyDrive, r);
842 Increase the size of the proxy drive by the specified length (in bytes).
844 @param aLength The length (in bytes) of which the drive is to be increased by.
846 @return system wide error code.
848 EXPORT_C TInt CBaseExtProxyDrive::Enlarge(TInt aLength)
850 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveEnlarge, EF32TraceUidProxyDrive, this, aLength);
852 TInt r = iProxy->Enlarge(aLength);
854 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveEnlargeRet, EF32TraceUidProxyDrive, r);
860 Reduce the size of the proxy drive by removing the specified length
861 (in bytes) starting at the specified position.
862 Refer to relevant media driver documentation for implementation/restriction
865 @param aPos The start position of area to be removed.
866 @param aLength The length/size (in bytes) by which the drive is to be reduced.
868 @return system wide error code.
870 EXPORT_C TInt CBaseExtProxyDrive::ReduceSize(TInt aPos, TInt aLength)
872 TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveReduceSize, EF32TraceUidProxyDrive, this, aPos, aLength);
874 TInt r = iProxy->ReduceSize(aPos,aLength);
876 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveReduceSizeRet, EF32TraceUidProxyDrive, r);
882 Read from the proxy drive, and pass flags to driver.
884 @param aPos The address from where the read begins.
885 @param aLength The length of the read.
886 @param aTrg A descriptor of the memory buffer from which to read.
887 @param aThreadHandle The handle-number representing the drive thread.
888 @param aOffset Offset into aTrg to read the data from.
889 @param aFlags Flags to be passed into the driver.
891 @return system wide error code.
893 EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt aOffset,TInt aFlags)
895 TRACETHREADIDH(aThreadHandle);
896 TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead1, EF32TraceUidProxyDrive,
897 this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, aOffset, aFlags);
899 TInt r = iProxy->Read(aPos,aLength,aTrg,aThreadHandle,aOffset,aFlags);
901 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead1Ret, EF32TraceUidProxyDrive, r);
908 Read from the proxy drive.
910 @param aPos The address from where the read begins.
911 @param aLength The length of the read.
912 @param aTrg A descriptor of the memory buffer from which to read.
913 @param aThreadHandle The handle-number representing the drive thread.
914 @param aOffset Offset into aTrg to read the data from.
916 @return system wide error code.
918 EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,TInt aThreadHandle,TInt anOffset)
920 TRACETHREADIDH(aThreadHandle);
921 TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead2, EF32TraceUidProxyDrive,
922 this, I64LOW(aPos), I64HIGH(aPos), aLength, aTrg, threadId, anOffset);
924 TInt r = iProxy->Read(aPos,aLength,aTrg,aThreadHandle,anOffset);
926 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead2Ret, EF32TraceUidProxyDrive, r);
932 Read from the proxy drive.
934 @param aPos The address from where the read begins.
935 @param aLength The length of the read.
936 @param aTrg A descriptor of the memory buffer from which to read.
938 @return system wide error code.
940 EXPORT_C TInt CBaseExtProxyDrive::Read(TInt64 aPos,TInt aLength,TDes8& aTrg)
942 TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead3, EF32TraceUidProxyDrive,
943 this, I64LOW(aPos), I64HIGH(aPos), aLength, &aTrg);
945 TInt r = iProxy->Read(aPos,aLength,aTrg);
947 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveRead3Ret, EF32TraceUidProxyDrive, r);
953 Write to the proxy drive and pass flags to driver.
955 @param aPos The address from where the write begins.
956 @param aLength The length of the write.
957 @param aSrc A descriptor of the memory buffer from which to write.
958 @param aThreadHandle The handle-number representing the drive thread.
959 @param aOffset Offset into aSrc to write the data to.
960 @param aFlags Flags to be passed into the driver.
962 @return system wide error code.
964 EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt aOffset,TInt aFlags)
966 TRACETHREADIDH(aThreadHandle);
967 TRACE8(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite1, EF32TraceUidProxyDrive,
968 this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, aOffset, aFlags);
970 TInt r = iProxy->Write(aPos,aLength,aSrc,aThreadHandle,aOffset,aFlags);
972 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite1Ret, EF32TraceUidProxyDrive, r);
978 Write to the proxy drive.
980 @param aPos The address from where the write begins.
981 @param aLength The length of the write.
982 @param aSrc A descriptor of the memory buffer from which to write.
983 @param aThreadHandle The handle-number representing the drive thread.
984 @param aOffset Offset into aSrc to write the data to.
986 @return system wide error code.
988 EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,TInt aThreadHandle,TInt anOffset)
990 TRACETHREADIDH(aThreadHandle);
991 TRACE7(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite2, EF32TraceUidProxyDrive,
992 this, I64LOW(aPos), I64HIGH(aPos), aLength, aSrc, threadId, anOffset);
994 TInt r = iProxy->Write(aPos,aLength,aSrc,aThreadHandle,anOffset);
996 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite2Ret, EF32TraceUidProxyDrive, r);
1002 Write to the proxy drive.
1004 @param aPos The address from where the write begins.
1005 @param aSrc A descriptor of the memory buffer from which to write.
1007 @return system wide error code.
1009 EXPORT_C TInt CBaseExtProxyDrive::Write(TInt64 aPos,const TDesC8& aSrc)
1011 TRACE5(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite3, EF32TraceUidProxyDrive,
1012 this, I64LOW(aPos), I64HIGH(aPos), aSrc.Length(), &aSrc);
1014 TInt r = iProxy->Write(aPos,aSrc);
1016 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveWrite3Ret, EF32TraceUidProxyDrive, r);
1022 Get the proxy drive's capabilities information.
1024 @param anInfo A descriptor of the connected drives capabilities.
1026 @return system wide error code
1028 EXPORT_C TInt CBaseExtProxyDrive::Caps(TDes8& anInfo)
1030 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveCaps, EF32TraceUidProxyDrive, this);
1032 TInt r = iProxy->Caps(anInfo);
1034 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveCapsRet, EF32TraceUidProxyDrive, r);
1040 Format the connected drive.
1042 @param anInfo Device specific format information.
1044 @return system wide error code.
1046 EXPORT_C TInt CBaseExtProxyDrive::Format(TFormatInfo& anInfo)
1048 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat1, EF32TraceUidProxyDrive, this);
1050 TInt r = iProxy->Format(anInfo);
1052 TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat1Ret, EF32TraceUidProxyDrive,
1053 r, anInfo.iFormatIsCurrent, anInfo.i512ByteSectorsFormatted, anInfo.iMaxBytesPerFormat);
1059 Format the proxy drive.
1061 @param aPos The position of the data which is being formatted.
1062 @param aLength The length of the data which is being formatted.
1064 @return system wide error code.
1066 EXPORT_C TInt CBaseExtProxyDrive::Format(TInt64 aPos,TInt aLength)
1068 TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat2, EF32TraceUidProxyDrive,
1069 this, I64LOW(aPos), I64HIGH(aPos), aLength);
1071 TInt r = iProxy->Format(aPos,aLength);
1073 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveFormat2Ret, EF32TraceUidProxyDrive, r);
1079 Set the mount information on the proxy drive.
1081 @param aMountInfo Information passed down to the media driver. The meaning of this information depends on the media driver.
1082 @param aMountInfoThreadHandle Message thread handle number.
1084 @return system wide error code.
1086 EXPORT_C TInt CBaseExtProxyDrive::SetMountInfo(const TDesC8* aMountInfo,TInt aMountInfoThreadHandle)
1088 TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveSetMountInfo, EF32TraceUidProxyDrive, this, aMountInfo, aMountInfoThreadHandle);
1090 TInt r = iProxy->SetMountInfo(aMountInfo,aMountInfoThreadHandle);
1092 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveSetMountInfoRet, EF32TraceUidProxyDrive, r);
1098 Forces a remount on the proxy drive
1100 @param aFlags Flags to be passed into the driver.
1102 @return system wide error code.
1104 EXPORT_C TInt CBaseExtProxyDrive::ForceRemount(TUint aFlags)
1106 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveForceRemount, EF32TraceUidProxyDrive, this, aFlags);
1108 TInt r = iProxy->ForceRemount(aFlags);
1110 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveForceRemountRet, EF32TraceUidProxyDrive, r);
1116 Unlocks a password-enabled proxy drive.
1118 @param aPassword A descriptor containing the existing password.
1119 @param aStorePassword If ETrue, the password is added to the password store.
1121 @return system wide error code.
1123 EXPORT_C TInt CBaseExtProxyDrive::Unlock(TMediaPassword &aPassword, TBool aStorePassword)
1125 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveUnlock, EF32TraceUidProxyDrive, this, aStorePassword);
1127 TInt r = iProxy->Unlock(aPassword,aStorePassword);
1129 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveUnlockRet, EF32TraceUidProxyDrive, r);
1135 Locks a password-enabled proxy drive with the new password.
1137 @param aOldPassword A descriptor containing the existing password.
1138 @param aNewPassword A descriptor containing the new password.
1139 @param aStorePassword If ETrue, the password is added to the password store.
1141 @return system wide error code.
1143 EXPORT_C TInt CBaseExtProxyDrive::Lock(TMediaPassword &aOldPassword, TMediaPassword &aNewPassword, TBool aStorePassword)
1145 TRACE2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveLock, EF32TraceUidProxyDrive, this, aStorePassword);
1147 TInt r = iProxy->Lock(aOldPassword,aNewPassword,aStorePassword);
1149 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveLockRet, EF32TraceUidProxyDrive, r);
1155 Clears a password from a proxy drive - controller sets password to null.
1157 @param aPassword A descriptor containing the password.
1159 @return system wide error code.
1161 EXPORT_C TInt CBaseExtProxyDrive::Clear(TMediaPassword &aPassword)
1163 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveClear, EF32TraceUidProxyDrive, this);
1165 TInt r = iProxy->Clear(aPassword);
1167 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveClearRet, EF32TraceUidProxyDrive, r);
1172 Forcibly unlock a password-enabled proxy drive.
1174 @return system wide error code.
1176 EXPORT_C TInt CBaseExtProxyDrive::ErasePassword()
1178 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveErasePassword, EF32TraceUidProxyDrive, this);
1180 TInt r = iProxy->ErasePassword();
1182 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveErasePasswordRet, EF32TraceUidProxyDrive, r);
1187 An interface with which control commands can be passed to
1188 the appropriate driver layer.
1190 @param aMessage Message to be sent.
1191 @param aCommand Command type.
1192 @param aParam1 1st parameter of control message.
1193 @param aParam2 2nd parameter of control message.
1195 @return system wide error code.
1197 EXPORT_C TInt CBaseExtProxyDrive::ControlIO(const RMessagePtr2& aMessage,TInt aCommand,TAny* aParam1,TAny* aParam2)
1199 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveControlIO, EF32TraceUidProxyDrive, this);
1201 TInt r = iProxy->ControlIO(aMessage,aCommand,aParam1,aParam2);
1203 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveControlIORet, EF32TraceUidProxyDrive, r);
1209 Initialise the provided interface extension.
1211 @param aInterfaceId Interface identifier of the interface to be retrieved.
1212 @param aInterface Address of variable that retrieves the specified interface.
1213 @param aInput Data required for the instantiation of the interface.
1215 @return system wide error code.
1217 EXPORT_C TInt CBaseExtProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput)
1219 TRACE3(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetInterface, EF32TraceUidProxyDrive,
1220 this, aInterfaceId, aInput);
1223 if (aInterfaceId==EGetLocalDrive)
1225 r = iProxy->GetLocalDrive((TBusLocalDrive*&)aInterface); // iProxy is of type CLocalProxyDrive, so OK to reenter
1228 r = CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput);
1230 TRACERET2(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetInterfaceRet, EF32TraceUidProxyDrive, r, aInterface);
1236 Retrieve proxy drive disk error information.
1238 @param aErrorInfo Reference to a descriptor containing disk error information.
1240 @return System wide error code.
1242 EXPORT_C TInt CBaseExtProxyDrive::GetLastErrorInfo(TDes8 &aErrorInfo)
1244 TRACE1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetLastErrorInfo, EF32TraceUidProxyDrive, this);
1246 TInt r = iProxy->GetLastErrorInfo(aErrorInfo);
1248 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveGetLastErrorInfoRet, EF32TraceUidProxyDrive, r);
1254 Issue a notification that a physical delete has occurred.
1255 For example a cluster or partition has been freed.
1257 @param aPos The position of the data which is being deleted.
1258 @param aLength The length of the data which is being deleted.
1260 @return System wide error code.
1262 EXPORT_C TInt CBaseExtProxyDrive::DeleteNotify(TInt64 aPos, TInt aLength)
1264 TRACE4(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDeleteNotify, EF32TraceUidProxyDrive,
1265 this, I64LOW(aPos), I64HIGH(aPos), aLength);
1267 TInt r = iProxy->DeleteNotify(aPos, aLength);
1269 TRACERET1(UTF::EBorder, UTraceModuleProxyDrive::ECBaseExtProxyDriveDeleteNotifyRet, EF32TraceUidProxyDrive, r);
1277 EXPORT_C CProxyDriveFactory::CProxyDriveFactory()
1282 Remove the Proxy driver factory.
1284 This implementation performs no operations.
1288 EXPORT_C TInt CProxyDriveFactory::Remove()
1293 GLDEF_C CExtProxyDriveFactory* GetProxyDriveFactory(const TDesC& aName)
1295 // Lookup an extension by name.
1300 TInt r=ProxyDrives->FindByName(h,aName);
1303 return((CExtProxyDriveFactory*)ProxyDrives->At(h));
1307 // construct a extension proxy drive device
1308 EXPORT_C CExtProxyDriveFactory::CExtProxyDriveFactory()
1313 EXPORT_C TInt CExtProxyDriveFactory::Remove()
1319 EXPORT_C void CExtProxyDriveFactory::AsyncEnumerate()
1325 Create a proxy drive using the local proxy drive passed in
1326 and any extensions that have been added to the drive.
1328 @param aConcreteDrive local proxy drive
1329 @param aMount local proxy drive mount control block
1331 @return pointer to instantiated CProxyDrive object.
1333 EXPORT_C CProxyDrive* CreateProxyDriveL(CProxyDrive* aConcreteDrive,CMountCB* aMount)
1335 __PRINT(_L("CreateProxyDriveL()"));
1336 __ASSERT_DEBUG(aMount!=NULL,Fault(ECreateProxyDriveL));
1337 TDrive& drive=TheDrives[aMount->Drive().DriveNumber()];
1338 if(drive.ExtInfo().iCount==0)
1339 return(aConcreteDrive);
1341 TBool extSupported = drive.FSys().IsExtensionSupported();
1342 TRACE1(UTF::EBorder, UTraceModuleFileSys::ECFileSystemIsExtensionSupported, EF32TraceUidProxyDrive, extSupported);
1345 delete(aConcreteDrive);
1346 User::Leave(KErrAccessDenied);
1348 CProxyDrive* pOrig=aConcreteDrive;
1349 CProxyDrive* pFinal=NULL;
1350 __ASSERT_DEBUG(drive.ExtInfo().iCount<=KMaxExtensionCount,Fault(EExtensionInfoCount2));
1351 for(TInt i=0;i<drive.ExtInfo().iCount;++i)
1353 __PRINT1TEMP(_L("adding extension %S"),drive.ExtInfo().iInfo[i].iFactory->Name());
1354 __PRINT1(_L("extension is primary = %d"),drive.ExtInfo().iInfo[i].iIsPrimary);
1355 TRAPD(r,pFinal=drive.ExtInfo().iInfo[i].iFactory->NewProxyDriveL(pOrig,aMount));
1367 Lookup a proxy drive extension by name.
1369 @param aName name of extension to be found
1371 @return system wide error code
1373 CProxyDriveFactory* GetExtension(const TDesC& aName)
1377 TInt r=Extensions->FindByName(h,aName);
1380 return((CProxyDriveFactory*)Extensions->At(h));
1384 // construct a extension proxy drive
1385 EXPORT_C CExtProxyDrive::CExtProxyDrive(CMountCB* aMount,CExtProxyDriveFactory* aDevice)
1386 : CProxyDrive(aMount),
1391 // delete a extension proxy drive
1392 EXPORT_C CExtProxyDrive::~CExtProxyDrive()
1394 if(iMediaChangeNotifier)
1396 delete iMediaChangeNotifier;
1401 EXPORT_C TInt CExtProxyDrive::NotifyChange(TDes8 &/*aChanged*/, TRequestStatus* /*aStatus*/)
1403 return KErrNotSupported;
1406 EXPORT_C void CExtProxyDrive::NotifyChangeCancel()
1410 EXPORT_C TInt CExtProxyDrive::SetInfo(const RMessage2& /*aMsg*/, TAny* /*aMessageParam2*/, TAny* /*aMessageParam3*/)
1416 Initialise the provided interface extension.
1418 @param aInterfaceId Interface identifier of the interface to be retrieved.
1419 @param aInterface Address of variable that retrieves the specified interface.
1420 @param aInput Data required for the instantiation of the interface.
1422 @return system wide error code.
1424 EXPORT_C TInt CExtProxyDrive::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput)
1426 return(CProxyDrive::GetInterface(aInterfaceId,aInterface,aInput));
1429 TInt CExtProxyDrive::SetupMediaChange()
1431 if(iMediaChangeNotifier)
1433 TRAPD(err, iMediaChangeNotifier->RequestL());
1437 TRAPD(err, iMediaChangeNotifier = CExtNotifyMediaChange::NewL(this));
1439 return(err == KErrNotSupported ? KErrNone : err);
1442 TInt TFsAddExtension::DoRequestL(CFsRequest* aRequest)
1447 __PRINT(_L("TFsAddExtension::DoRequestL(CFsRequest* aRequest)"));
1450 // Get library handle
1451 lib.SetHandle(aRequest->Message().Int0());
1452 if (lib.Type()[1]!=TUid::Uid(KFileSystemUidValue))
1453 return KErrNotSupported;
1455 TExtensionNew e=(TExtensionNew)lib.Lookup(1);
1458 CProxyDriveFactory* pP=(*e)();
1460 return KErrNoMemory;
1461 TInt r=pP->Install();
1462 __PRINT1TEMP(_L("InstallExtension %S"),pP->Name());
1465 __PRINT(_L("TRAP(r,Extensions->AddL(pP,ETrue))"));
1466 TRAP(r,Extensions->AddL(pP,ETrue))
1467 __PRINT1TEMP(_L("r == %d"), r);
1471 __PRINT1TEMP(_L("r == %d"), r);
1473 pP->SetLibrary(lib);
1480 TInt TFsAddExtension::Initialise(CFsRequest* aRequest)
1485 TSecurityPolicy policy(RProcess().SecureId(), ECapabilityTCB);
1486 if (!policy.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Add File System Extension")))
1487 return KErrPermissionDenied;
1491 TInt TFsAddProxyDrive::DoRequestL(CFsRequest* aRequest)
1493 // Load a proxy drive
1496 __PRINT(_L("TFsAddProxyDrive::DoRequestL(CFsRequest* aRequest)"));
1499 // Get library handle
1500 lib.SetHandle(aRequest->Message().Int0());
1501 if (lib.Type()[1]!=TUid::Uid(KFileSystemUidValue))
1502 return KErrNotSupported;
1504 TProxyDriveNew e=(TProxyDriveNew)lib.Lookup(1);
1507 CExtProxyDriveFactory* pP=(*e)();
1509 return KErrNoMemory;
1510 TInt r=pP->Install();
1511 __PRINT1TEMP(_L("Install Proxy Drive %S"),pP->Name());
1514 __PRINT(_L("TRAP(r,ProxyDrives->AddL(pP,ETrue))"));
1515 TRAP(r,ProxyDrives->AddL(pP,ETrue))
1516 __PRINT1TEMP(_L("r == %d"), r);
1520 __PRINT1TEMP(_L("r == %d"), r);
1522 pP->SetLibrary(lib);
1529 TInt TFsAddProxyDrive::Initialise(CFsRequest* aRequest)
1534 TSecurityPolicy policy(RProcess().SecureId(), ECapabilityTCB);
1535 if (!policy.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Add File System Proxy Drive")))
1536 return KErrPermissionDenied;
1540 TInt TFsMountExtension::DoRequestL(CFsRequest* aRequest)
1542 // Mount an extension
1546 aRequest->ReadL(KMsgPtr0,name);
1547 CProxyDriveFactory* pE=GetExtension(name);
1549 return(KErrNotFound);
1550 return(aRequest->Drive()->MountExtension(pE,EFalse));
1553 TInt TFsMountExtension::Initialise(CFsRequest* aRequest)
1558 TInt r=ValidateDrive(aRequest->Message().Int1(),aRequest);
1561 if(aRequest->Drive()->IsSubsted())
1562 return(KErrNotSupported);
1567 TInt TFsDismountExtension::DoRequestL(CFsRequest* aRequest)
1569 // Dismount extension
1573 aRequest->ReadL(KMsgPtr0,name);
1574 CProxyDriveFactory* pE=GetExtension(name);
1576 return(KErrNotFound);
1577 return(aRequest->Drive()->DismountExtension(pE,EFalse));
1581 TInt TFsDismountExtension::Initialise(CFsRequest* aRequest)
1586 if (!KCapFsDismountExtension.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Dismount File Extension")))
1587 return KErrPermissionDenied;
1588 TInt r=ValidateDrive(aRequest->Message().Int1(),aRequest);
1591 if(aRequest->Drive()->IsSubsted())
1592 return(KErrNotSupported);
1596 TInt TFsRemoveExtension::DoRequestL(CFsRequest* aRequest)
1598 // Remove an extension
1602 aRequest->ReadL(KMsgPtr0,name);
1603 CProxyDriveFactory* pE=GetExtension(name);
1605 return(KErrNotFound);
1606 TInt r=pE->Remove();
1609 RLibrary lib=pE->Library();
1616 TInt TFsRemoveExtension::Initialise(CFsRequest* aRequest)
1621 if (!KCapFsRemoveExtension.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Remove File Extension")))
1622 return KErrPermissionDenied;
1626 TInt TFsRemoveProxyDrive::DoRequestL(CFsRequest* aRequest)
1628 // Remove a proxy drive
1632 aRequest->ReadL(KMsgPtr0,name);
1634 CExtProxyDriveFactory* pD=GetProxyDriveFactory(name);
1635 // are there any mounted drives using this extension?
1636 if (LocalDrives::IsProxyDriveInUse(pD)) return KErrInUse;
1638 return(KErrNotFound);
1639 TInt r=pD->Remove();
1642 RLibrary lib=pD->Library();
1650 TInt TFsRemoveProxyDrive::Initialise(CFsRequest* aRequest)
1655 if (!KCapFsRemoveProxyDrive.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Remove Proxy Drive")))
1656 return KErrPermissionDenied;
1660 TInt TFsExtensionName::DoRequestL(CFsRequest* aRequest)
1662 // Return the name of an extension for a given drive and extension chain position
1666 TInt r=aRequest->Drive()->ExtensionName(name,aRequest->Message().Int2());
1668 aRequest->WriteL(KMsgPtr0,name);
1672 TInt TFsExtensionName::Initialise(CFsRequest* aRequest)
1677 TInt r=ValidateDrive(aRequest->Message().Int1(),aRequest);
1680 if(aRequest->Drive()->IsSubsted())
1681 return(KErrNotSupported);
1685 TInt TFsDismountProxyDrive::DoRequestL(CFsRequest* aRequest)
1687 // Dismount a proxy extension
1691 __PRINT(_L("TFsDismountProxyDrive::DoRequestL"));
1693 return aRequest->Drive()->DismountProxyDrive();
1697 TInt TFsDismountProxyDrive::Initialise(CFsRequest* aRequest)
1702 if (!KCapFsDismountProxyDrive.CheckPolicy(aRequest->Message(), __PLATSEC_DIAGNOSTIC_STRING("Dismount Proxy Drive")))
1703 return KErrPermissionDenied;
1705 TInt r=ValidateDrive(aRequest->Message().Int0(),aRequest);