# HG changeset patch # User hgs # Date 1275925596 -3600 # Node ID 2ac1c5c277582390cbd4829aaecf8a8792229882 # Parent 5e441a173c6319c325907308274c0261316ef8fd 201021_06 diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/media/base_e32_drivers_media.mrp --- a/kernel/eka/drivers/media/base_e32_drivers_media.mrp Mon May 24 18:45:46 2010 +0100 +++ b/kernel/eka/drivers/media/base_e32_drivers_media.mrp Mon Jun 07 16:46:36 2010 +0100 @@ -1,18 +1,3 @@ -# -# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). -# All rights reserved. -# This component and the accompanying materials are made available -# under the terms of "Eclipse Public License v1.0" -# which accompanies this distribution, and is available -# at the URL "http://www.eclipse.org/legal/epl-v10.html". -# -# Initial Contributors: -# Nokia Corporation - initial contribution. -# -# Contributors: -# -# Description: -# # component name "Media Drivers" component base_e32_drivers_media @@ -25,6 +10,7 @@ source \sf\os\kernelhwsrv\kernel\eka\drivers\medlfs source \sf\os\kernelhwsrv\kernel\eka\drivers\medmmc source \sf\os\kernelhwsrv\kernel\eka\drivers\mednand +source \sf\os\kernelhwsrv\kernel\eka\drivers\sdapc source \sf\os\kernelhwsrv\kernel\eka\drivers\pbus\pbusmedia.cpp source \sf\os\kernelhwsrv\kernel\eka\drivers\pbus\spbus.cpp source \sf\os\kernelhwsrv\kernel\eka\drivers\pbus\distribution.policy.s60 diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/media/bld.inf --- a/kernel/eka/drivers/media/bld.inf Mon May 24 18:45:46 2010 +0100 +++ b/kernel/eka/drivers/media/bld.inf Mon Jun 07 16:46:36 2010 +0100 @@ -42,6 +42,7 @@ ../pbus/mmc/sdcard/sdcard3c/sdio/dummyexp.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/sdio/) ../pbus/mmc/sdcard/sdcard3c/sdio/sdiocard.h SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/sdio/) ../pbus/mmc/sdcard/sdcard3c/sdio/sdiocard.inl SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(drivers/sdio/) +../sdapc/d_sdapc.h SYMBIAN_OS_LAYER_PUBLIC_EXPORT_PATH(drivers/) PRJ_MMPFILES @@ -59,6 +60,7 @@ #if !defined(WINS) && !defined(GENERIC_X86) ../../drivers/pbus/mmc/sdcard/sdcard3c/epbussd ../../drivers/pbus/mmc/sdcard/sdcard3c/sdio/epbussdio +../../drivers/sdapc/d_sdapc #endif // Build the folowing from variant if required. diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/medmmc/medmmc.cpp --- a/kernel/eka/drivers/medmmc/medmmc.cpp Mon May 24 18:45:46 2010 +0100 +++ b/kernel/eka/drivers/medmmc/medmmc.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -2889,7 +2889,7 @@ __KTRACE_OPT(KPBUSDRV, Kern::Printf(">mmd:rdc:%x,%x", iReqCur, iReqEnd)); OstTraceExt2( TRACE_INTERNALS, DMMCMEDIADRIVERFLASH_READDATAUNTILCACHEEXHAUSTED, "iReqCur=0x%x; iReqEnd=0x%x", (TUint) iReqCur, (TUint) iReqEnd ); - if ( iCurrentReq->IsPhysicalAddress() + if ( (iCurrentReq->DriverFlags() & RLocalDrive::ELocDrvDirectIO) || iCurrentReq->IsPhysicalAddress() #if defined(__DEMAND_PAGING__) && !defined(__WINS__) || DMediaPagingDevice::PageInRequest(*iCurrentReq) #endif //DEMAND_PAGING diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/pbus/mmc/sdcard/sdcard3c/sdcard.cpp --- a/kernel/eka/drivers/pbus/mmc/sdcard/sdcard3c/sdcard.cpp Mon May 24 18:45:46 2010 +0100 +++ b/kernel/eka/drivers/pbus/mmc/sdcard/sdcard3c/sdcard.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of the License "Eclipse Public License v1.0" @@ -27,7 +27,7 @@ // ======== TSDCard ======== TSDCard::TSDCard() -: iProtectedAreaSize(0), iPARootDirEnd(KPARootDirEndUnknown) +: iProtectedAreaSize(0), iPARootDirEnd(KPARootDirEndUnknown), iClientCountSD(0) { // empty } @@ -481,6 +481,12 @@ // Before issueing commands, see if there's actually a card present if (!CardDetect(iCxCardCount)) SMF_GOTOS(EStMoreCardsCheck) + + // Card Previously Marked as Corrupt do not re-initialise + if ((CardArray().CardP(iCxCardCount)->iFlags)& KSDCardIsCorrupt) + { + SMF_GOTOS(EStMoreCardsCheck) + } m.SetTraps(KMMCErrResponseTimeOut); SMF_INVOKES(InitialiseMemoryCardSMST, EStSendCIDIssued) @@ -814,6 +820,7 @@ { __KTRACE_OPT2(KPBUS1, KPANIC, Kern::Printf("-sd:ocr busy timed out")); OstTraceFunctionExitExt( DSDSTACK_INITIALISEMEMORYCARDSM_EXIT2, this, (TInt) KMMCErrBusTimeOut ); + (CardArray().CardP(iCxCardCount)->iFlags)|=KSDCardIsCorrupt; return KMMCErrBusTimeOut; } diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/sdapc/d_sdapc.cpp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/drivers/sdapc/d_sdapc.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -0,0 +1,307 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL " http://www.eclipse.org/legal/epl-v10.html ". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + + +#include +#include +#include +#include +#include + +#include "OstTraceDefinitions.h" +#ifdef OST_TRACE_COMPILER_IN_USE +#include "locmedia_ost.h" +#ifdef __VC32__ +#pragma warning(disable: 4127) // disabling warning "conditional expression is constant" +#endif +#include "d_sdapcTraces.h" +#endif + +_LIT(KLddName,"D_SDAPC"); + +const TInt KMajorVersionNumber=1; +const TInt KMinorVersionNumber=0; +const TInt KBuildVersionNumber=1; + +const TInt KSocketNumber = 0; +const TInt KStackNumber = 0; +const TInt KCardNumber = 0; + +// global Dfc Que +TDynamicDfcQue* gDfcQ; + +class DSDAuxiliaryPowerControlFactory : public DLogicalDevice +// +// LDD factory +// + { +public: + DSDAuxiliaryPowerControlFactory(); + ~DSDAuxiliaryPowerControlFactory(); + virtual TInt Install(); //overriding pure virtual + virtual void GetCaps(TDes8& aDes) const; //overriding pure virtual + virtual TInt Create(DLogicalChannelBase*& aChannel); //overriding pure virtual + }; + + +class DSDAuxiliaryPowerControl : public DLogicalChannel +// +// Logical channel +// + { +public: + DSDAuxiliaryPowerControl(); + virtual ~DSDAuxiliaryPowerControl(); + +protected: + virtual TInt DoCreate(TInt aUnit, const TDesC8* anInfo, const TVersion& aVer); + virtual void HandleMsg(class TMessageBase *); + +private: + static void BusCallBack(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2); + TInt PowerUpStack(); + +private: + DMMCSocket* iSocketP; + DMMCStack* iStackP; + TSDCard* iCardP; + + DThread* iClient; + + TPBusCallBack iBusCallBack; + DSemaphore* iPowerUpSemaphore; + TBool iInitialised; + }; + + +DECLARE_STANDARD_LDD() + { + return new DSDAuxiliaryPowerControlFactory; + } + +DSDAuxiliaryPowerControlFactory::DSDAuxiliaryPowerControlFactory() +// +// Constructor +// + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROLFACTORY_DSDAUXILIARYPOWERCONTROLFACTORY, "DSDAuxiliaryPowerControlFactory::DSDAuxiliaryPowerControlFactory"); + __KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControlFactory::DSDAuxiliaryPowerControlFactory")); + iParseMask=KDeviceAllowUnit; + iUnitsMask=0xffffffff; + iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); + } + +TInt DSDAuxiliaryPowerControlFactory::Create(DLogicalChannelBase*& aChannel) +// +// Create a new DSDAuxiliaryPowerControl on this logical device +// + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROLFACTORY_CREATE, "DSDAuxiliaryPowerControlFactory::Create"); + __KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControlFactory::Create")); + aChannel=new DSDAuxiliaryPowerControl; + return aChannel ? KErrNone : KErrNoMemory; + } + +const TInt KDSDAuxiliaryPowerControlApiThreadPriority = 27; +_LIT(KDSDAuxiliaryPowerControlApiThread,"DSDAuxiliaryPowerControlApiThread"); + +TInt DSDAuxiliaryPowerControlFactory::Install() +// +// Install the LDD - overriding pure virtual +// + { + // Allocate a kernel thread to run the DFC + TInt r = Kern::DynamicDfcQCreate(gDfcQ, KDSDAuxiliaryPowerControlApiThreadPriority, KDSDAuxiliaryPowerControlApiThread); + + if (r != KErrNone) + return r; + + return SetName(&KLddName); + } + +void DSDAuxiliaryPowerControlFactory::GetCaps(TDes8& aDes) const +// +// Get capabilities - overriding pure virtual +// + { + TCapsTestV01 b; + b.iVersion=TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber); + Kern::InfoCopy(aDes,(TUint8*)&b,sizeof(b)); + } + +/** + Destructor +*/ +DSDAuxiliaryPowerControlFactory::~DSDAuxiliaryPowerControlFactory() + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROLFACTORY_DSDAUXILIARYPOWERCONTROLFACTORY_DTOR, "DSDAuxiliaryPowerControlFactory::~DSDAuxiliaryPowerControlFactory"); + __KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControlFactory::~DSDAuxiliaryPowerControlFactory")); + if (gDfcQ) + gDfcQ->Destroy(); + } + +void DSDAuxiliaryPowerControl::BusCallBack(TAny* aPtr, TInt aReason, TAny* a1, TAny* a2) + { + DSDAuxiliaryPowerControl* pTest = (DSDAuxiliaryPowerControl*)aPtr; + TPBusState busState = (TPBusState) (TInt) a1; + switch (aReason) + { + case TPBusCallBack::EPBusStateChange: + if (busState != EPBusPoweringUp) + Kern::SemaphoreSignal(*(pTest->iPowerUpSemaphore)); + break; + } + } + +TInt DSDAuxiliaryPowerControl::PowerUpStack() + { + iBusCallBack.iFunction = BusCallBack; + iBusCallBack.iPtr=this; + iBusCallBack.SetSocket(iSocketP->iSocketNumber); + iBusCallBack.Add(); + TInt r = Kern::SemaphoreCreate(iPowerUpSemaphore, _L("SDPowerUpSem"), 0); + if (r == KErrNone) + { + r = iSocketP->PowerUp(); + if (r == KErrNone) + Kern::SemaphoreWait(*iPowerUpSemaphore); + } + return r; + } + +TInt DSDAuxiliaryPowerControl::DoCreate(TInt /*aUnit*/, const TDesC8* /*aInfo*/, const TVersion& aVer) +// +// Create channel +// + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_1, "DSDAuxiliaryPowerControl::DoCreate()"); + __KTRACE_OPT(KPBUS1, Kern::Printf(">DSDAuxiliaryPowerControl::DoCreate()")); + + if (!Kern::QueryVersionSupported(TVersion(KMajorVersionNumber,KMinorVersionNumber,KBuildVersionNumber),aVer)) + return KErrNotSupported; + + // + // Obtain the appropriate card from the socket/stack + // + iSocketP = static_cast(DPBusSocket::SocketFromId(KSocketNumber)); + if(iSocketP == NULL) + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_2, "DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain socket"); + __KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain socket")); + return KErrNoMemory; + } + + iStackP = static_cast(iSocketP->Stack(KStackNumber)); + if(iStackP == NULL) + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_3, "DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain stack"); + __KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain stack")); + return KErrNoMemory; + } + + iCardP = static_cast(iStackP->CardP(KCardNumber)); + if(iCardP == NULL) + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_4, "DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain card"); + __KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Didn't obtain card")); + return KErrNoMemory; + } + + SetDfcQ(gDfcQ); + iMsgQ.Receive(); + + // Make sure stack is powered up + TInt r = PowerUpStack(); + if (r != KErrNone && r != KErrCompletion) + { + OstTrace1( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_5, "DSDAuxiliaryPowerControl::DoCreate() : Failed To Power up stack, r = %d", r); + __KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Failed To Power up stack, r = %d", r)); + return r; + } + + if(!iCardP->IsReady()) + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_6, "DSDAuxiliaryPowerControl::DoCreate() : Card not ready"); + __KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : Card not ready")); + return KErrNotReady; + } + + if(!iCardP->ClientsRegistered()) + { + iCardP->RegisterClient(); + ((DSDIOPsu*)(iSocketP->iVcc))->Lock(); + TBool locked = ((DSDIOPsu*)(iSocketP->iVcc))->IsLocked(); + OstTrace1( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DOCREATE_7, "DSDAuxiliaryPowerControl::DoCreate() : PSU IsLocked(), locked = %d", locked); + __KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::DoCreate() : PSU IsLocked(), locked = %d", locked)); + if(!locked) + return KErrNotReady; + } + + return KErrNone; + } + +DSDAuxiliaryPowerControl::DSDAuxiliaryPowerControl() +// +// Constructor +// + { + iClient=&Kern::CurrentThread(); + ((DObject*)iClient)->Open(); + } + + +DSDAuxiliaryPowerControl::~DSDAuxiliaryPowerControl() +// +// Destructor +// + { + OstTrace0( TRACE_FLOW, DSDAUXILIARYPOWERCONTROL_DSDAUXILIARYPOWERCONTROL_DTOR, "DSDAuxiliaryPowerControl::~DSDAuxiliaryPowerControl"); + __KTRACE_OPT(KPBUS1, Kern::Printf("DSDAuxiliaryPowerControl::~DSDAuxiliaryPowerControl")); + iBusCallBack.Remove(); + + if (iSocketP) + iSocketP->ControlIO(DPBusSocket::EControlMediaState, (TAny*)DPBusSocket::EPeriphBusMediaNormal, NULL); + + + if(iCardP->ClientsRegistered()) + { + iCardP->DeregisterClient(); + ((DSDIOPsu*)(iSocketP->iVcc))->Unlock(); + } + + iPowerUpSemaphore->Close(NULL); + + Kern::SafeClose((DObject*&)iClient,NULL); + } + +void DSDAuxiliaryPowerControl::HandleMsg(TMessageBase* aMsg) + { + TThreadMessage& m=*(TThreadMessage*)aMsg; + TInt id=m.iValue; + + if (id==(TInt)ECloseMsg) + { + if (iSocketP) + iSocketP->ControlIO(DPBusSocket::EControlMediaState, (TAny*)DPBusSocket::EPeriphBusMediaNormal, NULL); + + m.Complete(KErrNone, EFalse); + return; + } + else if (id==KMaxTInt) + { + // DoCancel + m.Complete(KErrNone,ETrue); + return; + } + } diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/sdapc/d_sdapc.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/drivers/sdapc/d_sdapc.h Mon Jun 07 16:46:36 2010 +0100 @@ -0,0 +1,55 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL " http://www.eclipse.org/legal/epl-v10.html ". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + + +#ifndef __D_SDAPC_H__ +#define __D_SDAPC_H__ +#include + + + + +class TCapsTestV01 + { +public: + TVersion iVersion; + }; + +/** + +A user-side interface to the SD PSU auxiliary-control driver. + +*/ +class RSDAuxiliaryPowerControlAPI : public RBusLogicalChannel + { +public: + enum + { + EMajorVersionNumber=1, + EMinorVersionNumber=0, + EBuildVersionNumber=1 + }; + +public: + inline void Cancel(); + + inline TInt Open(TInt aSocket,const TVersion& aVer) + {return(DoCreate(_L("D_SDAPC"),aVer,(TInt)aSocket,NULL,NULL));} + + inline TVersion VersionRequired() const + {return(TVersion(EMajorVersionNumber,EMinorVersionNumber,EBuildVersionNumber));} + + }; + +#endif diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/sdapc/d_sdapc.mmp --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/drivers/sdapc/d_sdapc.mmp Mon Jun 07 16:46:36 2010 +0100 @@ -0,0 +1,32 @@ +// Copyright (c) 2010 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL " http://www.eclipse.org/legal/epl-v10.html ". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + +#include "kernel/kern_ext.mmh" + +TARGET d_sdapc.ldd +TARGETTYPE LDD + +SOURCEPATH . +SOURCE d_sdapc.cpp +LIBRARY epbussd.lib +epocallowdlldata + +USERINCLUDE traces +USERINCLUDE ../../include/drivers +OS_LAYER_SYSTEMINCLUDE_SYMBIAN + +capability all + +SMPSAFE + diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h Mon Jun 07 16:46:36 2010 +0100 @@ -0,0 +1,21 @@ +// Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). +// All rights reserved. +// This component and the accompanying materials are made available +// under the terms of the License "Eclipse Public License v1.0" +// which accompanies this distribution, and is available +// at the URL "http://www.eclipse.org/legal/epl-v10.html". +// +// Initial Contributors: +// Nokia Corporation - initial contribution. +// +// Contributors: +// +// Description: + +#ifndef __OSTTRACEDEFINITIONS_H__ +#define __OSTTRACEDEFINITIONS_H__ +// OST_TRACE_COMPILER_IN_USE flag has been added by Trace Compiler +// REMOVE BEFORE CHECK-IN TO VERSION CONTROL +//#define OST_TRACE_COMPILER_IN_USE +#include +#endif diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/include/d32locd.h --- a/kernel/eka/include/d32locd.h Mon May 24 18:45:46 2010 +0100 +++ b/kernel/eka/include/d32locd.h Mon Jun 07 16:46:36 2010 +0100 @@ -565,7 +565,8 @@ enum TReadWriteFlags { ELocDrvMetaData = 0x80000000, /**< Set if read/write request is for metadata */ - ELocDrvWholeMedia = 0x40000000 /**< Set to access whole media, rather than partition */ + ELocDrvWholeMedia = 0x40000000, /**< Set to access whole media, rather than partition */ + ELocDrvDirectIO = 0x20000000 }; // @see TBusLocalDrive::QueryDevice() diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/include/drivers/sdcard.h --- a/kernel/eka/include/drivers/sdcard.h Mon May 24 18:45:46 2010 +0100 +++ b/kernel/eka/include/drivers/sdcard.h Mon Jun 07 16:46:36 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of the License "Eclipse Public License v1.0" @@ -44,6 +44,7 @@ const TUint32 KSDSwitchFunctionHighSpeed = 0x80FFFF01; const TUint32 KSDCardIsSDCard = KBit16; // KMMCardFirstCustomFlag +const TUint32 KSDCardIsCorrupt = KBit17; const TUint32 KSDCardFirstCustomFlag = KBit24; const TUint KSDDTClk25MHz = 25000; //25000KHz @@ -81,12 +82,16 @@ inline TUint32 PARootDirEnd() const; inline void SetPARootDirEnd(TUint32 aPARootDirEnd); virtual TUint MaxTranSpeedInKilohertz() const; + inline void RegisterClient(); + inline void DeregisterClient(); + inline TBool ClientsRegistered(); private: TUint32 iProtectedAreaSize; TUint32 iPARootDirEnd; TUint8 iAUSize; TUint8 iPad[3]; - TUint32 iSpare[4]; + TUint32 iClientCountSD; + TUint32 iSpare[3]; }; class TSDCardArray : public TMMCardArray diff -r 5e441a173c63 -r 2ac1c5c27758 kernel/eka/include/drivers/sdcard.inl --- a/kernel/eka/include/drivers/sdcard.inl Mon May 24 18:45:46 2010 +0100 +++ b/kernel/eka/include/drivers/sdcard.inl Mon Jun 07 16:46:36 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of the License "Eclipse Public License v1.0" @@ -44,6 +44,34 @@ inline TUint32 TSDCard::PARootDirEnd() const {return iPARootDirEnd;} inline void TSDCard::SetPARootDirEnd(TUint32 aPARootDirEnd) {iPARootDirEnd=aPARootDirEnd;} +/** +Called when a client registers with the SD card. +*/ +inline void TSDCard::RegisterClient() + { + __e32_atomic_add_ord32(&iClientCountSD, 1); + } + +/** +Called when a client de-registers with the SD card. +*/ +inline void TSDCard::DeregisterClient() + + { + __e32_atomic_add_ord32(&iClientCountSD, TUint32(-1)); + } + +/** +Returned value indicates whether or not clients have registered with the SD card. +*/ +inline TBool TSDCard::ClientsRegistered() + { + if(iClientCountSD) + return ETrue; + + return EFalse; + } + // ======== TSDCardArray ======== inline TSDCardArray::TSDCardArray(DSDStack* aOwningStack) : TMMCardArray(aOwningStack) diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/bmarm/efileu.def --- a/userlibandfileserver/fileserver/bmarm/efileu.def Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/bmarm/efileu.def Mon Jun 07 16:46:36 2010 +0100 @@ -240,4 +240,5 @@ DriveInfo__C11CFileSystemR10TDriveInfoi @ 239 NONAME R3UNUSED ; CFileSystem::DriveInfo(TDriveInfo &, int) const GetDriveInfo__FR10TDriveInfoi @ 240 NONAME R3UNUSED ; GetDriveInfo(TDriveInfo &, int) Volume__C9RFsPluginR11TVolumeInfoi @ 241 NONAME R3UNUSED ; RFsPlugin::Volume(TVolumeInfo &, int) const - + IsSequentialMode__C7CFileCB @ 242 NONAME R3UNUSED ; CFileCB::IsSequentialMode(void) const + DirectIOMode__7CFileCBRC12RMessagePtr2 @ 243 NONAME R3UNUSED ; CFileCB::DirectIOMode(RMessagePtr2 const &) diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/bwins/efileu.def --- a/userlibandfileserver/fileserver/bwins/efileu.def Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/bwins/efileu.def Mon Jun 07 16:46:36 2010 +0100 @@ -241,3 +241,5 @@ ?DriveInfo@CFileSystem@@UBEXAAVTDriveInfo@@H@Z @ 240 NONAME ; void CFileSystem::DriveInfo(class TDriveInfo &, int) const ?GetDriveInfo@@YAXAAVTDriveInfo@@H@Z @ 241 NONAME ; void GetDriveInfo(class TDriveInfo &, int) ?Volume@RFsPlugin@@QBEHAAVTVolumeInfo@@H@Z @ 242 NONAME ; int RFsPlugin::Volume(class TVolumeInfo &, int) const + ?IsSequentialMode@CFileCB@@QBEHXZ @ 243 NONAME ; int CFileCB::IsSequentialMode(void) const + ?DirectIOMode@CFileCB@@QAEHABVRMessagePtr2@@@Z @ 244 NONAME ; int CFileCB::DirectIOMode(class RMessagePtr2 const &) diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/bx86/efileu.def --- a/userlibandfileserver/fileserver/bx86/efileu.def Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/bx86/efileu.def Mon Jun 07 16:46:36 2010 +0100 @@ -241,3 +241,6 @@ ?DriveInfo@CFileSystem@@UBEXAAVTDriveInfo@@H@Z @ 240 NONAME ; public: virtual void __thiscall CFileSystem::DriveInfo(class TDriveInfo &,int)const ?GetDriveInfo@@YAXAAVTDriveInfo@@H@Z @ 241 NONAME ; void __cdecl GetDriveInfo(class TDriveInfo &,int) ?Volume@RFsPlugin@@QBEHAAVTVolumeInfo@@H@Z @ 242 NONAME ; public: int __thiscall RFsPlugin::Volume(class TVolumeInfo &,int)const + ?IsSequentialMode@CFileCB@@QBEHXZ @ 243 NONAME ; public: int __thiscall CFileCB::IsSequentialMode(void)const + ?DirectIOMode@CFileCB@@QAEHABVRMessagePtr2@@@Z @ 244 NONAME ; int CFileCB::DirectIOMode(class RMessagePtr2 const &) + diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/eabi/efileu.def --- a/userlibandfileserver/fileserver/eabi/efileu.def Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/eabi/efileu.def Mon Jun 07 16:46:36 2010 +0100 @@ -313,3 +313,6 @@ _Z12GetDriveInfoR10TDriveInfoi @ 312 NONAME _ZNK11CFileSystem9DriveInfoER10TDriveInfoi @ 313 NONAME _ZNK9RFsPlugin6VolumeER11TVolumeInfoi @ 314 NONAME + _ZNK7CFileCB16IsSequentialModeEv @ 315 NONAME + _ZN7CFileCB12DirectIOModeERK12RMessagePtr2 @ 316 NONAME + diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/group/release.txt --- a/userlibandfileserver/fileserver/group/release.txt Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/group/release.txt Mon Jun 07 16:46:36 2010 +0100 @@ -1,3 +1,12 @@ +Version 2.00.3043 +================= +(Made by vfebvre 27/05/2010) + +1. paconway + 1. REQ 417-56766 MBBMS over CMMB for TD-SCDMA Gen. 2 MobileTv + PackageReleaseID=497412 FeatureReleaseID=494378 + + Version 2.00.3042 ================= (Made by vfebvre 14/05/2010) diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/inc/f32fsys.h --- a/userlibandfileserver/fileserver/inc/f32fsys.h Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/inc/f32fsys.h Mon Jun 07 16:46:36 2010 +0100 @@ -556,6 +556,10 @@ friend class LocalDrives; // for access to iChanged flag friend class CExtNotifyMediaChange; // for access to iChanged flag + +#if defined(_USE_CONTROLIO) || defined(_DEBUG) || defined(_DEBUG_RELEASE) + friend class TFsControlIo; // for access to LocateDrives() +#endif }; class CFileCB; @@ -1614,7 +1618,6 @@ TBool DeleteOnClose() const; - void SetNotifyAsyncReadersPending(TBool aNotifyAsyncReadersPending); TBool NotifyAsyncReadersPending() const; TInt CancelAsyncReadRequest(CFileShare* aShareP, TRequestStatus* aStatusP); @@ -1629,6 +1632,7 @@ IMPORT_C TInt64 Size64() const; IMPORT_C void SetSize64(TInt64 aSize, TBool aDriveLocked); IMPORT_C void SetMaxSupportedSize(TUint64 aMaxFileSize); + IMPORT_C TBool DirectIOMode(const RMessagePtr2& aMessage); TInt64 CachedSize64() const; @@ -1638,6 +1642,17 @@ TInt RemoveLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); TInt CheckLock64(CFileShare* aFileShare,TInt64 aPos,TInt64 aLength); + /** Sequential mode */ + + IMPORT_C TBool IsSequentialMode() const; + void SetSequentialMode(TBool aSequential); + + /** + The FileShare List contains the file shares of an open file. + */ + TDblQue& FileShareList() const; + void AddShare(CFileShare& aFileShare); + /** Renames the file with the full file name provided. @@ -1954,12 +1969,12 @@ public: /** - The full name of the file, including drive and extensions. + The full name of the file, including its extension. */ HBufC* iFileName; /** - The full name of the file, including drive and extensions - Folded. + The full name of the file, including its extension - Folded. */ HBufC* iFileNameF; @@ -1968,11 +1983,9 @@ TDrive* iCreatedDrive; TDrive* iDrive; CMountCB* iMount; - TFileLocksArray* iFileLocks; ///< an array of file position locks + TFileLocksArray* iFileLocks; // An array of file position locks TDblQueLink iMountLink; - -private: - CFileBody* iBody; + CFileBody* iBody; friend class TDrive; friend class CMountCB; @@ -2025,7 +2038,7 @@ void InitL(); inline CFileCB& File(); - // For serialising aync requests + // For serialising async requests TBool RequestStart(CFsMessageRequest* aRequest); void RequestEnd(CFsMessageRequest* aRequest); TBool RequestInProgress() const; @@ -2050,8 +2063,13 @@ // A pointer to the current request. Used for serializing client // async read/write requests which might otherwise be processed out - // of order due to fair scheduling - CFsMessageRequest* iCurrentRequest; + // of order due to fair scheduling. + CFsMessageRequest* iCurrentRequest; + + // The FileShare List link object. + TDblQueLink iShareLink; + +friend class CFileBody; // For access to iShareLink }; diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/inc/f32ver.h --- a/userlibandfileserver/fileserver/inc/f32ver.h Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/inc/f32ver.h Mon Jun 07 16:46:36 2010 +0100 @@ -58,6 +58,6 @@ @see TVersion */ -const TInt KF32BuildVersionNumber=3042; +const TInt KF32BuildVersionNumber=3043; // #endif diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfat32/inc/sl_std.h --- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Mon Jun 07 16:46:36 2010 +0100 @@ -58,7 +58,7 @@ class CFatFileSystem; /** -Represents the position of a directory entery in terms of a cluster and off set into it +Represents the position of a directory entry in terms of a cluster and offset into it */ class TEntryPos { @@ -92,12 +92,12 @@ //-- public interface to the local drive. Provides media driver's error handling (critical and non-critical user notifiers) //-- and thread-safety if required. - TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const; + TInt ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const; TInt ReadNonCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const; TInt ReadCritical(TInt64 aPos,TInt aLength,TDes8& aTrg) const; TInt WriteCritical(TInt64 aPos,const TDesC8& aSrc); - TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset); + TInt WriteNonCritical(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag); TInt GetLastErrorInfo(TDes8& aErrorInfo) const; @@ -148,9 +148,9 @@ inline void LeaveCriticalSection() const {iLock.Signal();} //-- methods' wrappers that are used by TDriveInterface - TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const; + TInt Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const; TInt Read(TInt64 aPos,TInt aLength,TDes8& aTrg) const; - TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset); + TInt Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag); TInt Write(TInt64 aPos, const TDesC8& aSrc); TInt GetLastErrorInfo(TDes8& aErrorInfo) const; TInt Caps(TDes8& anInfo) const; @@ -336,7 +336,7 @@ @param aMessage Refrence to server message from request @param anOffset Offset into read data to write */ - virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const = 0; + virtual void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const = 0; /** Disk write function @@ -347,7 +347,7 @@ @param aMessage Refrence to server message from request, contains data @param anOffset Offset into write data to use in write */ - virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) = 0; + virtual void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) = 0; virtual inline MWTCacheInterface* DirCacheInterface(); @@ -428,7 +428,7 @@ /** -Fat file system mount implmentation, provides all that is required of a plug in +Fat file system mount implementation, provides all that is required of a plug in file system mount as well as Fat mount specific functionality */ class CFatMountCB : public CLocDrvMountCB, @@ -570,8 +570,8 @@ void DirReadL(const TEntryPos& aPos,TInt aLength,TDes8& aDes) const; void DirWriteL(const TEntryPos& aPos,const TDesC8& aDes); - void ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const; - void WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster); + void ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const; + void WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag); void MoveToNextEntryL(TEntryPos& aPos) const; void MoveToDosEntryL(TEntryPos& aPos,TFatDirEntry& anEntry) const; @@ -703,8 +703,8 @@ void DoCheckFatForLoopsL(TUint32 aCluster, TUint32& aPreviousCluster, TUint32& aChangePreviousCluster, TUint32& aCount) const; void InitializeL(const TLocalDriveCaps& aLocDrvCaps, TBool aIgnoreFSInfo=EFalse); - void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const; - void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster); + void DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const; + void DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag); TBool IsUniqueNameL(const TShortName& aName, TUint32 aDirCluster); TBool FindShortNameL(const TShortName& aName,TEntryPos& anEntryPos); @@ -900,10 +900,10 @@ TUint iStartCluster; ///< Start cluster number of file TEntryPos iCurrentPos; ///< Current position in file data - TEntryPos iFileDosEntryPos; ///< File DOS dir. entry position + TEntryPos iFileDosEntryPos; ///< File DOS dir. entry position - TBool iFileSizeModified :1; ///< flag, indicating that file size was modified and needs to be flushed onto the media (see FlushL()) - TBool iFileTimeModified :1; ///< flag, indicating that file modification time was modified and needs to be flushed onto the media (see FlushL()) + TBool iFileSizeModified :1; ///< flag, indicating that file size was modified and needs to be flushed onto the media (see FlushL()) + TBool iFileTimeModified :1; ///< flag, indicating that file modification time was modified and needs to be flushed onto the media (see FlushL()) }; diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfat32/sl_disk.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_disk.cpp Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_disk.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -286,11 +286,11 @@ @leave on error */ -void CAtaDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const +void CAtaDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const { __PRINT4(_L("CAtaDisk::ReadL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset); - User::LeaveIfError(iDrive.ReadNonCritical(aPos,aLength,aTrg,aMessage,anOffset)); + User::LeaveIfError(iDrive.ReadNonCritical(aPos,aLength,aTrg,aMessage,anOffset, aFlag)); } //------------------------------------------------------------------------------------- @@ -309,12 +309,12 @@ @leave on error */ -void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) +void CAtaDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) { __PRINT4(_L("CAtaDisk::WriteL() pos:%u:%u, len:%u, offset:%u"), I64HIGH(aPos), I64LOW(aPos), aLength, anOffset); //-- write data to the media directly - User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset)); + User::LeaveIfError(iDrive.WriteNonCritical(aPos,aLength,aSrc,aMessage,anOffset, aFlag)); //-- we need to invalidate UID cache page that corresponds to aPos (if any). This is UID caching specific. UID is stored in the first few bytes of //-- the executable module and therefore belongs to one cache page only. @@ -444,7 +444,7 @@ // // Read from ramDrive into thread relative descriptor // -void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset) const +void CRamDisk::ReadL(TInt64 aPos,TInt aLength,const TAny* /*aTrg*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/) const { __PRINT2(_L("CRamDisk::ReadL TAny* Pos 0x%x, Len %d"),aPos,aLength); __ASSERT_ALWAYS((aPos+aLength<=I64INT(iFatMount->Size())) && (aLength>=0),User::Leave(KErrCorrupt)); @@ -457,7 +457,7 @@ // // Write from thread relative descriptor into ramDrive // -void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset) +void CRamDisk::WriteL(TInt64 aPos,TInt aLength,const TAny* /*aSrc*/,const RMessagePtr2 &aMessage,TInt anOffset, TUint /*aFlag*/) { __PRINT2(_L("CRamDisk::WriteL TAny* Pos 0x%x, Len %d"),aPos,aLength); __ASSERT_ALWAYS(aPos+aLength<=I64INT(iFatMount->Size()),User::Leave(KErrCorrupt)); diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfat32/sl_disk.h --- a/userlibandfileserver/fileserver/sfat32/sl_disk.h Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_disk.h Mon Jun 07 16:46:36 2010 +0100 @@ -49,8 +49,8 @@ virtual void InvalidateUidCachePage(TUint64 aPos); - void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const; - void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset); + void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const; + void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag); virtual TInt GetLastErrorInfo(TDes8& aErrorInfo) const; MWTCacheInterface* DirCacheInterface(); @@ -80,11 +80,9 @@ public: void ReadCachedL(TInt64 aPos,TInt aLength,TDes8& aDes) const; void WriteCachedL(TInt64 aPos,const TDesC8& aDes); - void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const; - void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset); - - - + void ReadL(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const; + void WriteL(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag); + private: inline TUint8 *RamDiskBase() const; diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfat32/sl_drv.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_drv.cpp Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_drv.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies). // All rights reserved. // This component and the accompanying materials are made available // under the terms of the License "Eclipse Public License v1.0" @@ -46,12 +46,11 @@ Close the interface to the media driver */ void TDriveInterface::Close() -{ - if(iMount) +{ + if((iMount != NULL) && (iMount->LocalDrive() != NULL)) { iMount->LocalDrive()->SetMount(NULL); - } - + } iMount = NULL; } @@ -118,7 +117,7 @@ @return KErrBadPower - failure due to low power */ -TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const +TInt TDriveInterface::ReadNonCritical(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const { //__PRINT2(_L("#=+++ Read_nc2: pos:%LU, len:%u"), aPos, aLength); @@ -127,7 +126,7 @@ for(;;) { - nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset); + nRes = iProxyDrive.Read(aPos, aLength, aTrg, aMessage, anOffset, aFlag); if (nRes==KErrNone) break; @@ -201,7 +200,7 @@ @return KErrCorrupt - an illegal write is detected @return KErrAccessDenied - write to protected media */ -TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset) +TInt TDriveInterface::WriteNonCritical(TInt64 aPos, TInt aLength, const TAny* aSrc, const RMessagePtr2 &aMessage, TInt anOffset, TUint aFlag) { //__PRINT2(_L("#=+++ Write_NC: pos:%LU, len:%u"), aPos, aLength); @@ -212,7 +211,7 @@ for(;;) { iMount->OpenMountForWrite(); //-- make a callback to CFatMountCB to perform some actions on 1st write. - nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset); + nRes = iProxyDrive.Write(aPos, aLength, aSrc, aMessage, anOffset, aFlag); if (nRes==KErrNone) break; @@ -543,10 +542,10 @@ //-- see original TDriveInterface methods -TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset) const +TInt TDriveInterface::XProxyDriveWrapper::Read(TInt64 aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) const { EnterCriticalSection(); - TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset); + TInt nRes = iLocalDrive->Read(aPos, aLength, aTrg, aMessage.Handle(), anOffset, aFlag); LeaveCriticalSection(); return nRes; } @@ -559,10 +558,10 @@ return nRes; } -TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset) +TInt TDriveInterface::XProxyDriveWrapper::Write(TInt64 aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2 &aMessage,TInt anOffset, TUint aFlag) { EnterCriticalSection(); - TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset); + TInt nRes = iLocalDrive->Write(aPos, aLength, aSrc, aMessage.Handle(), anOffset, aFlag); LeaveCriticalSection(); return nRes; } diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfat32/sl_file.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_file.cpp Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_file.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -11,7 +11,7 @@ // Contributors: // // Description: -// f32\sfat\sl_file.cpp +// f32\sfat32\sl_file.cpp // // @@ -245,8 +245,10 @@ if((startPos + length > curSize) || (startPos > startPos + length) ) aLength=curSize-startPos; + + TUint flag = DirectIOMode(aMessage) ? RLocalDrive::ELocDrvDirectIO : 0; - FatMount().ReadFromClusterListL(iCurrentPos,aLength,aDes,aMessage,aOffset); + FatMount().ReadFromClusterListL(iCurrentPos,aLength,aDes,aMessage,aOffset, flag); aLength=iCurrentPos.iPos-startPos; } @@ -295,7 +297,9 @@ TUint badcluster=0; TUint goodcluster=0; - TRAPD(ret, FatMount().WriteToClusterListL(iCurrentPos,aLength,aSrc,aMessage,aOffset,badcluster, goodcluster)); + TUint flag = DirectIOMode(aMessage) ? RLocalDrive::ELocDrvDirectIO : 0; + + TRAPD(ret, FatMount().WriteToClusterListL(iCurrentPos,aLength,aSrc,aMessage,aOffset,badcluster, goodcluster, flag)); if (ret == KErrCorrupt || ret == KErrDied) { @@ -367,7 +371,7 @@ } aLength=iCurrentPos.iPos-startPos; - if(FatMount().IsRuggedFSys() && pos+(TUint)aLength > FCB_FileSize()) + if(!IsSequentialMode() && FatMount().IsRuggedFSys() && pos+(TUint)aLength > FCB_FileSize()) { WriteFileSizeL(pos+aLength); } @@ -381,7 +385,6 @@ } - //----------------------------------------------------------------------------- void CFatFileCB::ResizeIndex(TInt aNewMult,TUint aNewSize) @@ -502,7 +505,7 @@ if (I64HIGH(aSize)) User::Leave(KErrNotSupported); - DoSetSizeL(I64LOW(aSize), FatMount().IsRuggedFSys()); + DoSetSizeL(I64LOW(aSize), FatMount().IsRuggedFSys()); } @@ -520,7 +523,7 @@ ASSERT(FCB_FileSize()); ASSERT(FileSizeModified()); - ClearIndex(0); //-- clear seek index array + ClearIndex(0); // Clear seek index array //-- update file dir. entry const TUint32 cluster = FCB_StartCluster(); @@ -608,8 +611,8 @@ FAT().FlushL(); - if(aForceCachesFlush) // write file size if increasing - WriteFileSizeL(aNewSize); + if(!IsSequentialMode() && aForceCachesFlush) // Write file size directly to its dir. entry if a cache flush + WriteFileSizeL(aNewSize); // is needed and rugged FAT is not ignored by client } } @@ -884,7 +887,6 @@ } - TInt CFatFileCB::GetInterface(TInt aInterfaceId,TAny*& aInterface,TAny* aInput) { switch(aInterfaceId) @@ -906,8 +908,6 @@ } - - /** Overwrites file's start cluster (iStartCluster) in its directory entry. */ diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfat32/sl_mnt.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_mnt.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -1607,7 +1607,7 @@ /** Overwrite as many contiguous file clusters as possible. */ -void CFatMountCB::DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster) +void CFatMountCB::DoWriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint aLastcluster, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag) { __PRINT(_L("CFatMountCB::DoWriteToClusterListL")); @@ -1621,7 +1621,7 @@ const TInt writeLength=Min(aLength,(clusterListLen<WriteL(dataStart,writeLength,aSrc,aMessage,anOffset)); + TRAPD(r, iRawDisk->WriteL(dataStart,writeLength,aSrc,aMessage,anOffset, aFlag)); if(r == KErrNone) // Write succeded { @@ -1736,7 +1736,7 @@ //----------------------------------------------------------------------------------------- -void CFatMountCB::WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster) +void CFatMountCB::WriteToClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aSrc,const RMessagePtr2& aMessage,TInt anOffset, TUint& aBadcluster, TUint& aGoodcluster, TUint aFlag) // // Overwrite cluster list. // @@ -1758,7 +1758,7 @@ TInt previouscluster=0; FOREVER { - DoWriteToClusterListL(aPos,length-offset,aSrc,aMessage,anOffset+offset, previouscluster, aBadcluster, aGoodcluster); + DoWriteToClusterListL(aPos,length-offset,aSrc,aMessage,anOffset+offset, previouscluster, aBadcluster, aGoodcluster, aFlag); if (offset == (aPos.iPos-startPos)) continue; offset=aPos.iPos-startPos; @@ -1773,7 +1773,7 @@ //----------------------------------------------------------------------------------------- -void CFatMountCB::DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const +void CFatMountCB::DoReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const // // Read from as many contiguous file clusters as possible // @@ -1789,7 +1789,7 @@ const TInt readLength=Min(aLength,(clusterListLen<ReadL(dataStart,readLength,aTrg,aMessage,anOffset)); + TRAPD(r, iRawDisk->ReadL(dataStart,readLength,aTrg,aMessage,anOffset, aFlag)); if(r == KErrNone) // Read succeded { @@ -1814,7 +1814,7 @@ //----------------------------------------------------------------------------------------- -void CFatMountCB::ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset) const +void CFatMountCB::ReadFromClusterListL(TEntryPos& aPos,TInt aLength,const TAny* aTrg,const RMessagePtr2& aMessage,TInt anOffset, TUint aFlag) const // // Read from cluster list // @@ -1834,7 +1834,7 @@ TInt offset=0; FOREVER { - DoReadFromClusterListL(aPos,aLength-offset,aTrg,aMessage,anOffset+offset); + DoReadFromClusterListL(aPos,aLength-offset,aTrg,aMessage,anOffset+offset, aFlag); offset=aPos.iPos-startPos; if ((offset0,Fault(EReadFileSectionFailed)); TInt64 dataAddress=(FAT().DataPositionInBytes(cluster))+pos; - iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal); + iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal, 0); readTotal += readLength; if (readTotal == aLength) @@ -3256,7 +3256,7 @@ // Read aLength of data from disk directly to thread relative descriptor // { - iRawDisk->ReadL(aPos,aLength,aTrg,aMessage,anOffset); + iRawDisk->ReadL(aPos,aLength,aTrg,aMessage,anOffset, 0); } //----------------------------------------------------------------------------------------- @@ -3271,7 +3271,7 @@ //-- check if we are trying to write to the FAT directly and wait until FAT scan thread finishes in this case. FAT().RequestRawWriteAccess(aPos, aLength); - iRawDisk->WriteL(aPos,aLength,aSrc,aMessage,anOffset); + iRawDisk->WriteL(aPos,aLength,aSrc,aMessage,anOffset, 0); //-- Note: FAT directory cache will be invalidated in MountL() } diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_mnt32.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -1073,7 +1073,7 @@ TInt readLength = (TInt)Min((TInt64)(aLength-readTotal),(clusterListLen<0,Fault(EReadFileSectionFailed)); TInt64 dataAddress=(FAT().DataPositionInBytes(cluster))+pos; - iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal); + iRawDisk->ReadL(dataAddress,readLength,aTrg,aMessage,readTotal, 0); readTotal += readLength; if (readTotal == aLength) diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfile/sf_file.cpp --- a/userlibandfileserver/fileserver/sfile/sf_file.cpp Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_file.cpp Mon Jun 07 16:46:36 2010 +0100 @@ -701,8 +701,18 @@ // Current operation points to a local buffer // The request originated from the file server (e.g. file cache) with a local message handle (KLocalMessageHandle) TPtr8 dataDesc((TUint8*) currentOperation.iReadWriteArgs.iData + currentOperation.iReadWriteArgs.iOffset, len, len); - const RLocalMessage msg; - TRAP(r,file->ReadL(pos, len, &dataDesc, msg, 0)); + + // save the client's RMessage2 + const RMessage2 msgClient = aRequest->Message(); + + // overwrite RMessage2 in CFsMessageRequest with RLocalMessage + const RLocalMessage msgLocal; + const_cast (aRequest->Message()) = msgLocal; + + TRAP(r,file->ReadL(pos, len, &dataDesc, aRequest->Message(), 0)); + + // restore the client's RMessage2 + const_cast (aRequest->Message()) = msgClient; } } @@ -1099,8 +1109,18 @@ else { TPtr8 dataDesc((TUint8*) currentOperation.iReadWriteArgs.iData + currentOperation.iReadWriteArgs.iOffset, len, len); - const RLocalMessage msg; - TRAP(r,file->WriteL(pos, len, &dataDesc, msg, 0)); + + // save the client's RMessage2 + const RMessage2 msgClient = aRequest->Message(); + + // overwrite RMessage2 in CFsMessageRequest with RLocalMessage + const RLocalMessage msgLocal; + const_cast (aRequest->Message()) = msgLocal; + + TRAP(r,file->WriteL(pos, len, &dataDesc, aRequest->Message(), 0)); + + // restore the client's RMessage2 + const_cast (aRequest->Message()) = msgClient; } } @@ -3670,13 +3690,25 @@ - - - - - - - - - - +EXPORT_C TBool CFileCB::DirectIOMode(const RMessagePtr2& aMessage) + { + CFsMessageRequest* msgRequest = CFsMessageRequest::RequestFromMessage(aMessage); + + TInt func = msgRequest->Operation()->Function(); + ASSERT(func == EFsFileRead || func == EFsFileWrite || func == EFsFileWriteDirty || func == EFsReadFileSection); + + CFileShare* share; + CFileCB* file; + GetFileFromScratch(msgRequest, share, file); + if (share == NULL) // no share indicates this is a request originating from the file cache + return EFalse; + + return func == EFsFileRead ? share->iMode & EFileReadDirectIO : share->iMode & EFileWriteDirectIO; + } + + + + + + + diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfile/sf_std.h --- a/userlibandfileserver/fileserver/sfile/sf_std.h Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_std.h Mon Jun 07 16:46:36 2010 +0100 @@ -114,6 +114,8 @@ #define __PLUGIN_PRINT3(t,a,b,c) #endif +#define _LOFF(p,T,f) ((T*)(((TUint8*)(p))-_FOFF(T,f))) + const TInt KMaxTotalDriveReserved =0x100000; const TInt KMaxSessionDriveReserved =0x10000; @@ -1311,6 +1313,7 @@ inline void Init(); void ReStart(); TBool IsPluginRequest(); + static inline CFsMessageRequest* RequestFromMessage(const RMessagePtr2& aMessage); // UID of the process to touching the file. (To be used in notification framework). // TUid iUID; diff -r 5e441a173c63 -r 2ac1c5c27758 userlibandfileserver/fileserver/sfile/sf_std.inl --- a/userlibandfileserver/fileserver/sfile/sf_std.inl Mon May 24 18:45:46 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_std.inl Mon Jun 07 16:46:36 2010 +0100 @@ -252,6 +252,11 @@ void CFsMessageRequest::SetMessage(RMessage2& aMessage) {iMessage=aMessage;} + +CFsMessageRequest* CFsMessageRequest::RequestFromMessage(const RMessagePtr2& aMessage) + {return _LOFF(&aMessage, CFsMessageRequest, iMessage);} + + TMsgOperation* CFsMessageRequest::CurrentOperationPtr() {return iCurrentOperation;}