# HG changeset patch # User hgs # Date 1284475962 -3600 # Node ID ea2cef07f9fe91693b612115d3cc0f124d5bbf33 # Parent d45b74d3fb20bcfce81ba60dcaee6187836cd4ca 201035_02 diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h --- a/kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h Tue Sep 14 15:52:42 2010 +0100 @@ -17,5 +17,5 @@ // 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 +#include #endif diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/drivers/usbcc/ps_usbc.cpp --- a/kernel/eka/drivers/usbcc/ps_usbc.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/drivers/usbcc/ps_usbc.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -1078,9 +1078,11 @@ { OstTraceDef0(OST_TRACE_CATEGORY_RND, TRACE_NORMAL, DUSBCLIENTCONTROLLER_SETUPREADBUFFER_DUP11, " iEp0_RxExtraData: trying again..."); const TBool rx_data = iEp0DataReceiving; - const TInt irq = __SPIN_LOCK_IRQSAVE(iUsbLock); + + //Note: Currently, ProcessEp0ReceiveDone() is only called in the thread context, + // but in the future, if this ProcessEp0ReceiveDone() is called in IRQ context, + // we have to notice that ProcessEp0ReceiveDone() has hold a fast mutex already. err = ProcessEp0ReceiveDone(iEp0_RxExtraCount); - __SPIN_UNLOCK_IRQRESTORE(iUsbLock, irq); if (err == KErrNone) { iEp0_RxExtraData = EFalse; diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/euser/unicode/Compare.cpp --- a/kernel/eka/euser/unicode/Compare.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/euser/unicode/Compare.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2001-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2001-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" @@ -26,29 +26,6 @@ //////////////////////////////////////////////////////////////////////////////////////////// /** -@internalComponent -*/ -TChar UTF16ToChar(const TText16* a) - { - if (0xD800 <= a[0]) - { - if (a[0] < 0xE000) - { - if (a[0] < 0xDC00 && ::IsLowSurrogate(a[1])) - { - TChar c = ::PairSurrogates(a[0], a[1]); - if ((c & 0xFFFE) != 0xFFFE) - return c; - } - return 0xFFFF; - } - if (a[0] == 0xFFFE) - return 0xFFFF; - } - return a[0]; - } - -/** Is a character a base character (ETrue) or a combiner (EFalse)? For now, we will treat all control characters as base characters. @internalComponent @@ -152,20 +129,6 @@ //////////////////////////////////////////////////////////////////////////////////////////// /** -@internalComponent -*/ -void TUTF32Iterator::Next() - { - ASSERT(iStart != iEnd); - while (++iStart != iEnd) - { - iCurrent = ::UTF16ToChar(iStart); - if (iCurrent != 0xFFFF) - return; - } - } - -/** Locates a base character in a string using a folded comparision. Will not find combining characters, nor will it consider Korean combining Jamo to be equivalent to Hangul. @internalComponent @@ -209,14 +172,6 @@ /** @internalComponent */ -TBool TFoldedDecompIterator::AtEnd() const - { - return iOriginal.AtEnd(); - } - -/** -@internalComponent -*/ TBool TFoldedDecompIterator::AtEndOrWildcard() const { // neither '?' nor '*' have decomposition sequences, so we can assume that @@ -279,15 +234,6 @@ return folded.Current() != 0x3B9; } -/** -@internalComponent -*/ -TChar TFoldedDecompIterator::Current() const - { - ASSERT(!AtEnd()); - return IsInFoldedSequence()? iFolded.Current() : iOriginal.Current(); - } - /** Move past this code if it matches unfolded or folded @internalComponent @@ -426,23 +372,6 @@ /** @internalComponent */ -TBool TFoldedSortedDecompIterator::AtEnd() const - { - return iRemaining == 0; - } - -/** -@internalComponent -*/ -TChar TFoldedSortedDecompIterator::Current() const - { - ASSERT(!AtEnd()); - return iCurrent.Current(); - } - -/** -@internalComponent -*/ void TFoldedSortedDecompIterator::Next() { ASSERT(!AtEnd()); @@ -498,23 +427,6 @@ /** @internalComponent */ -TBool TFoldedCanonicalIterator::AtEnd() const - { - return iSorted.AtEnd() && iBase.AtEnd(); - } - -/** -@internalComponent -*/ -TChar TFoldedCanonicalIterator::Current() const - { - ASSERT(!iBase.AtEnd() || !iSorted.AtEnd()); - return iSorted.AtEnd()? iBase.Current() : iSorted.Current(); - } - -/** -@internalComponent -*/ void TFoldedCanonicalIterator::Next(const TUnicodeDataSet* aCharDataSet) { ASSERT(!iBase.AtEnd() || !iSorted.AtEnd()); @@ -1144,22 +1056,6 @@ /** @internalComponent */ -TBool TDecompositionIterator::AtEnd() const - { - return iBase.AtEnd(); - } - -/** -@internalComponent -*/ -TChar TDecompositionIterator::Current() const - { - return iDecomposition.Current(); - } - -/** -@internalComponent -*/ void TDecompositionIterator::Next() { ASSERT(!iBase.AtEnd() && !iDecomposition.AtEnd()); @@ -1244,22 +1140,6 @@ /** @internalComponent */ -TBool TCanonicalDecompositionIterator::AtEnd() const - { - return iBase.AtEnd(); - } - -/** -@internalComponent -*/ -TChar TCanonicalDecompositionIterator::Current() const - { - return iCurrentCombiningClass? iCurrent.Current() : iBase.Current(); - } - -/** -@internalComponent -*/ void TCanonicalDecompositionIterator::Next() { iLastPosition = iBase.CurrentPosition(); @@ -1321,14 +1201,6 @@ /** @internalComponent */ -TBool TCanonicalDecompositionIteratorCached::AtEnd() const - { - return iCacheSize == 0 && iBase.AtEnd(); - } - -/** -@internalComponent -*/ void TCanonicalDecompositionIteratorCached::Next(TInt aOffset) { ASSERT(0 <= aOffset); diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/euser/unicode/CompareImp.h --- a/kernel/eka/euser/unicode/CompareImp.h Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/euser/unicode/CompareImp.h Tue Sep 14 15:52:42 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2002-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2002-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" @@ -28,7 +28,7 @@ // Global functions ////////////////////////////////////////////////////////////////////////////////////////////// -TChar UTF16ToChar(const TText16* a); +inline TChar UTF16ToChar(const TText16* a); TBool IsBaseCharacter(TChar); TBool MatchSectionFolded(TUTF32Iterator& aCandidateString, TUTF32Iterator& aSearchTerm); @@ -67,7 +67,7 @@ inline TUTF32Iterator CurrentAsIterator() const; inline TBool AtEnd() const; - void Next(); + inline void Next(); inline TChar Current() const; TBool LocateFoldedBaseCharacter(TChar aChar); inline const TText16* CurrentPosition() const; @@ -93,13 +93,13 @@ inline TFoldedDecompIterator(); explicit TFoldedDecompIterator(const TUTF32Iterator&); inline void Set(const TUTF32Iterator&); - TBool AtEnd() const; + inline TBool AtEnd() const; TBool AtEndOrWildcard() const; TBool EnterFoldedSequence(); TBool StrictEnterFoldedSequence(); inline TBool IsInFoldedSequence() const; TBool CurrentIsBaseFoldedFromCombiner() const; - TChar Current() const; + inline TChar Current() const; TBool Match(TChar aCode); TBool Match(TFoldedDecompIterator& aThat); void Next(); @@ -120,8 +120,8 @@ inline TFoldedSortedDecompIterator(); TInt Set(TFoldedDecompIterator &aBase); void Set(); - TBool AtEnd() const; - TChar Current() const; + inline TBool AtEnd() const; + inline TChar Current() const; void Next(); private: @@ -143,8 +143,8 @@ { public: TFoldedCanonicalIterator(const TUTF32Iterator&); - TBool AtEnd() const; - TChar Current() const; + inline TBool AtEnd() const; + inline TChar Current() const; void Next(const TUnicodeDataSet* aCharDataSet); private: TFoldedDecompIterator iBase; @@ -165,8 +165,8 @@ inline TDecompositionIterator(); void Set(const TUTF32Iterator&); explicit TDecompositionIterator(const TUTF32Iterator&); - TBool AtEnd() const; - TChar Current() const; + inline TBool AtEnd() const; + inline TChar Current() const; void Next(); const TText16* CurrentPosition() const; private: @@ -182,8 +182,8 @@ public: inline TCanonicalDecompositionIterator(); void Set(const TUTF32Iterator&); - TBool AtEnd() const; - TChar Current() const; + inline TBool AtEnd() const; + inline TChar Current() const; void Next(); const TText16* CurrentPositionIfAtCharacter() const; TBool IsInOpenSequence() const; @@ -213,7 +213,7 @@ { public: void Set(const TUTF32Iterator&); - TBool AtEnd() const; + inline TBool AtEnd() const; // Advance aOffset characters. void Next(TInt aOffset); // Get the character at the position of the iterator plus aOffset steps. diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/euser/unicode/CompareImp.inl --- a/kernel/eka/euser/unicode/CompareImp.inl Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/euser/unicode/CompareImp.inl Tue Sep 14 15:52:42 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-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" @@ -53,6 +53,30 @@ } } +/** +@internalComponent +*/ +inline TChar UTF16ToChar(const TText16* a) + { + if (0xD800 <= a[0]) + { + if (a[0] < 0xE000) + { + if (a[0] < 0xDC00 && ::IsLowSurrogate(a[1])) + { + TChar c = ::PairSurrogates(a[0], a[1]); + if ((c & 0xFFFE) != 0xFFFE) + return c; + } + return 0xFFFF; + } + if (a[0] == 0xFFFE) + return 0xFFFF; + } + return a[0]; + } + + //////////////////////////////////////////////////////////////////////////////////////////// // TUTF32Iterator //////////////////////////////////////////////////////////////////////////////////////////// @@ -161,6 +185,20 @@ /** @internalComponent */ +inline void TUTF32Iterator::Next() + { + ASSERT(iStart != iEnd); + while (++iStart != iEnd) + { + iCurrent = ::UTF16ToChar(iStart); + if (iCurrent != 0xFFFF) + return; + } + } + +/** +@internalComponent +*/ inline const TText16* TUTF32Iterator::CurrentPosition() const { return iStart; @@ -212,11 +250,28 @@ /** @internalComponent */ +TBool TFoldedDecompIterator::AtEnd() const + { + return iOriginal.AtEnd(); + } + +/** +@internalComponent +*/ inline TBool TFoldedDecompIterator::IsInFoldedSequence() const { return !iFolded.AtEnd(); } +/** +@internalComponent +*/ +inline TChar TFoldedDecompIterator::Current() const + { + ASSERT(!AtEnd()); + return IsInFoldedSequence()? iFolded.Current() : iOriginal.Current(); + } + //////////////////////////////////////////////////////////////////////////////////////////// // TFoldedSortedDecompIterator //////////////////////////////////////////////////////////////////////////////////////////// @@ -228,6 +283,44 @@ { } +/** +@internalComponent +*/ +inline TBool TFoldedSortedDecompIterator::AtEnd() const + { + return iRemaining == 0; + } + +/** +@internalComponent +*/ +inline TChar TFoldedSortedDecompIterator::Current() const + { + ASSERT(!AtEnd()); + return iCurrent.Current(); + } + +//////////////////////////////////////////////////////////////////////////////////////////// +// TFoldedCanonicalIterator +//////////////////////////////////////////////////////////////////////////////////////////// + +/** +@internalComponent +*/ +inline TBool TFoldedCanonicalIterator::AtEnd() const + { + return iSorted.AtEnd() && iBase.AtEnd(); + } + +/** +@internalComponent +*/ +inline TChar TFoldedCanonicalIterator::Current() const + { + ASSERT(!iBase.AtEnd() || !iSorted.AtEnd()); + return iSorted.AtEnd() ? iBase.Current() : iSorted.Current(); + } + //////////////////////////////////////////////////////////////////////////////////////////// // TDecompositionIterator //////////////////////////////////////////////////////////////////////////////////////////// @@ -239,6 +332,22 @@ { } +/** +@internalComponent +*/ +inline TBool TDecompositionIterator::AtEnd() const + { + return iBase.AtEnd(); + } + +/** +@internalComponent +*/ +inline TChar TDecompositionIterator::Current() const + { + return iDecomposition.Current(); + } + //////////////////////////////////////////////////////////////////////////////////////////// // TCanonicalDecompositionIterator //////////////////////////////////////////////////////////////////////////////////////////// @@ -250,3 +359,33 @@ { } +/** +@internalComponent +*/ +inline TBool TCanonicalDecompositionIterator::AtEnd() const + { + return iBase.AtEnd(); + } + +/** +@internalComponent +*/ +inline TChar TCanonicalDecompositionIterator::Current() const + { + return iCurrentCombiningClass? iCurrent.Current() : iBase.Current(); + } + +//////////////////////////////////////////////////////////////////////////////////////////// +// TCanonicalDecompositionIteratorCached +//////////////////////////////////////////////////////////////////////////////////////////// + +/** +@internalComponent +*/ +inline TBool TCanonicalDecompositionIteratorCached::AtEnd() const + { + return iCacheSize == 0 && iBase.AtEnd(); + } + + + diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/include/e32base.h --- a/kernel/eka/include/e32base.h Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/include/e32base.h Tue Sep 14 15:52:42 2010 +0100 @@ -1314,8 +1314,7 @@ */ { public: - inline TCleanupItem(TCleanupOperation anOperation); - inline TCleanupItem(TCleanupOperation anOperation,TAny* aPtr); + inline TCleanupItem(TCleanupOperation anOperation, TAny* aPtr = 0); private: TCleanupOperation iOperation; TAny* iPtr; diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/include/e32base.inl --- a/kernel/eka/include/e32base.inl Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/include/e32base.inl Tue Sep 14 15:52:42 2010 +0100 @@ -2970,21 +2970,7 @@ // Class TCleanupItem -inline TCleanupItem::TCleanupItem(TCleanupOperation anOperation) - : iOperation(anOperation) -/** -Constructs the object with a cleanup operation. - -@param anOperation A cleanup operation which will be invoked by the pop and - destroy action resulting from a subsequent call to - CleanupStack::PopAndDestroy(). -*/ - {} - - - - -inline TCleanupItem::TCleanupItem(TCleanupOperation anOperation,TAny *aPtr) +inline TCleanupItem::TCleanupItem(TCleanupOperation anOperation, TAny *aPtr) : iOperation(anOperation), iPtr(aPtr) /** Constructs the object with a cleanup operation and a pointer to the object @@ -2995,7 +2981,7 @@ CleanupStack::PopAndDestroy(). @param aPtr A pointer to an object which is the target of the - cleanup operation. + cleanup operation. Defaults to NULL if not supplied. */ {} diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/include/e32const.h --- a/kernel/eka/include/e32const.h Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/include/e32const.h Tue Sep 14 15:52:42 2010 +0100 @@ -2409,7 +2409,7 @@ /** - The free memory level has crossed a specified threshold value. + The system's free memory level has crossed a specified threshold value. On systems that support data paging, this is also generated where the available swap space crosses one of the specified threshold values. @@ -2418,13 +2418,20 @@ /** - A memory allocation has failed due to insufficient free memory. + A memory allocation has failed due to insufficient free memory somewhere in the system. + + Please note that this notifcation is generated when any memory allocation fails, not just + allocations attempted by the current process. + + This is designed to notify a system memory manager component when a memory allocation failed + even when the system's memory has not crossed the low-memory threshold. It should not be used + as part of a memory management strategy within a single process. */ EChangesOutOfMemory=0x40, /** - The free memory level has fallen below the low-memory threshold + The system's free memory level has fallen below the low-memory threshold @see UserSvr::SetMemoryThresholds() */ EChangesLowMemory=0x80, diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/include/e32ver.h --- a/kernel/eka/include/e32ver.h Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/include/e32ver.h Tue Sep 14 15:52:42 2010 +0100 @@ -28,7 +28,7 @@ const TInt KE32MajorVersionNumber=2; const TInt KE32MinorVersionNumber=0; -const TInt KE32BuildVersionNumber=3117; +const TInt KE32BuildVersionNumber=3118; const TInt KMachineConfigurationMajorVersionNumber=1; const TInt KMachineConfigurationMinorVersionNumber=0; diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/kernel/random.cpp --- a/kernel/eka/kernel/random.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/kernel/random.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1994-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1994-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" @@ -119,9 +119,9 @@ // The random number generator requires a temporary buffer to write the data to, before we write it back to // userspace's buffer. The buffer is allocated here on the stack to avoid having to heap-allocate, and if - // the requested amount of data is larger, a loop is used. 2048 bytes will always fit onto the stack in an + // the requested amount of data is larger, a loop is used. 1024 bytes will always fit onto the stack in an // exec handler. - const TInt KRandomBufferSize = 2048; + const TInt KRandomBufferSize = 1024; TBuf8 randomBuffer; TInt err = KErrNone; diff -r d45b74d3fb20 -r ea2cef07f9fe kernel/eka/release.txt --- a/kernel/eka/release.txt Tue Aug 31 11:40:45 2010 +0100 +++ b/kernel/eka/release.txt Tue Sep 14 15:52:42 2010 +0100 @@ -1,3 +1,37 @@ +Version 2.00.3118 +================= +(Made by fadhliM 26/08/2010) + +1. daniezho + 1. ou1cimx1#512548 [kernelhwsrvmcl] tb101 crash when loading OTGDI stack + +2. t30zhang + 1. ou1cimx1#520171 [kernelhwsrv-mcl] Mutex order issue in USB host stack + +3. cnotton + 1. ou1cimx1#526643 ENV Mem::CompareF generates 100s of calls to lower level functions, some of which could be inlined + 2. ou1cimx1#532068 ENV ExecHandler::MathSecureRandom() allocates a large amount of stack space + 3. ou1cimx1#540085 ENV E32TEST T_THREAD test failure investigation (SMP, t_thread.cpp:605) + +4. paconway + 1. ou1cimx1#536356 "#include " is a case-violation on Linux + +5. ahiron + 1. ou1cimx1#533006 ENV E32TEST T_SHBUF_CLIENT test failure investigation + +6. elzou + 1. ou1cimx1#516380 Assertion failure in USB PDD with udeb kernel + +7. jcoppear + 1. ou1cimx1#530455 EChangesOutOfMemory is prone to misuse + +8. s40li + 1. ou1cimx1#520062 Panic when excute t_otgdi OPT test case + +9. davegord + 1. ou1cimx1#526359 ENV Compilation warning in kerneltest\e32test\system\t_ctrap.cpp:1305 + + Version 2.00.3117 ================= (Made by fadhliM 26/08/2010) diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/e32test/device/t_usbcsc.cpp --- a/kerneltest/e32test/device/t_usbcsc.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/e32test/device/t_usbcsc.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -24,6 +24,7 @@ #include "t_usblib.h" #include #include "u32std.h" +#include "d32otgdi.h" #include "OstTraceDefinitions.h" #ifdef OST_TRACE_COMPILER_IN_USE #include "t_usbcscTraces.h" @@ -37,8 +38,15 @@ #define DEBUGPRINT(a) {} #endif +void OpenStackIfOtg(); +void CloseStackIfOtg(); + LOCAL_D RTest test(_L("T_USBCSC")); +_LIT(KOtgdiLddFilename, "otgdi"); +static TBool gSupportsOtg; +static RUsbOtgDriver gOtgPort; + _LIT(KLddName, "eusbcsc"); _LIT(KUsbDeviceName, "Usbcsc"); @@ -309,7 +317,9 @@ test.Next(_L("Buffer Construction")); r = gPort.RealizeInterface(gChunk); test_KErrNone(r); - + + OpenStackIfOtg(); + TUsbcScChunkHeader chunkHeader(gChunk); DEBUGPRINT(test.Printf(_L("iBuffers at 0x%x, iAltSettings at 0x%x\n"),chunkHeader.iBuffers, chunkHeader.iAltSettings)); @@ -872,6 +882,8 @@ TInt r = gPort.RealizeInterface(gChunk); test_KErrNone(r); + OpenStackIfOtg(); + if (gRealHardware) { TUsbcScChunkHeader chunkHeader(gChunk); @@ -1024,6 +1036,7 @@ } delete altSetConfig; + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); } @@ -1477,6 +1490,8 @@ r = gPort.RealizeInterface(gChunk); test_KErrNone(r); + OpenStackIfOtg(); + const TInt timeOut = 5000; //5 millisec TUsbcScChunkHeader chunkHeader(gChunk); @@ -1549,6 +1564,7 @@ }//grealhardware + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); @@ -1566,6 +1582,8 @@ r = gPort.RealizeInterface(gChunk); test_KErrNone(r); + + OpenStackIfOtg(); TInt out_buf = 0; TInt in_buf = 0; @@ -1644,6 +1662,7 @@ User::WaitForRequest(status); test_Compare(status.Int(), ==, KErrArgument); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); @@ -1694,6 +1713,7 @@ OstTrace1(TRACE_NORMAL, TESTSETINTERFACE_TESTSETINTERFACE_DUP02, "Release Interface %d \n", altSetNo); r = gPort.ReleaseInterface(altSetNo); test_Compare(r, ==, KErrUsbAlreadyRealized); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); @@ -1721,6 +1741,7 @@ r = gPort.RealizeInterface(tmpChunk); //TO do Uncomment to test Realize interface call twice test_Equal(KErrUsbAlreadyRealized, r); + CloseStackIfOtg(); CloseChannel(); TestMultipleChannels(); UnloadDriver(); @@ -1743,6 +1764,7 @@ TestBufferConstruction(altSetConfig); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); @@ -1766,6 +1788,7 @@ OstTrace0(TRACE_NORMAL, TESTSETINTERFACE_TESTSETINTERFACE_DUP03, "Check chunk still populated with one interface\n"); TestBufferConstruction(altSetConfig); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); @@ -1785,6 +1808,7 @@ OstTrace0(TRACE_NORMAL, TESTSETINTERFACE_TESTSETINTERFACE_DUP04, "Check chunk still populated with one interface \n"); TestBufferConstruction(altSetConfig); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); @@ -1803,6 +1827,7 @@ OstTrace0(TRACE_NORMAL, TESTSETINTERFACE_TESTSETINTERFACE_DUP05, "Check chunk not populated with any valid data as all interfaces would be destroyed \n"); TestBufferConstruction(altSetConfig); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); test.Next(_L("Test Release Interface, No interface set but call Release interface and test Chunk construction \n")); @@ -1815,6 +1840,7 @@ TestBufferConstruction(altSetConfig); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, (TAny*)5000, 0); @@ -1837,6 +1863,7 @@ TestBufferConstruction(altSetConfig); + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); UserSvr::HalFunction(EHalGroupKernel, EKernelHalSupervisorBarrier, (TAny*)5000, 0); @@ -3298,7 +3325,29 @@ test.Next(_L("Open Channel")); TInt r = gPort.Open(0); - test_KErrNone(r); + test_KErrNone(r); + } + +void OpenStackIfOtg() + { + // On an OTG device we have to start the OTG driver, otherwise the Client + // stack will remain disabled forever. + if (gSupportsOtg) + { + test.Start(_L("Running on OTG device: loading OTG driver\n")); + test.Next(_L("Load OTG LDD")); + TInt r = User::LoadLogicalDevice(KOtgdiLddFilename); + test((r == KErrNone) || (r == KErrAlreadyExists)); + + test.Next(_L("Open OTG channel")); + r = gOtgPort.Open(); + test(r == KErrNone); + + test.Next(_L("Start OTG stack")); + r = gOtgPort.StartStacks(); + test(r == KErrNone); + test.End(); + } } void TestMultipleChannels() @@ -3328,8 +3377,24 @@ lPort3.Close(); } +void CloseStackIfOtg() + { + if (gSupportsOtg) + { + test.Start(_L("Close OTG stack\n")); + test.Next(_L("Stop OTG stack")); + gOtgPort.StopStacks(); + test.Next(_L("Close OTG Channel")); + gOtgPort.Close(); + test.Next(_L("Free OTG LDD")); + TInt r = User::FreeLogicalDevice(RUsbOtgDriver::Name()); + test(r == KErrNone); + test.End(); + } + } + void CloseChannel() - { + { test.Next(_L("Close Chunk Handle")); gChunk.Close(); @@ -3684,6 +3749,7 @@ test.Printf(_L("Finalize Interface\n")); OstTrace0(TRACE_NORMAL, TESTBILREADWRITE_TESTBILREADWRITE_DUP02, "Finalize Interface\n"); gPort.FinalizeInterface(tChunk); + OpenStackIfOtg(); if(gRealHardware) { @@ -3716,6 +3782,7 @@ OstTrace0(TRACE_NORMAL, TESTBILREADWRITE_TESTBILREADWRITE_DUP09, "!!warning- compare buffers found discrepancies!\n"); } } + CloseStackIfOtg(); gChunk.Close(); test.Printf(_L("Close global USB channel\n")); OstTrace0(TRACE_NORMAL, TESTBILREADWRITE_TESTBILREADWRITE_DUP10, "Close global USB channel\n"); @@ -3743,6 +3810,7 @@ test.Printf(_L("Finalize Interface\n")); OstTrace0(TRACE_NORMAL, TESTBILALTERNATESETTINGCHANGE_TESTBILALTERNATESETTINGCHANGE_DUP03, "Finalize Interface\n"); gPort.FinalizeInterface(tChunk); + OpenStackIfOtg(); if(gRealHardware) { @@ -3751,6 +3819,7 @@ test.Printf(_L("Enumerated. status = %d\n"), status.Int()); OstTrace1(TRACE_NORMAL, TESTBILALTERNATESETTINGCHANGE_TESTBILALTERNATESETTINGCHANGE_DUP04, "Enumerated. status = %d\n", status.Int()); } + CloseStackIfOtg(); gChunk.Close(); test.Printf(_L("Close global USB channel\n")); OstTrace0(TRACE_NORMAL, TESTBILALTERNATESETTINGCHANGE_TESTBILALTERNATESETTINGCHANGE_DUP05, "Close global USB channel\n"); @@ -3776,6 +3845,7 @@ SetupBulkInterfaces(0,1,1); RChunk *tChunk = &gChunk; test_KErrNone(gPort.FinalizeInterface(tChunk)); + OpenStackIfOtg(); if(gRealHardware) { @@ -3967,6 +4037,7 @@ // data/setup data. test.Getch(); } // end if-real-hardware + CloseStackIfOtg(); gChunk.Close(); test.Printf(_L("Close global USB channel\n")); OstTrace0(TRACE_NORMAL, TESTBILEP0_TESTBILEP0_DUP16, "Close global USB channel\n"); @@ -4256,13 +4327,15 @@ TBuf8 otg_desc; r = gPort.GetOtgDescriptor(otg_desc); test(r == KErrNotSupported || r == KErrNone); - TInt supportsOtg = (r != KErrNotSupported) ? ETrue : EFalse; - + gSupportsOtg = (r != KErrNotSupported) ? ETrue : EFalse; + + OpenStackIfOtg(); + // We turn on UDC here explicitly. This is done only once and just to test the API as such test.Next(_L("Powering up UDC")); r = gPort.PowerUpUdc(); - if (!supportsOtg) + if (!gSupportsOtg) { test_KErrNone(r); } @@ -4271,8 +4344,10 @@ test((r == KErrNone) || (r == KErrNotReady)); } + CloseStackIfOtg(); CloseChannel(); UnloadDriver(); + if (gSpecTest == EAll) { for (TInt i = 1; i <= 7; i++) diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/e32test/group/t_usb_device.mmp --- a/kerneltest/e32test/group/t_usb_device.mmp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/e32test/group/t_usb_device.mmp Tue Sep 14 15:52:42 2010 +0100 @@ -18,7 +18,6 @@ TARGET T_USB_DEVICE.EXE TARGETTYPE EXE -uid 0x0 0x20031630 // Header file paths OS_LAYER_SYSTEMINCLUDE_SYMBIAN @@ -49,6 +48,9 @@ VENDORID 0x70000001 +// 0x101fe1db to pretend to be USB Manager (needed for the OTG drivers) +UID 0x0 0x101fe1db + // Larger user heap than default: maximum = 16MB EPOCHEAPSIZE 0x1000 0x01000000 diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/e32test/group/t_usb_scdevice.mmp --- a/kerneltest/e32test/group/t_usb_scdevice.mmp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/e32test/group/t_usb_scdevice.mmp Tue Sep 14 15:52:42 2010 +0100 @@ -18,9 +18,11 @@ TARGET t_usb_scdevice.exe TARGETTYPE EXE -UID 0x0 0x20031631 VENDORID 0x70000001 +// 0x101fe1db to pretend to be USB Manager (needed for the OTG drivers) +UID 0x0 0x101fe1db + MACRO USB_SC // Header file paths diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/e32test/group/t_usbcsc.mmp --- a/kerneltest/e32test/group/t_usbcsc.mmp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/e32test/group/t_usbcsc.mmp Tue Sep 14 15:52:42 2010 +0100 @@ -28,8 +28,10 @@ CAPABILITY all -UID 0x0 0x20031634 VENDORID 0x70000001 +// 0x101fe1db to pretend to be USB Manager (needed for the OTG drivers) +UID 0x0 0x101fe1db + unpaged SMPSAFE diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/e32test/mmu/t_shbuf.cpp --- a/kerneltest/e32test/mmu/t_shbuf.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/e32test/mmu/t_shbuf.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -2336,10 +2336,98 @@ test.Printf(_L("%-6u%-6u%-6u%-6u%-6u\n"), iAllocated, iFree, iAllocated + iFree, iGrowTrigger, iShrinkTrigger); } +const TInt KMaxCountAlignmentRetries = 4; +#define CHECK_COUNT_ALIGNMENT(a,b) CheckCountAlignmentWithTimeout(a,b,(TUint)__LINE__) +#define RETRY_BUF_ALLOC(a,b,c,d,e) RetryBufAlloc(a,b,c,d,e,(TUint)__LINE__) +#define RETRY_BUF_FREE(a,b,c,d) RetryBufFree(a,b,c,d,(TUint)__LINE__) + +TInt CheckCountAlignmentWithTimeout(TTestPoolModel& aModel, RShPool& aPool, const TUint aLineNum) + { + // Allow a maximum time for the model and pool counts to align + // Return the period remaining after they align (zero if alignement is not reached) + TInt timeout = KTestFreeCountTimeOut / KTestWaitBeforeRetry; + while (aModel.FreeCount() != aPool.FreeCount()) + { + User::After(KTestWaitBeforeRetry); + if(--timeout == 0) + { + test.Printf(_L("Timeout: Free==%u (expected %u, line %d)\n"), aPool.FreeCount(), aModel.FreeCount(), aLineNum); + aModel.DisplayCounters(); + return timeout; + } + if ((timeout * KTestWaitBeforeRetry) % 1000000 == 0) + { + test.Printf(_L("Time out in %d seconds! (line %d)\n"), timeout * KTestWaitBeforeRetry / 1000000, aLineNum); + } + --timeout; + }; + return timeout; + } + +TInt RetryBufAlloc(RArray& aBufarray, TTestPoolModel& aModel, RShPool& aPool, RShBuf& aBuf, TUint aBufferFlags, const TUint aLineNum) + { + // Free a buffer, then alloc + TShPoolInfo info; + aPool.GetInfo(info); + + aBufarray[aBufarray.Count() - 1].Close(); + aBufarray.Remove(aBufarray.Count() - 1); + aModel.Free(); + // + TInt r = aBuf.Alloc(aPool, aBufferFlags); + if (r) + { + test.Printf(_L("Line %d, Re-Alloc fail, after %d of %d; Free==%u (expected %u)\n"), + aLineNum, aBufarray.Count(), info.iMaxBufs, aPool.FreeCount(), aModel.FreeCount()); + } + else + { + aModel.Alloc(); + if (!(aBufferFlags & EShPoolAllocNoMap)) + { + TPtr8 ptr(aBuf.Ptr(), aBuf.Size(),aBuf.Size()); + ptr.Fill(aBufarray.Count() % 256); + } + aBufarray.Append(aBuf); + } + + return r; + } + +TInt RetryBufFree(RArray& aBufarray, TTestPoolModel& aModel, RShPool& aPool, TUint aBufferFlags, const TUint aLineNum) + { + // Allocate a buffer, then free it + TShPoolInfo info; + aPool.GetInfo(info); + RShBuf buf; + TInt r = buf.Alloc(aPool, aBufferFlags); + if (r) + { + test.Printf(_L("Line %d, Re-Alloc fail, after %d of %d; Free==%u (expected %u)\n"), + aLineNum, aBufarray.Count(), info.iMaxBufs, aPool.FreeCount(), aModel.FreeCount()); + } + else + { + aModel.Alloc(); + if (!(aBufferFlags & EShPoolAllocNoMap)) + { + TPtr8 ptr(buf.Ptr(), buf.Size(),buf.Size()); + ptr.Fill(aBufarray.Count() % 256); + } + aBufarray.Append(buf); + // + aBufarray[aBufarray.Count() - 1].Close(); + aBufarray.Remove(aBufarray.Count() - 1); + aModel.Free(); + } + return r; + } + + + void PoolGrowingTestRoutine(const TShPoolCreateInfo& aInfo, TUint aBufferFlags = 0) { TInt r; - TInt timeout; RShPool pool; r = pool.Create(aInfo, KDefaultPoolHandleFlags); test_KErrNone(r); @@ -2359,21 +2447,9 @@ test_Equal(info.iInitialBufs, pool.FreeCount()); // Buffer allocation + TInt retriesRemaining = KMaxCountAlignmentRetries; do { - timeout = KTestFreeCountTimeOut / KTestWaitBeforeRetry; - while (model.FreeCount() != pool.FreeCount()) - { - User::After(KTestWaitBeforeRetry); - test_Assert(--timeout, - test.Printf(_L("Timeout: Free==%u (expected %u)\n"), pool.FreeCount(), model.FreeCount()); - model.DisplayCounters(); - ); - if ((timeout * KTestWaitBeforeRetry) % 1000000 == 0) - { - test.Printf(_L("Time out in %d seconds! (line %d)\n"), timeout * KTestWaitBeforeRetry / 1000000, __LINE__); - } - } RShBuf buf; r = buf.Alloc(pool, aBufferFlags); if (r == KErrNoMemory) @@ -2404,7 +2480,24 @@ ptr.Fill(bufarray.Count() % 256); } bufarray.Append(buf); + + while ((!CHECK_COUNT_ALIGNMENT(model,pool)) && retriesRemaining--) + { + // Count mismatch. Due to the operation of this test (single Alloc, then wait and check) + // it is possible for a count mis-match to occur. This is not a problem in normal operation + // as the kernel-side count will increase on the next Alloc call, triggering the pool growth. + // For now, remove the just-added buffer then repeat the Alloc + // (but only do this for a maximum number of times, to preclude getting stuck in an infinite loop). + test_Assert(retriesRemaining, + test.Printf(_L("Timeout: Free==%u (expected %u), retries remaining: %d\n"), pool.FreeCount(), model.FreeCount(), retriesRemaining); + model.DisplayCounters(); + ); + // + r = RETRY_BUF_ALLOC(bufarray, model, pool, buf, aBufferFlags); + }; + retriesRemaining = KMaxCountAlignmentRetries; } + } while (r == KErrNone); @@ -2423,39 +2516,25 @@ } bufarray[bufarray.Count() - 1].Close(); bufarray.Remove(bufarray.Count() - 1); - model.Free(); + model.Free(); - timeout = KTestFreeCountTimeOut / KTestWaitBeforeRetry; - while (model.FreeCount() != pool.FreeCount()) + while ((!CHECK_COUNT_ALIGNMENT(model,pool)) && retriesRemaining--) { - User::After(KTestWaitBeforeRetry); - test_Assert(--timeout, - test.Printf(_L("Timeout: Free==%u (expected %u)\n"), pool.FreeCount(), model.FreeCount()); + // Count mismatch. Re-add the buffer then repeat the Free. + // (but only do this for a maximum number of times, to preclude getting stuck in an infinite loop). + test_Assert(retriesRemaining, + test.Printf(_L("Timeout: Free==%u (expected %u), retries remaining: %d\n"), pool.FreeCount(), model.FreeCount(), retriesRemaining); model.DisplayCounters(); ); - if ((timeout * KTestWaitBeforeRetry) % 1000000 == 0) - { - test.Printf(_L("Time out in %d seconds! (line %d)\n"), timeout * KTestWaitBeforeRetry / 1000000, __LINE__); - } - } + // + r = RETRY_BUF_FREE(bufarray, model, pool, aBufferFlags); + }; + retriesRemaining = KMaxCountAlignmentRetries; } // ... and re-allocate them do { - timeout = KTestFreeCountTimeOut / KTestWaitBeforeRetry; - while (model.FreeCount() != pool.FreeCount()) - { - User::After(KTestWaitBeforeRetry); - test_Assert(--timeout, - test.Printf(_L("Timeout: Free==%u (expected %u)\n"), pool.FreeCount(), model.FreeCount()); - model.DisplayCounters(); - ); - if ((timeout * KTestWaitBeforeRetry) % 1000000 == 0) - { - test.Printf(_L("Time out in %d seconds! (line %d)\n"), timeout * KTestWaitBeforeRetry / 1000000, __LINE__); - } - } RShBuf buf; r = buf.Alloc(pool, aBufferFlags); if (r == KErrNoMemory) @@ -2486,6 +2565,19 @@ ptr.Fill(bufarray.Count() % 256); } bufarray.Append(buf); + + while ((!CHECK_COUNT_ALIGNMENT(model,pool)) && retriesRemaining--) + { + // Count mismatch. Remove the just-added buffer then repeat the Alloc + // (but only do this for a maximum number of times, to preclude getting stuck in an infinite loop). + test_Assert(retriesRemaining, + test.Printf(_L("Timeout: Free==%u (expected %u), retries remaining: %d\n"), pool.FreeCount(), model.FreeCount(), retriesRemaining); + model.DisplayCounters(); + ); + // + r = RETRY_BUF_ALLOC(bufarray, model, pool, buf, aBufferFlags); + }; + retriesRemaining = KMaxCountAlignmentRetries; } } while (r == KErrNone); @@ -2505,21 +2597,20 @@ } bufarray[bufarray.Count() - 1].Close(); bufarray.Remove(bufarray.Count() - 1); - model.Free(); + model.Free(); - timeout = KTestFreeCountTimeOut / KTestWaitBeforeRetry; - while (model.FreeCount() != pool.FreeCount()) + while ((!CHECK_COUNT_ALIGNMENT(model,pool)) && retriesRemaining--) { - User::After(KTestWaitBeforeRetry); - test_Assert(--timeout, - test.Printf(_L("Timeout: Free==%u (expected %u)\n"), pool.FreeCount(), model.FreeCount()); + // Count mismatch. Re-add the buffer then repeat the Free. + // (but only do this for a maximum number of times, to preclude getting stuck in an infinite loop). + test_Assert(retriesRemaining, + test.Printf(_L("Timeout: Free==%u (expected %u), retries remaining: %d\n"), pool.FreeCount(), model.FreeCount(), retriesRemaining); model.DisplayCounters(); ); - if ((timeout * KTestWaitBeforeRetry) % 1000000 == 0) - { - test.Printf(_L("Time out in %d seconds! (line %d)\n"), timeout * KTestWaitBeforeRetry / 1000000, __LINE__); - } - } + // + r = RETRY_BUF_FREE(bufarray, model, pool, aBufferFlags); + }; + retriesRemaining = KMaxCountAlignmentRetries; } // Pool should have shrunk back to its initial size diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/e32test/thread/t_thread.cpp --- a/kerneltest/e32test/thread/t_thread.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/e32test/thread/t_thread.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 1995-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 1995-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" @@ -314,17 +314,29 @@ return(KErrNone); } -TInt StartInstructionThread(RThread& aT, const TDesC& aName, TInt aInstruction, TOwnerType aOwnerType, TRequestStatus* aL, TRequestStatus* aR) +TInt StartInstructionThread(RThread& aT, const TDesC& aName, TInt aInstruction, RAllocator* aAllocator, TOwnerType aOwnerType, TRequestStatus* aL, TRequestStatus* aR) { - TInt r = aT.Create(aName, &InstructionThread, KDefaultStackSize, KHeapSize, KHeapSize, (TAny*)aInstruction, aOwnerType); + TInt r; + + if (aAllocator == NULL) + { + r = aT.Create(aName, &InstructionThread, KDefaultStackSize, KHeapSize, KHeapSize, (TAny*)aInstruction, aOwnerType); + } + else + { + r = aT.Create(aName, &InstructionThread, KDefaultStackSize, aAllocator, (TAny*)aInstruction, aOwnerType); + } + if (r!=KErrNone) return r; + if (aL) { aT.Logon(*aL); TInt s = aL->Int(); test_Equal(s, KRequestPending); } + if (aR) { aT.Rendezvous(*aR); @@ -335,6 +347,7 @@ s = aR->Int(); test_KErrNone(s); } + return r; } @@ -404,7 +417,7 @@ thread.Close(); test.Next(_L("Create ENormal")); - r = StartInstructionThread(thread, _L("Thread"), ENormal, EOwnerProcess, 0, 0); + r = StartInstructionThread(thread, _L("Thread"), ENormal, NULL, EOwnerProcess, 0, 0); test_KErrNone(r); test.Next(_L("Test priorities")); @@ -547,7 +560,7 @@ for (TInt xx=0;xx<10;xx++) { test.Printf(_L("\r%02d"),xx); - r = StartInstructionThread(thread, _L("Thread1"), ENormal, anOwnerType, &stat, 0); + r = StartInstructionThread(thread, _L("Thread1"), ENormal, NULL, anOwnerType, &stat, 0); test_KErrNone(r); thread.Resume(); User::WaitForRequest(stat); @@ -556,7 +569,7 @@ test.Printf(_L("\n")); test.Next(_L("Panic within thread")); - r = StartInstructionThread(thread, _L("Thread2"), EInstrPanic, anOwnerType, &stat, 0); + r = StartInstructionThread(thread, _L("Thread2"), EInstrPanic, NULL, anOwnerType, &stat, 0); test_KErrNone(r); test(thread.ExitType()==EExitPending); thread.Resume(); @@ -570,11 +583,27 @@ TInt ijk; TUint seed[2] = { 0xadf85458, 0 }; TUint maxcount = 0; + RHeap* temporaryHeap = User::ChunkHeap(NULL, KHeapSize*8192, KHeapSize*8192); + test(temporaryHeap != NULL); for (ijk=0; ijk<8192; ++ijk) { if (!(ijk&255)) test.Printf(_L("%d\n"), ijk); - r = StartInstructionThread(thread, _L("Thread3"), EWait, anOwnerType, &stat, 0); + + // + // For this test we need to use a temporary heap created in advance as we + // will be panicking the thread at any point during its creation and since + // the heap would have been allocated by the user side thread, it is + // possible that if we let it allocate its own heap, the kernel may not + // be able to close it in the temporary states of creation or when + // TLocalThreadData::DllSetTls() grabs a temporary handle on the heap. + // In those cases RTest::CloseHandleAndWaitForDestruction() would timeout + // and the test would fail. + // + // In addition, if we shared the creating thread's heap allocations may + // be left behind and cause the heap mark test to fail on this thread. + // + r = StartInstructionThread(thread, _L("Thread3"), EWait, temporaryHeap, anOwnerType, &stat, 0); test_KErrNone(r); __e32_atomic_store_ord32(&IFLAG, 0); thread.Resume(); @@ -604,9 +633,10 @@ r = RTest::CloseHandleAndWaitForDestruction(thread); test_KErrNone(r); } + temporaryHeap->Close(); test.Next(_L("Internal exit")); - r = StartInstructionThread(thread, _L("Thread4"), ENormal, anOwnerType, &stat, 0); + r = StartInstructionThread(thread, _L("Thread4"), ENormal, NULL, anOwnerType, &stat, 0); test_KErrNone(r); test(thread.ExitType()==EExitPending); thread.Resume(); @@ -617,7 +647,7 @@ CLOSE_AND_WAIT(thread); test.Next(_L("External terminate")); - r = StartInstructionThread(thread, _L("Thread5"), EWait, anOwnerType, &stat, &rstat); + r = StartInstructionThread(thread, _L("Thread5"), EWait, NULL, anOwnerType, &stat, &rstat); test_KErrNone(r); test.Next(_L("Terminate")); thread.Terminate(KTerminationReason); @@ -630,7 +660,7 @@ CLOSE_AND_WAIT(thread); test.Next(_L("External kill")); - r = StartInstructionThread(thread, _L("Thread6"), EWait, anOwnerType, &stat, &rstat); + r = StartInstructionThread(thread, _L("Thread6"), EWait, NULL, anOwnerType, &stat, &rstat); test_KErrNone(r); thread.Suspend(); thread.Resume(); diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/e32test/usb/t_usb_device/src/activecontrol.cpp --- a/kerneltest/e32test/usb/t_usb_device/src/activecontrol.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/e32test/usb/t_usb_device/src/activecontrol.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -24,6 +24,7 @@ #include "activecontrol.h" #include "apitests.h" #include "activerw.h" +#include "d32otgdi.h" #ifdef USB_SC #include "tranhandleserver.h" #endif @@ -36,6 +37,12 @@ void StartMassStorage(RDEVCLIENT* aPort); void StopMassStorage(RDEVCLIENT* aPort); +void OpenStackIfOtg(); +void CloseStackIfOtg(); + +_LIT(KOtgdiLddFilename, "otgdi"); +static TBool gSupportsOtg; +static RUsbOtgDriver gOtgPort; enum Ep0Requests { @@ -287,6 +294,19 @@ } } + // Check for OTG support + TBuf8 otg_desc; + r = iPort[0].GetOtgDescriptor(otg_desc); + if (!(r == KErrNotSupported || r == KErrNone)) + { + OstTrace1(TRACE_NORMAL, CACTIVECONTROL_CONSTRUCTL_DUP08, "Error %d while fetching OTG descriptor", r); + User::Leave(-1); + return; + } + gSupportsOtg = (r != KErrNotSupported) ? ETrue : EFalse; + + OpenStackIfOtg(); + iTotalChannels += lddPtr->iNumChannels; nextPort += lddPtr->iNumChannels; lddPtr = lddPtr->iPtrNext; @@ -1030,7 +1050,9 @@ { PrintHostLog(); } - + + CloseStackIfOtg(); + for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) { // base class cancel -> calls our DoCancel @@ -1372,6 +1394,8 @@ r = iPort[0].SendEp0StatusPacket(); test_KErrNone(r); + CloseStackIfOtg(); + for (TInt portNumber = 0; portNumber < iTotalChannels; portNumber++) { delete iDeviceStateNotifier[portNumber]; @@ -1415,6 +1439,8 @@ SetupDescriptors(iLddPtr, &iPort[0],value); StartMassStorage(&iPort[0]); + OpenStackIfOtg(); + test.Next (_L("Enumeration...")); r = ReEnumerate(); test_KErrNone(r); @@ -2360,4 +2386,43 @@ } #endif + +void OpenStackIfOtg() + { + // On an OTG device we have to start the OTG driver, otherwise the Client + // stack will remain disabled forever. + if (gSupportsOtg) + { + test.Start(_L("Running on OTG device: loading OTG driver\n")); + test.Next(_L("Load OTG LDD")); + TInt r = User::LoadLogicalDevice(KOtgdiLddFilename); + test((r == KErrNone) || (r == KErrAlreadyExists)); + + test.Next(_L("Open OTG channel")); + r = gOtgPort.Open(); + test(r == KErrNone); + + test.Next(_L("Start OTG stack")); + r = gOtgPort.StartStacks(); + test(r == KErrNone); + test.End(); + } + } + +void CloseStackIfOtg() + { + if (gSupportsOtg) + { + test.Start(_L("Close OTG stack\n")); + test.Next(_L("Stop OTG stack")); + gOtgPort.StopStacks(); + test.Next(_L("Close OTG Channel")); + gOtgPort.Close(); + test.Next(_L("Free OTG LDD")); + TInt r = User::FreeLogicalDevice(RUsbOtgDriver::Name()); + test(r == KErrNone); + test.End(); + } + } + // -eof- diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/f32test/server/t_dspace.cpp --- a/kerneltest/f32test/server/t_dspace.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/f32test/server/t_dspace.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -265,6 +265,8 @@ // { TInt64 space=FreeDiskSpace(aDrive); + RDebug::Print(_L("Filling drive till %lu bytes left, current freespace is %lu."), aNewSpace, space); + test(space>aNewSpace); while(space>aNewSpace) { @@ -730,6 +732,7 @@ // format,scandrive, media change // { + test.Next(_L("test Disk Notify")); // make default directory _LIT(defaultDir,"C:\\F32-TST\\"); TInt r=TheFs.MkDirAll(defaultDir); diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/f32test/server/t_fsys.cpp --- a/kerneltest/f32test/server/t_fsys.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/f32test/server/t_fsys.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -30,6 +30,16 @@ RTest test(_L("T_FSYS")); static TInt64 gRndSeed; +_LIT(KTestFsy, "T_TFSYS"); +_LIT(KTestFsy2, "T_TFSYS2"); +_LIT(KTestFsy3, "T_TFSYS3"); + +_LIT(KTestFsName, "Test"); +_LIT(KTestFsName2, "Test2"); +_LIT(KTestFsName3, "Test3"); + + + //--------------------------------------------------- @@ -53,10 +63,10 @@ */ void TestFileSystemNameLength() { - test.Next(_L("Test file system name lenght limits")); + test.Next(_L("Test file system name length limits\n")); if(Is_SimulatedSystemDrive(TheFs, CurrentDrive())) { - test.Printf(_L("Can't test on a simulated drive, skipping!")); + test.Printf(_L("Can't test on a simulated drive, skipping!\n")); return; } @@ -176,26 +186,41 @@ test_KErrNone(nRes); } - +//--------------------------------------------------- static void TestFileSystemNames() { - test.Next(_L("Read file system names for all drives")); + test.Next(_L("TestFileSystemNames(). Read file system names for all drives\n")); TFullName name; - TInt r; - for(TInt i=EDriveA;i buf; + TInt nRes; + + TDriveList drvList; + nRes = TheFs.DriveList(drvList); + test_KErrNone(nRes); + + for(TInt i=0; i b; TChar c; TInt r=TheFs.DriveToChar(aDrive,c); @@ -311,14 +344,14 @@ TDriveInfo di; r=TheFs.Drive(di,aDrive); test_KErrNone(r); - b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt); + b.Format(_L("Test mounting of test file system on %c: (DrvAtt:%x MedAtt:%x)\n"),(TUint)c,di.iDriveAtt,di.iMediaAtt); test.Next(b); - test.Next(_L("Test mounting of test file system")); - r=TheFs.AddFileSystem(_L("T_TFSYS")); + test.Next(_L("Test mounting of test file system\n")); + r=TheFs.AddFileSystem(KTestFsy); if(r!=KErrNone && r!=KErrAlreadyExists) { - test.Printf(_L("error=%d"),r); + test.Printf(_L("error=%d\n"),r); test(EFalse); } @@ -330,35 +363,34 @@ r=TheFs.DismountFileSystem(oldFs,aDrive); if(r!=KErrNone) { - test.Printf(_L("Error = %d"),r); + test.Printf(_L("Error = %d\n"),r); test(EFalse); } - r=TheFs.MountFileSystem(_L("Test"),aDrive); + r=TheFs.MountFileSystem(KTestFsName,aDrive); test_KErrNone(r); TFileName newFs; r=TheFs.FileSystemName(newFs,aDrive); test_KErrNone(r); - test(newFs.Compare(_L("Test"))==0); + test(newFs.Compare(KTestFsName)==0); // Check attributes TDriveInfo info; r=TheFs.Drive(info,aDrive); test_KErrNone(r); - test.Printf(_L("iType=%d,iConnectionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\ - (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt); + test.Printf(_L("iType=%d,iConnectionBusType=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType, (TUint)info.iConnectionBusType,info.iDriveAtt,info.iMediaAtt); //Try to remove filesystem without dismounting. - r=TheFs.RemoveFileSystem(_L("Test")); + r=TheFs.RemoveFileSystem(KTestFsName); if(r!=KErrInUse) { - test.Printf(_L("error=%d"),r); + test.Printf(_L("error=%d\n"),r); test(EFalse); } r=TheFs.FileSystemName(newFs,aDrive); test_KErrNone(r); - test(newFs.Compare(_L("Test"))==0); + test(newFs.Compare(KTestFsName)==0); r=TheFs.DismountFileSystem(newFs,aDrive); test_KErrNone(r); @@ -366,31 +398,33 @@ r=TheFs.MountFileSystem(oldFs,aDrive); test_KErrNone(r); } -#endif +//--------------------------------------------------- static void TestMountInvalidDrive() -// -// Attempt to mount FAT on non-local drive { - test.Start(_L("TestMountInvalidDrive")); + test.Next(_L("TestMountInvalidDrive(). Try mounting FS on an invalid drive\n")); - TInt r; + //-- 1. find an invalid drive + TInt drv = 0; + TDriveList drvList; + + TInt nRes = TheFs.DriveList(drvList); + test_KErrNone(nRes); - test.Next(_L("Adding EFAT")); -#ifdef __WINS__ - _LIT(KFsNm, "EFAT32"); -#else - _LIT(KFsNm, "ELOCAL"); -#endif + for(drv =0; drv subName; TInt i, r; @@ -690,7 +724,7 @@ //---------------------------------------------------------------------------------------------- static void TestFileSystemClusterSizeQuery() { - test.Next(_L("Test querying cluster size information of the mounted file system")); + test.Next(_L("Test querying cluster size information of the mounted file system\n")); TFullName fsName; TPckgBuf ioInfo; TInt i, r; @@ -795,12 +829,12 @@ //---------------------------------------------------------------------------------------------- static void TestMediaBlockSizeQuery() { - test.Next(_L("Test querying block size information of the underlying media")); + test.Next(_L("Test querying block size information of the underlying media\n")); #if defined(__WINS__) - test.Printf(_L("This test case runs on hardware only")); + test.Printf(_L("This test case runs on hardware only\n")); return; - #else // test runs on hardware only. + TFSName fsName; TPckgBuf ioInfo; TInt i, r; @@ -914,7 +948,7 @@ //---------------------------------------------------------------------------------------------- static void TestFileSystemSubType() { - test.Next(_L("Test wrapper API RFs::FileSystemSubType()'s behaviour")); + test.Next(_L("Test wrapper API RFs::FileSystemSubType()'s behaviour\n")); TFSName fsName; TPckgBuf subName; TInt r; @@ -956,7 +990,7 @@ //---------------------------------------------------------------------------------------------- static void TestVolumeIOParam() { - test.Next(_L("Test wrapper API RFs::VolumeIOParam()'s behaviour")); + test.Next(_L("Test wrapper API RFs::VolumeIOParam()'s behaviour\n")); TFSName fsName; TPckgBuf ioInfo; TInt r; @@ -1005,11 +1039,11 @@ test.Printf(_L("Tested on drive: %c.\n"), (char)(aDrive+'A')); // Mount a new CTestFileSystem on the drive under test - test.Next(_L("Test RFs::QueryVolumeInfoExt() on Testing File System")); - r = TheFs.AddFileSystem(_L("T_TFSYS3")); + test.Next(_L("Test RFs::QueryVolumeInfoExt() on Testing File System\n")); + r = TheFs.AddFileSystem(KTestFsy3); if (r != KErrNone && r != KErrAlreadyExists) { - test.Printf(_L("error=%d"),r); + test.Printf(_L("error=%d\n"),r); test(EFalse); } TFSName oldFs; @@ -1018,15 +1052,15 @@ r = TheFs.DismountFileSystem(oldFs,aDrive); if (r != KErrNone) { - test.Printf(_L("Error = %d"),r); + test.Printf(_L("Error = %d\n"),r); test(EFalse); } - r = TheFs.MountFileSystem(_L("Test3"),aDrive); + r = TheFs.MountFileSystem(KTestFsName3, aDrive); test_KErrNone(r); TFSName newFs; r = TheFs.FileSystemName(newFs,aDrive); test_KErrNone(r); - test(newFs.Compare(_L("Test3"))==0); + test(newFs.Compare(KTestFsName3)==0); // Sub type name query: TPckgBuf subNameP; @@ -1046,10 +1080,10 @@ r=TheFs.MountFileSystem(oldFs,aDrive); test_KErrNone(r); - r=TheFs.RemoveFileSystem(_L("Test3")); + r=TheFs.RemoveFileSystem(KTestFsName3); if(r!=KErrNone) { - test.Printf(_L("error=%d"),r); + test.Printf(_L("error=%d\n"),r); test(EFalse); } } @@ -1068,7 +1102,21 @@ { test.Next(_L("Testing forcedly remounting FS with objects opened.\n")); + //-- don't perform this test on a non-removable drive, generating media change on such drive + //-- doesn't always work TInt nRes; + const TInt drvNumber = CurrentDrive(); + TDriveInfo driveInfo; + + nRes = TheFs.Drive(driveInfo, drvNumber); + test_KErrNone(nRes); + + if(! (driveInfo.iDriveAtt & KDriveAttRemovable)) + { + test.Printf(_L("Can't perform this test on a non-removable drive. Skippping!\n")); + return; + } + //-- 1. create a file _LIT(KFile, "\\test_file.file"); @@ -1083,7 +1131,7 @@ nRes = file.Open(TheFs, KFile, EFileRead); test_KErrNone(nRes); - const TInt drvNumber = CurrentDrive(); + //-- 2.1 try to dismount the FS, it must fail because of the opened object. TBuf<40> fsName; @@ -1097,14 +1145,14 @@ const TUint KMediaRemountForceMediaChange = 0x00000001; TRequestStatus changeStatus; TheFs.NotifyChange(ENotifyAll, changeStatus); - TDriveInfo driveInfo; + //-- 3. forcedly remount the drive nRes = TheFs.RemountDrive(drvNumber, NULL, KMediaRemountForceMediaChange); if(nRes == KErrNotSupported) {//-- this feature is not supported and the test is inconsistent. - test.Printf(_L("RemountDrive() is not supported, the test is inconsistent!")); + test.Printf(_L("RemountDrive() is not supported, the test is inconsistent!\n")); //-- remounting must work at least on MMC drives const TBool isFAT = Is_Fat(TheFs, drvNumber); @@ -1117,6 +1165,7 @@ else { test_Value(nRes, nRes == KErrNotReady || nRes == KErrNone); + test.Printf(_L("Waiting for the simulated media change...\n")); //-- 3.1 wait for media change to complete do @@ -1152,7 +1201,7 @@ //---------------------------------------------------------------------------------------------- static void TestFileSystem_MaxSupportedFileSizeQuery() { - test.Next(_L("Test querying max. supported file size on this file system")); + test.Next(_L("Test querying max. supported file size on this file system\n")); TFullName fsName; TPckgBuf ioInfo; TVolumeIOParamInfo& volInfo = ioInfo(); @@ -1183,33 +1232,28 @@ } //---------------------------------------------------------------------------------------------- -GLDEF_C void CallTestsL() -// -// Do all tests -// +void CallTestsL() { //-- set up console output Fat_Test_Utils::SetConsole(test.Console()); - TInt drive=CurrentDrive(); - + const TInt drive=CurrentDrive(); PrintDrvInfo(TheFs, drive); - //Do not run this test on the NAND drive, as - //this has the FTL mounted as a primary extension + //Do not run this test on the NAND drive, as this has the FTL mounted as a primary extension //which causes the test to fail - #if defined(__WINS__) - if (drive==EDriveU) - return; - #else - TDriveInfo driveInfo; - TheFs.Drive(driveInfo,drive); - if (driveInfo.iType == EMediaNANDFlash) - { - return; - } - #endif + + TFSName pExtName; + pExtName.Zero(); + + TInt nRes = TheFs.ExtensionName(pExtName, drive, 0); + + if(nRes == KErrNone && pExtName.Length()) + { + test.Printf(_L("This test can't be run on a drive that has a primary extension:%S\n"), &pExtName); + return; + } //--------------------------------------- @@ -1219,12 +1263,8 @@ TestFileSystemNames(); TestFileSystemNameLength(); TestDismountFileSystem(CurrentDrive()); -#if defined(__EPOC32__) TestFileSystem(CurrentDrive()); -#endif - TestMountInvalidDrive(); - TestMountingBrokenMedia(CurrentDrive()); TestSubstDriveMediaSerialNumber(); @@ -1234,9 +1274,7 @@ TestFileSystemSubType(); TestVolumeIOParam(); TestQueryVolumeInfoExtOnTestFS(CurrentDrive()); - TestFileSystem_MaxSupportedFileSizeQuery(); - TestRemountFSWithOpenedObjects(); //--------------------------------------- diff -r d45b74d3fb20 -r ea2cef07f9fe kerneltest/f32test/smassstorage/src/t_gml_tur.cpp --- a/kerneltest/f32test/smassstorage/src/t_gml_tur.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/kerneltest/f32test/smassstorage/src/t_gml_tur.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -13,12 +13,13 @@ // Description: // +#define __E32TEST_EXTENSION__ #include -#include #include #include #include "t_gml_tur_protocol.h" #include "t_gml_tur_controller.h" +#include "protocol.h" #include "cbulkonlytransport.h" LOCAL_D RTest test(_L("t_gml_tur")); @@ -96,7 +97,7 @@ gController = controller; controller->CreateL(0); - CBulkOnlyTransport* transport = NULL; + MTransportBase* transport = NULL; TRAP(err, transport = CBulkOnlyTransport::NewL(numDrives, *controller)); if (err != KErrNone) { @@ -217,14 +218,15 @@ //Wait for thread to die test.Printf(_L("Waiting for controller thread to die\n")); User::WaitForRequest(logonStatus); - transportThread.Close(); + transportThread.Close(); + test.Printf(_L("The thread is dead, long live the thread\n")); - + ldd.Close(); test.Printf(_L("Unloading ldd")); err = User::FreeLogicalDevice(KLddName); - test(err == KErrNone); + test_KErrNone(err); test.End(); diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/group/release.txt --- a/userlibandfileserver/fileserver/group/release.txt Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/group/release.txt Tue Sep 14 15:52:42 2010 +0100 @@ -1,3 +1,21 @@ +Version 2.00.3060 +================= +(Made by fadhliM 26/08/2010) + +1. niccox + 1. ou1cimx1#538290 t_gml_tur fails on BRIDGE + +2. h14jiang + 1. ou1cimx1#485508 ENV T_DSPACE X test failure investigation (t_dspace.cpp:268) + +3. frhofman + 1. ou1cimx1#538308 IT_BITO_SSS_SD - TB9.2 wk29 - sf/os/kernelhwsrv - Resource Leak for objects of handle-based R classes + +4. dlyokhin + 1. ou1cimx1#529927 ENV : SIROCCO - Vasco - T_FSYS Fails with -20 + 2. ou1cimx1#531477 EI FAT implementation needs more stricter checks of volume geometry + + Version 2.00.3059 ================= (Made by fadhliM 23/08/2010) diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/inc/f32ver.h --- a/userlibandfileserver/fileserver/inc/f32ver.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/inc/f32ver.h Tue Sep 14 15:52:42 2010 +0100 @@ -58,6 +58,6 @@ @see TVersion */ -const TInt KF32BuildVersionNumber=3059; +const TInt KF32BuildVersionNumber=3060; // #endif diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/common_constants.h --- a/userlibandfileserver/fileserver/sfat32/common_constants.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/common_constants.h Tue Sep 14 15:52:42 2010 +0100 @@ -97,10 +97,6 @@ typedef TUint16 TFat16Entry; _LIT8(KLit8ReplacementForUnconvertibleUnicodeCharacters, "_"); -_LIT8(KFileSystemName12,"FAT12 "); ///< Name in BPB given to a Fat12 volume -_LIT8(KFileSystemName16,"FAT16 "); ///< Name in BPB given to a Fat16 volume -_LIT8(KFileSystemName32,"FAT32 "); ///< Name in BPB given to a Fat32 volume -_LIT8(KDefaultVendorID, "EPOC"); ///< Vendor Name for BPB for any volume formated using a Symbian OS device const TInt KMaxFatFileNameExt=3; ///< Maximum Fat file system file/directory name extension length const TInt KNumberOfFatsInternal=1; ///< Number of FATs for an internal drive diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/inc/sl_fatcache32.h --- a/userlibandfileserver/fileserver/sfat32/inc/sl_fatcache32.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/inc/sl_fatcache32.h Tue Sep 14 15:52:42 2010 +0100 @@ -83,7 +83,6 @@ typedef TDblQue TPageList; typedef TDblQueIter TPageIterator; - TUint32 iMaxFatEntries; ///< maximal number of FAT entries in FAT table TUint iNumPagesAllocated; ///< number of pages currently allocated TUint iMaxPages; ///< maximal pages allowed to allocate TPageList iPageList; ///< LRU list of cache pages. diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/inc/sl_std.h --- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.h Tue Sep 14 15:52:42 2010 +0100 @@ -935,9 +935,9 @@ TBool iMatchUid; ///< Flag to indicate if UID matches }; +//--------------------------------------------------------------------------------------------------------------------------------- /** - Fat file system Format subsession implmentation, provides all that is required of a plug in - file system format as well as Fat specific functionality + FAT Format Control Block class, responsible for FAT volumes formatting */ class CFatFormatCB : public CFormatCB { @@ -963,10 +963,11 @@ void InitializeFormatDataL(); void DoZeroFillMediaL(TInt64 aStartPos, TInt64 aEndPos); - TInt InitFormatDataForVariableSizeDisk(TUint aDiskSizeInSectors); - TInt InitFormatDataForFixedSizeDiskNormal(TUint aDiskSizeInSectors, const TLocalDriveCapsV6& aCaps); - TInt InitFormatDataForFixedSizeDiskCustom(const TLDFormatInfo& aFormatInfo); - TInt InitFormatDataForFixedSizeDiskUser(TUint aDiskSizeInSectors); + TInt ProcessVolParam_User(const TLocalDriveCapsV6& aCaps); + TInt ProcessVolParam_Custom(const TLocalDriveCapsV6& aCaps); + TInt ProcessVolParam_Default(const TLocalDriveCapsV6& aCaps); + TInt ProcessVolParam_RamDisk(); + void AdjustClusterSize(TUint aRecommendedSectorsPerCluster); TInt AdjustFirstDataSectorAlignment(TUint aBlockSize); TInt FirstDataSector() const; @@ -981,15 +982,22 @@ TUint MaxFat16Sectors() const; TUint MaxFat32Sectors() const; - inline TBool Is16BitFat() const; - inline TBool Is32BitFat() const; inline CFatMountCB& FatMount(); inline CProxyDrive* LocalDrive(); TFatType SuggestFatType() const; + + inline TBool FatTypeValid() const; + inline TFatType FatType() const; + inline void SetFatType(TFatType aType); + + inline TBool Is16BitFat() const; + inline TBool Is32BitFat() const; + + private: - TBool iVariableSize; ///< Flag to indicat if we are dealing with a variable size volume + TBool iVariableSize; ///< Flag to indicate if we are dealing with a variable size volume (RAM drive) TUint16 iBytesPerSector; ///< Byte per sector of media TInt iSectorSizeLog2; ///< Sector size in log2 @@ -1000,12 +1008,14 @@ TUint iSectorsPerFat; ///< Number of sectors the Fat uses TUint32 iMaxDiskSectors; ///< number of sectors the volume has TFormatInfo iFormatInfo; ///< format information for a custom format - TBuf8<16> iFileSystemName;///< Buffer to contain the volume name + TFatType iFatType; ///< FAT type + TInt iHiddenSectors; ///< Number of hidden sectors in the volume TUint16 iNumberOfHeads; ///< Number of heads the media device has, not used so far as only used on solid state media. TUint16 iSectorsPerTrack; ///< Number of sectors the media device has, not used so far as only used on solid state media. TUint32 iRootClusterNum; ///< cluster number used for root directory, Fat32 specific TUint32 iCountOfClusters; ///< Count of clusters on the media + RArray iBadClusters; ///< Array of bad cluster numbers RArray iBadSectors; ///< Array of bad sector numbers TBool iDiskCorrupt; ///< Disk is corrupt when format or not diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/inc/sl_std.inl --- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl Tue Sep 14 15:52:42 2010 +0100 @@ -471,14 +471,48 @@ /** @return pointer to the owning mount object */ CFatMountCB& CFatFormatCB::FatMount() - {return *(CFatMountCB*)&Mount();} + { + return *(CFatMountCB*)&Mount(); + } /** Returns the local drive used by the file systems from the owning mount @return Pointer to the local drive */ CProxyDrive* CFatFormatCB::LocalDrive() - {return(FatMount().LocalDrive());} + { + return(FatMount().LocalDrive()); + } + + +TBool CFatFormatCB::FatTypeValid() const + { + return (iFatType == EFat12 || iFatType == EFat16 || iFatType == EFat32); + } + +TFatType CFatFormatCB::FatType() const + { + ASSERT(FatTypeValid()); + return iFatType; + } + +void CFatFormatCB::SetFatType(TFatType aType) + { + ASSERT(aType != EInvalid); + iFatType = aType; + } + +TBool CFatFormatCB::Is16BitFat() const + { + ASSERT(FatTypeValid()); + return iFatType == EFat16; + } + +TBool CFatFormatCB::Is32BitFat() const + { + ASSERT(FatTypeValid()); + return iFatType == EFat32; + } //--------------------------------------------------------------------------------------------------------------------------------- diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/sl_fatcache.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -63,9 +63,13 @@ iFatSecSzLog2 = (TUint16)aOwner->SectorSizeLog2(); iFatClustSzLog2 = (TUint16)aOwner->ClusterSizeLog2(); + //-- obtain maximal number of entries in the FAT table, count FAT[0] and FAT[1] as well, though they must not be accessed via cache + iMaxFatEntries = aOwner->UsableClusters()+KFatFirstSearchCluster; + __ASSERT_ALWAYS(iNumFATs >=1, User::Leave(KErrCorrupt)); __PRINT3(_L("#-CFatCacheBase::InitialiseL() FatStart:%u, FatSz:%d, drv:%d"),iFatStartPos, iFatSize, aOwner->DriveNumber()); + } //----------------------------------------------------------------------------- @@ -394,7 +398,7 @@ TUint32 CFat16FixedCache::ReadEntryL(TUint32 aIndex) { //__PRINT1(_L("#-CFat16FixedCache::ReadEntryL() FAT idx:%d"), aIndex); - ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat16EntrySzLog2)); + ASSERT(FatIndexValid(aIndex)); //-- calculate page index in the array. Theoretically, aIndex can't be wrong because it is checked by the caller; //-- but in some strange situations (malformed volume ?) aIndex might get bigger than number of usable clusters. @@ -441,7 +445,7 @@ { //__PRINT2(_L("#-CFat16FixedCache::WriteEntryL() FAT idx:%d, val:%d"), aIndex, aEntry); - ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat16EntrySzLog2)); + ASSERT(FatIndexValid(aIndex)); SetDirty(ETrue); @@ -561,7 +565,8 @@ TInt CFat16FixedCache::InvalidateRegion(TUint32 aStartIndex, TUint32 aNumEntries) { __PRINT2(_L("#-CFat16FixedCache::InvalidateRegion() startIndex:%d, entries:%d"),aStartIndex, aNumEntries); - ASSERT(aStartIndex >= KFatFirstSearchCluster && aStartIndex < (FatSize() >> KFat16EntrySzLog2)); + ASSERT(FatIndexValid(aStartIndex)); + ASSERT(FatIndexValid(aStartIndex+aNumEntries-1)); if(!aNumEntries) { @@ -905,7 +910,7 @@ TUint32 CFat12Cache::ReadEntryL(TUint32 aIndex) { //__PRINT1(_L("#-CFat12Cache::ReadEntryL() FAT idx:%d"), aIndex); - ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() + FatSize()/2)); //-- FAT12 entry is 1.5 bytes long + ASSERT(FatIndexValid(aIndex)); TUint32 entry; @@ -938,7 +943,7 @@ void CFat12Cache::WriteEntryL(TUint32 aIndex, TUint32 aEntry) { //__PRINT2(_L("#-CFat12Cache::WriteEntryL() FAT idx:%d, entry:%u"), aIndex, aEntry); - ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() + FatSize()/2)); //-- FAT12 entry is 1.5 bytes long + ASSERT(FatIndexValid(aIndex)); aEntry &= KFat12EntryMask; @@ -1079,7 +1084,10 @@ TInt CFat12Cache::InvalidateRegion(TUint32 aStartIndex, TUint32 aNumEntries) { __PRINT2(_L("#-CFat12Cache::InvalidateRegion() startIndex:%d, entries:%d"),aStartIndex, aNumEntries); - ASSERT(aStartIndex >= KFatFirstSearchCluster && aStartIndex < (FatSize() + FatSize()/2)); //-- FAT12 entry is 1.5 bytes long + + ASSERT(FatIndexValid(aStartIndex)); + ASSERT(FatIndexValid(aStartIndex+aNumEntries-1)); + (void)aStartIndex; (void)aNumEntries; diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/sl_fatcache.h --- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.h Tue Sep 14 15:52:42 2010 +0100 @@ -78,6 +78,10 @@ inline TUint FAT_SectorSz() const; inline TUint FAT_ClusterSzLog2() const; + inline TUint32 MaxFatEntries() const; + inline TBool FatIndexValid(TUint32 aIndex) const; + + protected: enum {KInvalidFatNo = 0xFF}; ///< used to invalidate current FAT no. @@ -87,6 +91,7 @@ //-- values cached from owning mount. TUint32 iFatStartPos; ///< media position of FAT1 start TUint32 iFatSize; ///< size of FAT in bytes + TUint32 iMaxFatEntries; ///< maximal number of FAT entries in FAT table, FAT[0] & FAT [1] included TUint16 iNumFATs; ///< number of FATs on the volume TUint16 iFatSecSzLog2; ///< Log2(FAT Sector size) TUint16 iFatClustSzLog2;///< Log2(FAT cluster size) diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/sl_fatcache.inl --- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.inl Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.inl Tue Sep 14 15:52:42 2010 +0100 @@ -72,6 +72,17 @@ return iFatClustSzLog2; } +TUint32 CFatCacheBase::MaxFatEntries() const + { + return iMaxFatEntries; + } + +TBool CFatCacheBase::FatIndexValid(TUint32 aIndex) const + { + return (aIndex >= KFatFirstSearchCluster && aIndex < iMaxFatEntries); + } + + //----------------------------------------------------------------------------- diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/sl_fatcache32.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_fatcache32.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache32.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -120,8 +120,6 @@ User::Leave(KErrCorrupt); } - iMaxFatEntries = aOwner->UsableClusters()+KFatFirstSearchCluster; //-- FAT[0] & FAT[1] are not in use - //-- create FAT bit supercache if it is enabled in config ASSERT(!iBitCache); if(aOwner->FatConfig().FAT32_UseBitSupercache()) @@ -307,7 +305,7 @@ { // __PRINT1(_L("#-CFat32LruCache::ReadEntryL() FAT idx:%d"), aIndex); - ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat32EntrySzLog2)); + ASSERT(FatIndexValid(aIndex)); //-- firstly try to locate required entry in cache TFat32Entry entry; @@ -335,7 +333,7 @@ { //__PRINT2(_L("#-CFat32LruCache::WriteEntryL() FAT idx:%d, val:%d"), aIndex, aEntry); - ASSERT(aIndex >= KFatFirstSearchCluster && aIndex < (FatSize() >> KFat32EntrySzLog2)); + ASSERT(FatIndexValid(aIndex)); SetDirty(ETrue); @@ -457,7 +455,9 @@ TInt CFat32LruCache::InvalidateRegion(TUint32 aStartIndex, TUint32 aNumEntries) { __PRINT2(_L("#-CFat32LruCache::InvalidateRegion() startIndex:%d, entries:%d"),aStartIndex, aNumEntries); - ASSERT(aStartIndex >= KFatFirstSearchCluster && aStartIndex < (FatSize() >> KFat32EntrySzLog2)); + ASSERT(FatIndexValid(aStartIndex)); + ASSERT(FatIndexValid(aStartIndex+aNumEntries-1)); + if(!aNumEntries) { @@ -524,7 +524,7 @@ } //-- actual number of usable FAT entries can be less than deducted from number of FAT sectors. - MaxIdx = Min(MaxIdx, iMaxFatEntries-1); + MaxIdx = Min(MaxIdx, MaxFatEntries()-1); //-- look in both directions starting from the aFatEntryIndex //-- but in one FAT cache page sector only diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -18,22 +18,7 @@ #include "sl_std.h" #include "sl_cache.h" -/** -@return ETrue if it is Fat32 -*/ -TBool CFatFormatCB::Is32BitFat() const - { - return(iFileSystemName==KFileSystemName32); - } - -/** -@return ETrue if it is Fat16 -*/ -TBool CFatFormatCB::Is16BitFat() const - { - return(iFileSystemName==KFileSystemName16); - } - +//------------------------------------------------------------------------------------------------------------------- /** Calculate the FAT size in sectors for a Fat32 volume @@ -69,128 +54,6 @@ //------------------------------------------------------------------------------------------------------------------- -/** -Initialize the format parameters for a normal fixed sized disk -Setting set to adhere to Rules of Count of clusters for FAT type - -@param aDiskSizeInSectors Size of volume in sectors -@return system-wide error code -*/ -TInt CFatFormatCB::InitFormatDataForFixedSizeDiskNormal(TUint aDiskSizeInSectors, const TLocalDriveCapsV6& aCaps) - { - __PRINT1(_L("CFatFormatCB::InitFormatDataForFixedSizeDiskNormal() sectors:%d"), aDiskSizeInSectors); - - if( Drive().IsRemovable() ) - iNumberOfFats = KNumberOfFatsExternal; - else - iNumberOfFats = KNumberOfFatsInternal; - - iReservedSectors=KDefFatResvdSec; - if (aDiskSizeInSectors <=4084*1) // 2MB - { - iRootDirEntries=128; - iSectorsPerCluster=1; - iFileSystemName=KFileSystemName12; - iSectorsPerFat=MaxFat12Sectors(); - } - else if (aDiskSizeInSectors<4084*2) // < 4MB (8168 sectors) - { - iRootDirEntries=256; - iSectorsPerCluster=2; - iFileSystemName=KFileSystemName12; - iSectorsPerFat=MaxFat12Sectors(); - } - else if (aDiskSizeInSectors<4084*4) // < 8MB (16336 sectors) - { - iRootDirEntries=512; - iSectorsPerCluster=4; - iFileSystemName=KFileSystemName12; - iSectorsPerFat=MaxFat12Sectors(); - } - else if (aDiskSizeInSectors<4084*8) // < 16MB (32672 sectors) - { - iRootDirEntries=512; - iSectorsPerCluster=8; - iFileSystemName=KFileSystemName12; - iSectorsPerFat=MaxFat12Sectors(); - } - else if(aDiskSizeInSectors<1048576) // >= 16Mb - FAT16 < (1048576) 512MB - { - iFileSystemName=KFileSystemName16; - TUint minSectorsPerCluster=(aDiskSizeInSectors+KMaxFAT16Entries-1)/KMaxFAT16Entries; - iRootDirEntries=512; - iSectorsPerCluster=1; - - while (minSectorsPerCluster>iSectorsPerCluster) - iSectorsPerCluster<<=1; - - iSectorsPerFat=MaxFat16Sectors(); - } - else //use FAT32 - { - iFileSystemName=KFileSystemName32; - iRootDirEntries=0; //this is always the case for fat32 - if(aDiskSizeInSectors < 16777216) //8GB in 512byte sectors - iSectorsPerCluster=8; - else if(aDiskSizeInSectors < 33554432) //16GB in 512byte sectors - iSectorsPerCluster=16; - else if(aDiskSizeInSectors < 67108864) //32GB in 512byte sectors - iSectorsPerCluster=32; - else - iSectorsPerCluster=64; //Anything >= 32GB uses a 32K cluster size - iReservedSectors=KDefFat32ResvdSec; - iRootClusterNum=2; //As recomended in the document - iSectorsPerFat=MaxFat32Sectors(); - - } - - const TFatType fatType = SuggestFatType(); - - // Ensure cluster size is a multiple of the block size - TInt blockSizeInSectors = aCaps.iBlockSize >> iSectorSizeLog2; - __PRINT1(_L("blockSizeInSectors: %d"),blockSizeInSectors); - ASSERT(blockSizeInSectors == 0 || IsPowerOf2(blockSizeInSectors)); - if (blockSizeInSectors != 0 && IsPowerOf2(blockSizeInSectors)) - { - __PRINT1(_L("iSectorsPerCluster (old): %d"),iSectorsPerCluster); - AdjustClusterSize(blockSizeInSectors); - __PRINT1(_L("iSectorsPerCluster (new): %d"),iSectorsPerCluster); - } - - - for (; iSectorsPerCluster>1; iSectorsPerCluster>>= 1) - { - // Align first data sector on an erase block boundary if - // (1) the iEraseBlockSize is specified - // (2) the start of the partition is already aligned to an erase block boundary, - // i.e. iHiddenSectors is zero or a multiple of iEraseBlockSize - __PRINT1(_L("iHiddenSectors: %d"),iHiddenSectors); - TInt eraseblockSizeInSectors = aCaps.iEraseBlockSize >> iSectorSizeLog2; - __PRINT1(_L("eraseblockSizeInSectors: %d"),eraseblockSizeInSectors); - ASSERT(eraseblockSizeInSectors == 0 || IsPowerOf2(eraseblockSizeInSectors)); - ASSERT(eraseblockSizeInSectors == 0 || eraseblockSizeInSectors >= blockSizeInSectors); - if ((eraseblockSizeInSectors != 0) && - (iHiddenSectors % eraseblockSizeInSectors == 0) && - (IsPowerOf2(eraseblockSizeInSectors)) && - (eraseblockSizeInSectors >= blockSizeInSectors)) - { - TInt r = AdjustFirstDataSectorAlignment(eraseblockSizeInSectors); - ASSERT(r == KErrNone); - (void) r; - } - __PRINT1(_L("iReservedSectors: %d"),iReservedSectors); - __PRINT1(_L("FirstDataSector: %d"), FirstDataSector()); - - // If we've shrunk the number of clusters by so much that it's now invalid for this FAT type - // then we need to decrease the cluster size and try again, otherwise we're finshed. - if (SuggestFatType() == fatType) - break; - } - __PRINT1(_L("iSectorsPerCluster (final): %d"),iSectorsPerCluster); - - return KErrNone; - } - TInt CFatFormatCB::FirstDataSector() const { TInt rootDirSectors = (iRootDirEntries * KSizeOfFatDirEntry + (iBytesPerSector-1)) / iBytesPerSector; @@ -267,7 +130,11 @@ { __PRINT1(_L("CFatFormatCB::CreateBootSector() drive:%d"),DriveNumber()); - + _LIT8(KName_Fat12,"FAT12 "); ///< Name in BPB given to a Fat12 volume + _LIT8(KName_Fat16,"FAT16 "); ///< Name in BPB given to a Fat16 volume + _LIT8(KName_Fat32,"FAT32 "); ///< Name in BPB given to a Fat32 volume + _LIT8(KDefaultVendorID, "EPOC"); ///< Vendor Name for BPB for any volume formated using a Symbian OS device + const TBool bFat32 = Is32BitFat(); TFatBootSector bootSector; @@ -286,11 +153,32 @@ bootSector.SetReservedByte(0); TTime timeID; - timeID.HomeTime(); // System time in future? - bootSector.SetUniqueID(I64LOW(timeID.Int64())); // Generate UniqueID from time + timeID.HomeTime(); + bootSector.SetUniqueID(I64LOW(timeID.Int64())); // Generate Volume UniqueID from time bootSector.SetVolumeLabel(_L8("")); - bootSector.SetFileSysType(iFileSystemName); -// Floppy specific info: + + //-- set a text string in BPB that corresponds to the FS type + switch(FatType()) + { + case EFat12: + bootSector.SetFileSysType(KName_Fat12); + break; + + case EFat16: + bootSector.SetFileSysType(KName_Fat16); + break; + + case EFat32: + bootSector.SetFileSysType(KName_Fat32); + break; + + default: + ASSERT(0); + User::Leave(KErrArgument); + }; + + + bootSector.SetJumpInstruction(); bootSector.SetMediaDescriptor(KBootSectorMediaDescriptor); bootSector.SetNumberOfHeads(iNumberOfHeads); @@ -566,221 +454,6 @@ //------------------------------------------------------------------------------------------------------------------- -/** - Initialize the user specific format parameters for fixed sized disk. - - @param aDiskSizeInSectors disk size in sectors - @return system-wide error code -*/ -TInt CFatFormatCB::InitFormatDataForFixedSizeDiskUser(TUint aDiskSizeInSectors) - { - __PRINT1(_L("CFatFormatCB::InitFormatDataForFixedSizeDiskUser() sectors:%d"), aDiskSizeInSectors); - Dump_TLDFormatInfo(iSpecialInfo()); - - //-- KErrArgument will be returned if iSpecialInfo().iFATBits isn't one of EFB32, EFB16, EFB32 - - if(iSpecialInfo().iFlags & TLDFormatInfo::EOneFatTable) - iNumberOfFats = 1; - else if(iSpecialInfo().iFlags & TLDFormatInfo::ETwoFatTables) - iNumberOfFats = 2; - else if(Drive().IsRemovable()) - iNumberOfFats = KNumberOfFatsExternal; - else - iNumberOfFats = KNumberOfFatsInternal; - - - if(iSpecialInfo().iReservedSectors == 0) - iReservedSectors = KDefFatResvdSec; //-- user hasn't specified reserved sectors count, use default (FAT12/16) - else - iReservedSectors = iSpecialInfo().iReservedSectors; - - - const TUint KMaxSecPerCluster = 64; - const TUint KDefaultSecPerCluster= 8; //-- default value, if the iSpecialInfo().iSectorsPerCluster isn't specified - - iSectorsPerCluster = iSpecialInfo().iSectorsPerCluster; - if(iSectorsPerCluster <= 0) - {//-- default value, user hasn't specified TLDFormatInfo::iSectorsPerCluster - iSectorsPerCluster = KDefaultSecPerCluster; //-- will be adjusted later - } - else - { - iSectorsPerCluster = Min(1<>iSectorSizeLog2); else sizeofFatAndRootDir = (iRootClusterNum-2) * iSectorsPerCluster; @@ -838,8 +512,10 @@ { if (badSector == 0) // Boot sector corrupt return KErrCorrupt; - if (iFileSystemName==KFileSystemName32 && badSector==1) // FSInfo corrupt + + if (Is32BitFat() && badSector==1) // FSInfo corrupt return KErrCorrupt; + if (badSector < iReservedSectors) // Harmless in reserved area continue; // Extend reserved area to cover bad sector @@ -854,7 +530,8 @@ { if ((r=iBadClusters.Append(cluster)) != KErrNone) return r; - if (iFileSystemName==KFileSystemName32 && iRootClusterNum==cluster) + + if (Is32BitFat() && iRootClusterNum==cluster) iRootClusterNum++; } } @@ -909,5 +586,400 @@ } +//------------------------------------------------------------------------------------------------------------------- + +/** + Initialize the user-specific format parameters + Tries to figure out number of FATs, SPC, etc. values passed from the user side. + This method is called if the user has specified some formatting parameters, like SPC +*/ +TInt CFatFormatCB::ProcessVolParam_User(const TLocalDriveCapsV6& /*aCaps*/) +{ + __PRINT1(_L("CFatFormatCB::ProcessVolParam_User() sectors:%d"), iMaxDiskSectors); + Dump_TLDFormatInfo(iSpecialInfo()); + + //-- KErrArgument will be returned if iSpecialInfo().iFATBits isn't one of EFB32, EFB16, EFB32 + + if(iSpecialInfo().iFlags & TLDFormatInfo::EOneFatTable) + iNumberOfFats = 1; + else if(iSpecialInfo().iFlags & TLDFormatInfo::ETwoFatTables) + iNumberOfFats = 2; + else if(Drive().IsRemovable()) + iNumberOfFats = KNumberOfFatsExternal; + else + iNumberOfFats = KNumberOfFatsInternal; + + + if(iSpecialInfo().iReservedSectors) + iReservedSectors = iSpecialInfo().iReservedSectors; + else + iReservedSectors = KDefFatResvdSec; //-- the user hasn't specified reserved sectors count, use default (FAT12/16) + + //----------------------------------------- + + + const TUint KMaxSecPerCluster = 64; + const TUint KDefaultSecPerCluster= 8; //-- default value, if the iSpecialInfo().iSectorsPerCluster isn't specified + + iSectorsPerCluster = iSpecialInfo().iSectorsPerCluster; + if(iSectorsPerCluster <= 0) + {//-- default value, user hasn't specified TLDFormatInfo::iSectorsPerCluster + iSectorsPerCluster = KDefaultSecPerCluster; //-- will be adjusted later + } + else + { + iSectorsPerCluster = Min(1<= 16Mb - FAT16 < (1048576) 512MB + { + SetFatType(EFat16); + TUint minSectorsPerCluster=(iMaxDiskSectors+KMaxFAT16Entries-1)/KMaxFAT16Entries; + iRootDirEntries=512; + iSectorsPerCluster=1; + + while (minSectorsPerCluster>iSectorsPerCluster) + iSectorsPerCluster<<=1; + + iSectorsPerFat=MaxFat16Sectors(); + } + else //use FAT32 + { + SetFatType(EFat32); + iRootDirEntries=0; //this is always the case for fat32 + + if(iMaxDiskSectors < 16777216) //8GB in 512byte sectors + iSectorsPerCluster=8; + else if(iMaxDiskSectors < 33554432) //16GB in 512byte sectors + iSectorsPerCluster=16; + else if(iMaxDiskSectors < 67108864) //32GB in 512byte sectors + iSectorsPerCluster=32; + else + iSectorsPerCluster=64; //Anything >= 32GB uses a 32K cluster size + + iReservedSectors=KDefFat32ResvdSec; + iRootClusterNum=2; //As recomended in the document + iSectorsPerFat=MaxFat32Sectors(); + + } + + const TFatType fatType = SuggestFatType(); + + // Ensure cluster size is a multiple of the block size + TInt blockSizeInSectors = aCaps.iBlockSize >> iSectorSizeLog2; + __PRINT1(_L("blockSizeInSectors: %d"),blockSizeInSectors); + ASSERT(blockSizeInSectors == 0 || IsPowerOf2(blockSizeInSectors)); + if (blockSizeInSectors != 0 && IsPowerOf2(blockSizeInSectors)) + { + __PRINT1(_L("iSectorsPerCluster (old): %d"),iSectorsPerCluster); + AdjustClusterSize(blockSizeInSectors); + __PRINT1(_L("iSectorsPerCluster (new): %d"),iSectorsPerCluster); + } + + + for (; iSectorsPerCluster>1; iSectorsPerCluster>>= 1) + { + // Align first data sector on an erase block boundary if + // (1) the iEraseBlockSize is specified + // (2) the start of the partition is already aligned to an erase block boundary, + // i.e. iHiddenSectors is zero or a multiple of iEraseBlockSize + __PRINT1(_L("iHiddenSectors: %d"),iHiddenSectors); + TInt eraseblockSizeInSectors = aCaps.iEraseBlockSize >> iSectorSizeLog2; + __PRINT1(_L("eraseblockSizeInSectors: %d"),eraseblockSizeInSectors); + ASSERT(eraseblockSizeInSectors == 0 || IsPowerOf2(eraseblockSizeInSectors)); + ASSERT(eraseblockSizeInSectors == 0 || eraseblockSizeInSectors >= blockSizeInSectors); + if ((eraseblockSizeInSectors != 0) && + (iHiddenSectors % eraseblockSizeInSectors == 0) && + (IsPowerOf2(eraseblockSizeInSectors)) && + (eraseblockSizeInSectors >= blockSizeInSectors)) + { + TInt r = AdjustFirstDataSectorAlignment(eraseblockSizeInSectors); + ASSERT(r == KErrNone); + (void) r; + } + __PRINT1(_L("iReservedSectors: %d"),iReservedSectors); + __PRINT1(_L("FirstDataSector: %d"), FirstDataSector()); + + // If we've shrunk the number of clusters by so much that it's now invalid for this FAT type + // then we need to decrease the cluster size and try again, otherwise we're finshed. + if (SuggestFatType() == fatType) + break; + } + __PRINT1(_L("iSectorsPerCluster (final): %d"),iSectorsPerCluster); + + return KErrNone; +} + +//------------------------------------------------------------------------------------------------------------------- +/** + Initialize the format parameters for a variable sized disk (RAM drive) + + @param aDiskSizeInSectors volume size in sectors + @return standard error code +*/ +TInt CFatFormatCB::ProcessVolParam_RamDisk() + { + __PRINT1(_L("CFatFormatCB::ProcessVolParam_RamDisk() sectors:%d"), iMaxDiskSectors); + + iNumberOfFats = 2; // 1 FAT 1 Indirection table (FIT) + iReservedSectors= 1; + iRootDirEntries = 2*(4*KDefaultSectorSize)/sizeof(SFatDirEntry); + TUint minSectorsPerCluster=(iMaxDiskSectors+KMaxFAT16Entries-1)/KMaxFAT16Entries; + iSectorsPerCluster=1; + + while(minSectorsPerCluster > iSectorsPerCluster) + iSectorsPerCluster<<=1; + + + iSectorsPerFat=MaxFat16Sectors(); + __PRINT1(_L("iSectorsPerCluster = %d"),iSectorsPerCluster); + __PRINT1(_L("iSectorsPerFat = %d"),iSectorsPerFat); + + SetFatType(EFat16); + + return KErrNone; + } + + + + + + + + + + + + + + + + + + + + + + + + diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfat32/sl_fmt.cpp --- a/userlibandfileserver/fileserver/sfat32/sl_fmt.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfat32/sl_fmt.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -26,51 +26,51 @@ // arbitrary limit upon the WINS ramdisk. // static TInt64 GetRamDiskSizeInBytes() - { + { #if defined(__EPOC32__) - TMemoryInfoV1Buf memInfo; - UserHal::MemoryInfo(memInfo); - TUint max = memInfo().iTotalRamInBytes; // not really the correct max - return max; + TMemoryInfoV1Buf memInfo; + UserHal::MemoryInfo(memInfo); + TUint max = memInfo().iTotalRamInBytes; // not really the correct max + return max; #else const TInt KArbitraryWinsRamDiskSize=0x400000; //-- Default size for a Ram drive, 4MB - return(KArbitraryWinsRamDiskSize); + return(KArbitraryWinsRamDiskSize); #endif - } + } CFatFormatCB::CFatFormatCB() - { - __PRINT1(_L("CFatFormatCB::CFatFormatCB() [%x]"),this); + { + __PRINT1(_L("CFatFormatCB::CFatFormatCB() [%x]"),this); } CFatFormatCB::~CFatFormatCB() - { - __PRINT1(_L("CFatFormatCB::~CFatFormatCB() [%x]"),this); + { + __PRINT1(_L("CFatFormatCB::~CFatFormatCB() [%x]"),this); iBadSectors.Close(); - iBadClusters.Close(); - } + iBadClusters.Close(); + } /** Calculate the size of a 16 bit FAT */ TUint CFatFormatCB::MaxFat16Sectors() const - { - const TUint32 fatSizeInBytes=(2*iMaxDiskSectors)/iSectorsPerCluster+(iBytesPerSector-1); - return(fatSizeInBytes/iBytesPerSector); - } + { + const TUint32 fatSizeInBytes=(2*iMaxDiskSectors)/iSectorsPerCluster+(iBytesPerSector-1); + return(fatSizeInBytes/iBytesPerSector); + } /** Calculate the size of a 12 bit FAT */ TUint CFatFormatCB::MaxFat12Sectors() const - { - const TUint32 maxDiskClusters=iMaxDiskSectors/iSectorsPerCluster; - const TUint32 fatSizeInBytes=maxDiskClusters+(maxDiskClusters>>1)+(iBytesPerSector-1); - - return(fatSizeInBytes/iBytesPerSector); - } + { + const TUint32 maxDiskClusters=iMaxDiskSectors/iSectorsPerCluster; + const TUint32 fatSizeInBytes=maxDiskClusters+(maxDiskClusters>>1)+(iBytesPerSector-1); + + return(fatSizeInBytes/iBytesPerSector); + } //------------------------------------------------------------------------------------------------------------------- /** @@ -112,15 +112,16 @@ //------------------------------------------------------------------------------------------------------------------- -static TInt DiskSizeInSectorsL(TInt64 aSizeInBytes) - { +static TUint32 DiskSizeInSectorsL(TInt64 aSizeInBytes) + { const TInt64 totalSectors64=aSizeInBytes>>KDefSectorSzLog2; - const TInt totalSectors32=I64LOW(totalSectors64); - __PRINT2(_L("Disk size:%LU, max disk sectors:%d"),aSizeInBytes, totalSectors32); + const TUint32 totalSectors32=I64LOW(totalSectors64); + ASSERT(!I64HIGH(totalSectors64)); + //__PRINT2(_L("Disk size:%LU, max disk sectors:%d"),aSizeInBytes, totalSectors32); return totalSectors32; - } + } - +//------------------------------------------------------------------------------------------------------------------- /** suggest FAT type according to the FAT volume metrics @return calculated FAT type @@ -140,89 +141,70 @@ return EFat32; } +//------------------------------------------------------------------------------------------------------------------- /** Initialize format data. */ void CFatFormatCB::InitializeFormatDataL() - { + { - __PRINT1(_L("CFatFormatCB::InitializeFormatDataL() drv:%d"), Drive().DriveNumber()); - TLocalDriveCapsV6Buf caps; - User::LeaveIfError(LocalDrive()->Caps(caps)); - iVariableSize=((caps().iMediaAtt)&KMediaAttVariableSize) ? (TBool)ETrue : (TBool)EFalse; + __PRINT1(_L("CFatFormatCB::InitializeFormatDataL() drv:%d"), Drive().DriveNumber()); + + TLocalDriveCapsV6Buf capsBuf; + const TLocalDriveCapsV6& caps = capsBuf(); + User::LeaveIfError(LocalDrive()->Caps(capsBuf)); - iBytesPerSector=KDefaultSectorSize; - iSectorSizeLog2 = Log2(iBytesPerSector); - iHiddenSectors=caps().iHiddenSectors; - iNumberOfHeads=2; - iSectorsPerTrack=16; - + iVariableSize = (caps.iMediaAtt & KMediaAttVariableSize); + iBytesPerSector=KDefaultSectorSize; + iSectorSizeLog2 = Log2(iBytesPerSector); + iHiddenSectors = caps.iHiddenSectors; + iNumberOfHeads=2; + iSectorsPerTrack=16; + + TInt nRes=KErrUnknown; + if (iVariableSize) - {// Variable size implies ram disk - iMaxDiskSectors=DiskSizeInSectorsL(GetRamDiskSizeInBytes()); - InitFormatDataForVariableSizeDisk(iMaxDiskSectors); - } - else - {//-- fixed-size media - iMaxDiskSectors=DiskSizeInSectorsL(caps().iSize); - - __PRINT3(_L("::InitializeFormatDataL() iMode:0x%x, ilen:%d, extrai:%d"), iMode, iSpecialInfo.Length(), caps().iExtraInfo); + {// Variable size implies ram disk + iMaxDiskSectors=DiskSizeInSectorsL(GetRamDiskSizeInBytes()); + nRes = ProcessVolParam_RamDisk(); + } + else + {//-- fixed-size media + iMaxDiskSectors=DiskSizeInSectorsL(caps.iSize); + __PRINT3(_L("::InitializeFormatDataL() iMode:0x%x, ilen:%d, extrai:%d"), iMode, iSpecialInfo.Length(), caps.iExtraInfo); + + //----------------------------------------------------------------------------------------- + //-- find out if there are volume parameters specified by the user or media driver. - if(iMode & ESpecialFormat) - { - if(iSpecialInfo.Length()) - { - if (caps().iExtraInfo) // conflict between user and media - User::Leave(KErrNotSupported); - else // User-specified - User::LeaveIfError(InitFormatDataForFixedSizeDiskUser(iMaxDiskSectors)); - } - else - { - if (caps().iExtraInfo) - User::LeaveIfError(InitFormatDataForFixedSizeDiskCustom(caps().iFormatInfo)); + //-- meaning: the user has specified its own settings for the volume parameters + const TBool bUserFormat = (iMode & ESpecialFormat) && iSpecialInfo.Length(); + + //-- meaning: the media driver has its own settings regarding the volume parameters + const TBool bCustomFormat = caps.iExtraInfo; + + if(bUserFormat && bCustomFormat) + { + nRes = KErrNotSupported; //-- conflict between user settings and media driver's + } + else + { + if(bUserFormat) + nRes = ProcessVolParam_User(caps); + else if(bCustomFormat) + nRes = ProcessVolParam_Custom(caps); else - User::LeaveIfError(InitFormatDataForFixedSizeDiskNormal(iMaxDiskSectors, caps())); - } - } - else //if(iMode & ESpecialFormat) - { - // Normal format with default values - // - Media with special format requirements will always use them - // even without the ESpecialFormat option. - if(caps().iExtraInfo) - User::LeaveIfError(InitFormatDataForFixedSizeDiskCustom(caps().iFormatInfo)); - else - User::LeaveIfError(InitFormatDataForFixedSizeDiskNormal(iMaxDiskSectors, caps())); - } - + nRes = ProcessVolParam_Default(caps); + } } //else(iVariableSize) - } - -/** - Initialize the format parameters for a variable sized disk - @param aDiskSizeInSectors volume size in sectors - @return standard error code -*/ -TInt CFatFormatCB::InitFormatDataForVariableSizeDisk(TUint aDiskSizeInSectors) - { - iNumberOfFats=2; // 1 FAT 1 Indirection table (FIT) - iReservedSectors=1; - iRootDirEntries=2*(4*KDefaultSectorSize)/sizeof(SFatDirEntry); - TUint minSectorsPerCluster=(aDiskSizeInSectors+KMaxFAT16Entries-1)/KMaxFAT16Entries; - iSectorsPerCluster=1; + if(nRes != KErrNone) + { + __PRINT1(_L(" ::InitializeFormatDataL() err:%d"), nRes); + User::Leave(nRes); + } - while (minSectorsPerCluster>iSectorsPerCluster) - iSectorsPerCluster<<=1; + } - __PRINT1(_L("iSectorsPerCluster = %d"),iSectorsPerCluster); - iSectorsPerFat=MaxFat16Sectors(); - __PRINT1(_L("iSectorsPerFat = %d"),iSectorsPerFat); - iFileSystemName=KFileSystemName16; - - return KErrNone; - } TInt CFatFormatCB::HandleCorrupt(TInt aError) // @@ -232,10 +214,10 @@ // @see TErrorInfo // { - __PRINT2(_L("CFatFormatCB::HandleCorrupt(%d) drv:%d"), aError, Drive().DriveNumber()); + __PRINT2(_L("CFatFormatCB::HandleCorrupt(%d) drv:%d"), aError, Drive().DriveNumber()); TPckgBuf info; - TInt r = LocalDrive()->GetLastErrorInfo(info); + TInt r = LocalDrive()->GetLastErrorInfo(info); if(r != KErrNone) { @@ -243,15 +225,15 @@ } if (r == KErrNotSupported) - return KErrCorrupt; + return KErrCorrupt; else if (r != KErrNone) return r; __PRINT3(_L("....TErrorInfo iReasonCode:%d, iErrorPos:%LU, iOtherInfo:%d"), info().iReasonCode, info().iErrorPos, info().iOtherInfo); - + // if no error reported by GetLastErrorInfo(), return the original error - if (info().iReasonCode == KErrNone) - return aError; + if (info().iReasonCode == KErrNone) + return aError; if (info().iReasonCode!=KErrNone && info().iReasonCode!=TErrorInfo::EBadSector) return info().iReasonCode; diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfile/sf_memory_man.cpp --- a/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -42,6 +42,7 @@ delete iRegisteredClients[i]; } iRegisteredClients.Close(); + iChunk.Close(); } /** diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfile/sf_thread.cpp --- a/userlibandfileserver/fileserver/sfile/sf_thread.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/sf_thread.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -928,25 +928,24 @@ CPluginThread::CPluginThread(CFsPlugin& aPlugin, RLibrary aLibrary) : iPlugin(aPlugin), iLib(aLibrary) { - /** @prototype */ - iOperationLock.Close(); iPlugin.Open(); - /* - Duplicate the handle to the DLL which created the plugin to prevent - TFsRemovePlugin::DoRequestL() from unmapping the DLL's code segment before - this thread's destructor has been called as the destructor closes the plugin - which results in a call to the plugin's derived destructor contained in the DLL (!) - */ - TInt r = iLib.Duplicate(iThread, EOwnerProcess); - __ASSERT_ALWAYS(r==KErrNone, Fault(EFsThreadConstructor)); + /* + Duplicate the handle to the DLL which created the plugin to prevent + TFsRemovePlugin::DoRequestL() from unmapping the DLL's code segment before + this thread's destructor has been called as the destructor closes the plugin + which results in a call to the plugin's derived destructor contained in the DLL (!) + */ + TInt r = iLib.Duplicate(iThread, EOwnerProcess); + __ASSERT_ALWAYS(r==KErrNone, Fault(EFsThreadConstructor)); } CPluginThread::~CPluginThread() - { - iPlugin.Close(); + { + iPlugin.Close(); iLib.Close(); - } + iOperationLock.Close(); + } CPluginThread* CPluginThread::NewL(CFsPlugin& aPlugin, RLibrary aLibrary) @@ -955,7 +954,6 @@ CPluginThread* pT=new(ELeave) CPluginThread(aPlugin, aLibrary); TInt r=pT->Initialise(); - /** @prototype */ if(r == KErrNone) r=pT->iOperationLock.CreateLocal(0); diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfile/traces/OstTraceDefinitions.h --- a/userlibandfileserver/fileserver/sfile/traces/OstTraceDefinitions.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfile/traces/OstTraceDefinitions.h Tue Sep 14 15:52:42 2010 +0100 @@ -17,5 +17,5 @@ // 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 +#include #endif diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfsrv/cl_fman.cpp --- a/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -254,21 +254,24 @@ // Initialise New thread // { - + TInt r = KErrNoMemory; // return value if a trap harness cannot be created CTrapCleanup* cleanup=CTrapCleanup::New(); - if (cleanup==NULL) - return(KErrNoMemory); CFileBase& fMan=*(CFileBase*)aPtr; - fMan.iSynchronizer.Wait(); - TRAPD(ret,DoFManBaseOperationL(aPtr)); - if (ret==KErrNone) - ret=fMan.iLastError; - delete cleanup; + + if (cleanup != NULL) + { + fMan.iSynchronizer.Wait(); + TRAP(r,DoFManBaseOperationL(aPtr)); + if (r == KErrNone) + r = fMan.iLastError; + delete cleanup; + } + fMan.iSwitches=0; fMan.iFs=fMan.iFsOld; fMan.iStatus=NULL; fMan.iFManThread.Close(); - return(ret); + return (r); } @@ -281,9 +284,6 @@ @param aThreadFunction The thread function. */ { - iSwitches|=KFManBusyFlag; - User::LeaveIfError(iFManThread.Create(KNullDesC,aThreadFunction,KDefaultStackSize,NULL,this)); - iFManThread.SetPriority(EPriorityMuchLess); TFileName sessionPath; User::LeaveIfError(iFs.SessionPath(sessionPath)); if (iSessionPath==NULL) @@ -291,6 +291,14 @@ else if (iSessionPath->Des().MaxLength()ReAllocL(IncPathLength(sessionPath.Length())); iSessionPath->Des()=sessionPath; + + User::LeaveIfError(iFManThread.Create(KNullDesC,aThreadFunction,KDefaultStackSize,NULL,this)); + + // The code won't leave anymore after this. + // The effect of any further state changes to this instance + // should be undone / completed by the thread function. + iFManThread.SetPriority(EPriorityMuchLess); + iSwitches|=KFManBusyFlag; iFsOld=iFs; iLastError=KErrNone; iFManThread.Logon(*iStatus); diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/sfsrv/traces/OstTraceDefinitions.h --- a/userlibandfileserver/fileserver/sfsrv/traces/OstTraceDefinitions.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/sfsrv/traces/OstTraceDefinitions.h Tue Sep 14 15:52:42 2010 +0100 @@ -17,5 +17,5 @@ // 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 +#include #endif diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/smassstorage/cbulkonlytransport.cpp --- a/userlibandfileserver/fileserver/smassstorage/cbulkonlytransport.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/smassstorage/cbulkonlytransport.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-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" @@ -199,11 +199,6 @@ */ CBulkOnlyTransport::~CBulkOnlyTransport() { - __FNLOG("CBulkOnlyTransport::~CBulkOnlyTransport"); - if (iInterfaceConfigured) - { - Stop(); - } } diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcldd.cpp --- a/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcldd.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcldd.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -298,6 +298,7 @@ __FNLOG("CBulkOnlyTransportUsbcLdd::~CBulkOnlyTransportUsbcLdd"); if (iInterfaceConfigured) { + Stop(); delete iControlInterface ; delete iDeviceStateNotifier; } diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp --- a/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp Tue Sep 14 15:52:42 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -321,6 +321,7 @@ __FNLOG("CBulkOnlyTransportUsbcScLdd::~CBulkOnlyTransportUsbcScLdd"); if (iInterfaceConfigured) { + Stop(); TInt err = iSCReadEndpointBuf.Close(); err = iSCWriteEndpointBuf.Close(); delete iControlInterface ; diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/smassstorage/inc/cbulkonlytransport.h --- a/userlibandfileserver/fileserver/smassstorage/inc/cbulkonlytransport.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/smassstorage/inc/cbulkonlytransport.h Tue Sep 14 15:52:42 2010 +0100 @@ -1,4 +1,4 @@ -// Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +// Copyright (c) 2004-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" @@ -91,9 +91,13 @@ static CBulkOnlyTransport* NewL(TInt aNumDrives,CUsbMassStorageController& aController, CUsbMassStorageController::TTransportldd aTransportLddFlag); static CBulkOnlyTransport* NewL(TInt aNumDrives,CUsbMassStorageController& aController); +protected: + ~CBulkOnlyTransport() = 0; CBulkOnlyTransport(TInt aNumDrives,CUsbMassStorageController& aController); + +public: TInt InitialiseTransportL(TInt aTransportLddFlag); - ~CBulkOnlyTransport(); + TInt Start(); TInt Stop(); diff -r d45b74d3fb20 -r ea2cef07f9fe userlibandfileserver/fileserver/smassstorage/inc/mldddevicestatenotification.h --- a/userlibandfileserver/fileserver/smassstorage/inc/mldddevicestatenotification.h Tue Aug 31 11:40:45 2010 +0100 +++ b/userlibandfileserver/fileserver/smassstorage/inc/mldddevicestatenotification.h Tue Sep 14 15:52:42 2010 +0100 @@ -1,5 +1,5 @@ /* -* Copyright (c) 2004-2009 Nokia Corporation and/or its subsidiary(-ies). +* Copyright (c) 2004-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" @@ -31,6 +31,7 @@ public: virtual void Activate(TRequestStatus& aStatus, TUint& aValue) = 0; virtual void Cancel() = 0; + virtual ~MLddDeviceStateNotification() {}; };