Revision: 201039
authorDremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
Mon, 04 Oct 2010 02:35:35 +0300
changeset 281 13fbfa31d2ba
parent 266 0008ccd16016
Revision: 201039 Kit: 201039
kernel/eka/bld.inf
kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h
kernel/eka/drivers/usbcc/ps_usbc.cpp
kernel/eka/euser/unicode/Compare.cpp
kernel/eka/euser/unicode/CompareImp.h
kernel/eka/euser/unicode/CompareImp.inl
kernel/eka/euser/us_func.cpp
kernel/eka/extension/base_rvct_common.mk
kernel/eka/extension/bootstrap.flm
kernel/eka/extension/bootstrap.meta
kernel/eka/extension/bootstrap.mk
kernel/eka/extension/bootstrap.xml
kernel/eka/extension/config.meta
kernel/eka/extension/config.mk
kernel/eka/extension/copy_default.meta
kernel/eka/extension/copy_default.mk
kernel/eka/extension/genexec.meta
kernel/eka/extension/genexec.mk
kernel/eka/include/e32base.h
kernel/eka/include/e32base.inl
kernel/eka/include/e32const.h
kernel/eka/include/e32ver.h
kernel/eka/kernel/random.cpp
kernel/eka/release.txt
kerneltest/e32test/bench/t_svr5.cpp
kerneltest/e32test/bmarm/resourcecontroller.def
kerneltest/e32test/bmarm/resourcecontroller_extended.def
kerneltest/e32test/bwins/resourcecontroller.def
kerneltest/e32test/bwins/resourcecontroller_extended.def
kerneltest/e32test/device/t_usbcsc.cpp
kerneltest/e32test/domainmgr/t_domain.cpp
kerneltest/e32test/eabi/resourcecontroller.def
kerneltest/e32test/eabi/resourcecontroller_extended.def
kerneltest/e32test/group/t_usb_device.mmp
kerneltest/e32test/group/t_usb_scdevice.mmp
kerneltest/e32test/group/t_usbcsc.mmp
kerneltest/e32test/mmu/t_shbuf.cpp
kerneltest/e32test/resourceman/d_rescontrolcli.cpp
kerneltest/e32test/resourceman/d_rescontrolcli.h
kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.cpp
kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.h
kerneltest/e32test/resourceman/t_rescontrolcli.cpp
kerneltest/e32test/thread/t_thread.cpp
kerneltest/e32test/usb/t_usb_device/src/activecontrol.cpp
kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1231.cpp
kerneltest/e32test/usbho/t_usbdi/src/TestDeviceBase.cpp
kerneltest/e32test/usbho/t_usbdi/t_usbhost_usbman_src/t_usbhost_usbman.cpp
kerneltest/f32test/bench/t_fsrdirload.cpp
kerneltest/f32test/bench/t_fsrdirscan.cpp
kerneltest/f32test/bench/t_fsropen.cpp
kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_charconv.h
kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_complocl.h
kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_convutils.h
kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_shiftjis.h
kerneltest/f32test/manager/t_romg.cpp
kerneltest/f32test/outsideBMP/src/t_surrogatepair.cpp
kerneltest/f32test/plugins/version_1/virus/t_virus.cpp
kerneltest/f32test/plugins/version_2/src/AllSupportedDrives_plugin.cpp
kerneltest/f32test/plugins/version_2/src/combinational2_plugin.cpp
kerneltest/f32test/plugins/version_2/src/drivec_plugin.cpp
kerneltest/f32test/plugins/version_2/src/drivez_plugin.cpp
kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp
kerneltest/f32test/server/t_cp_plugintest.cpp
kerneltest/f32test/server/t_dspace.cpp
kerneltest/f32test/server/t_fatcharsetconv_Cases.h
kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp
kerneltest/f32test/server/t_fatcharsetconv_aux.cpp
kerneltest/f32test/server/t_fatcharsetconv_main.cpp
kerneltest/f32test/server/t_file64bit.cpp
kerneltest/f32test/server/t_fman.cpp
kerneltest/f32test/server/t_fsys.cpp
kerneltest/f32test/server/t_localeutils_cp932.cpp
kerneltest/f32test/server/t_prel.cpp
kerneltest/f32test/smassstorage/inc/t_ms_main.h
kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp
kerneltest/f32test/smassstorage/scsiprot/t_ms_main.h
kerneltest/f32test/smassstorage/src/t_gml_tur.cpp
kerneltest/f32test/smassstorage/src/t_ms_main.cpp
userlibandfileserver/fileserver/group/release.txt
userlibandfileserver/fileserver/inc/f32ver.h
userlibandfileserver/fileserver/sfat32/common_constants.h
userlibandfileserver/fileserver/sfat32/inc/sl_fatcache32.h
userlibandfileserver/fileserver/sfat32/inc/sl_std.h
userlibandfileserver/fileserver/sfat32/inc/sl_std.inl
userlibandfileserver/fileserver/sfat32/sl_fatcache.cpp
userlibandfileserver/fileserver/sfat32/sl_fatcache.h
userlibandfileserver/fileserver/sfat32/sl_fatcache.inl
userlibandfileserver/fileserver/sfat32/sl_fatcache32.cpp
userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp
userlibandfileserver/fileserver/sfat32/sl_fmt.cpp
userlibandfileserver/fileserver/sfile/sf_memory_man.cpp
userlibandfileserver/fileserver/sfile/sf_thread.cpp
userlibandfileserver/fileserver/sfile/traces/OstTraceDefinitions.h
userlibandfileserver/fileserver/sfsrv/cl_fman.cpp
userlibandfileserver/fileserver/sfsrv/traces/OstTraceDefinitions.h
userlibandfileserver/fileserver/smassstorage/cbulkonlytransport.cpp
userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcldd.cpp
userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp
userlibandfileserver/fileserver/smassstorage/inc/cbulkonlytransport.h
userlibandfileserver/fileserver/smassstorage/inc/mldddevicestatenotification.h
--- a/kernel/eka/bld.inf	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/bld.inf	Mon Oct 04 02:35:35 2010 +0300
@@ -406,6 +406,18 @@
 include/e32shbufcmn.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32shbufcmn.h)
 include/e32shbuf_priv.h							SYMBIAN_OS_LAYER_PLATFORM_EXPORT_PATH(e32shbuf_priv.h)
 
+// Build system extensions
+extension/base_rvct_common.mk					/epoc32/tools/makefile_templates/base/
+extension/bootstrap.flm							/epoc32/tools/makefile_templates/base/
+extension/bootstrap.meta						/epoc32/tools/makefile_templates/base/
+extension/bootstrap.mk							/epoc32/tools/makefile_templates/base/
+extension/bootstrap.xml							/epoc32/tools/makefile_templates/base/
+extension/config.meta							/epoc32/tools/makefile_templates/base/
+extension/config.mk								/epoc32/tools/makefile_templates/base/
+extension/copy_default.meta						/epoc32/tools/makefile_templates/base/
+extension/copy_default.mk						/epoc32/tools/makefile_templates/base/
+extension/genexec.meta							/epoc32/tools/makefile_templates/base/
+extension/genexec.mk							/epoc32/tools/makefile_templates/base/
 
 PRJ_MMPFILES
 
--- a/kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/drivers/sdapc/traces/OstTraceDefinitions.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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 <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/kernel/eka/drivers/usbcc/ps_usbc.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/drivers/usbcc/ps_usbc.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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;
--- a/kernel/eka/euser/unicode/Compare.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/euser/unicode/Compare.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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);
--- a/kernel/eka/euser/unicode/CompareImp.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/euser/unicode/CompareImp.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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.
--- a/kernel/eka/euser/unicode/CompareImp.inl	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/euser/unicode/CompareImp.inl	Mon Oct 04 02:35:35 2010 +0300
@@ -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();
+    }
+
+
+
--- a/kernel/eka/euser/us_func.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/euser/us_func.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -2017,6 +2017,12 @@
 	0xb40bbe37, 0xc30c8ea1, 0x5a05df1b, 0x2d02ef8d
 	};
 
+/* RVCT 3.1 and 4.0 read past the end of arrays when unrolling loops.
+ * This only happens when using -O3 -Otime, so force to -O2.
+ */
+#pragma push
+#pragma O2
+
 /**
 Performs a CCITT CRC-32 checksum on the specified data.
 
@@ -2036,3 +2042,4 @@
 		crc = (crc >> 8) ^ CrcTab32[(crc ^ *p++) & 0xff];
 	aCrc = crc;
 	}
+#pragma pop
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/base_rvct_common.mk	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,69 @@
+# Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+# Some functions that are commonly used by base FLM
+
+define base__compile
+$(1) : $(2) : $(3)
+	$(call startrule,base__compile) \
+	$(CC) $(ARMCCFLAGS) $$< -o $$@ \
+	$(call endrule,base__compile)
+
+CLEANTARGETS := $(CLEANTARGETS) $(1)
+endef
+
+define base__h2inc
+$(1) : $(2)
+	$(call startrule,base__h2inc) \
+ 	$(PERL) $(EPOCROOT)/epoc32/tools/h2inc.pl $$< $$@ ARMASM \
+	$(call endrule,base__h2inc)
+
+CLEANTARGETS := $(CLEANTARGETS) $(1)
+endef
+
+define base__asm
+$(1) : $(2) : $(3)
+	$(call startrule,base__asm) \
+	$(ASM) $(AFLAGS) -o $$@ --LIST $(join $(basename $(1)),.lst) $$< \
+	$(call endrule,base__asm)
+
+CLEANTARGETS := $(CLEANTARGETS) $(1) $(join $(basename $(1)),.lst)
+endef
+
+define base__link
+$(1) : $(2)
+	$(call startrule,base__link) \
+	$(LD) $(LFLAGS) -o $$@ $(FULLOBJECTS) \
+	$(call endrule,base__link)
+
+CLEANTARGETS := $(CLEANTARGETS) $(1)
+endef
+
+define base__strip
+$(1) : $(2)
+	$(call startrule,base__strip) \
+	$(FROMELF) --bin --output $$@ $$< \
+	$(call endrule,base__strip)
+
+CLEANTARGETS := $(CLEANTARGETS) $(1)
+endef
+
+define base__omapsig
+$(1) : $(2)
+	$(call startrule,base__omapsig) \
+	$(PERL) $(EPOCROOT)/epoc32/tools/omapsig.pl $(LINKBASE) $$< $$@ \
+	$(call endrule,base__omapsig)
+
+CLEANTARGETS := $(CLEANTARGETS) $(1)
+endef
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/bootstrap.flm	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,195 @@
+# Copyright (c) 2009-2010 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+ifeq ($($(NAME)_$(PLATFORM_PATH)_bootstrap_flm),)
+$(NAME)_$(PLATFORM_PATH)_bootstrap_flm := 1 
+
+E32PATH := $(EXTENSION_ROOT)/$(E32PATH)
+SOURCES := $(foreach S,$(SOURCES),$(addprefix $(EXTENSION_ROOT)/,$(S)))
+INCLUDES2:=$(addprefix $(EXTENSION_ROOT)/,$(INCLUDES))
+EXTRA_INC_PATH := $(foreach S,$(EXTRA_INC_PATH),$(addprefix $(EXTENSION_ROOT)/,$(S)))
+GENINCLUDES_HEADERS := $(foreach H,$(GENINCLUDES_HEADERS),$(addprefix $(EXTENSION_ROOT)/,$(H)))
+
+ifndef LINKBASE
+LINKBASE := 0x00000000
+endif
+
+UNIQ:=$(E32PATH)$(PLATFORM_PATH)$(NAME)$(MEMMODEL)$(SOURCES)$(ASM_MACROS)
+UNIQ:=$(word 1,$(shell echo $(UNIQ) | $(GNUMD5SUM)))
+
+# Make the output build directory name unique, starting with NAME of the binary being built
+EPOCBLDABS := $(EPOCBLD)/$(NAME)_$(UNIQ)
+
+EPOCINC := $(EPOCROOT)/epoc32/include
+EPOCKERNINC := $(EPOCINC)/kernel
+EPOCCPUINC := $(EPOCKERNINC)/$(CPU)
+EPOCTRG := $(EPOCROOT)/epoc32/release/$(PLATFORM_PATH)
+TRG := $(EPOCTRG)/$(NAME).bin
+TEMPTRG := $(EPOCBLDABS)/$(NAME).bin
+ASMINCPATH := 
+ASM_MACROS :=
+CLEANTARGETS :=
+
+CLEANTARGETS := $(CLEANTARGETS) $(TRG) $(TEMPTRG) $(join $(basename $(TRG)),.sym)
+
+ifneq ($(EXTRA_INC_PATH),)
+ASMINCPATH := $(EXTRA_INC_PATH)
+endif
+
+ASMINCPATH := . $(EPOCBLDABS) $(ASMINCPATH) $(EXTENSION_ROOT) $(EPOCCPUINC) $(EXTRA_EPOC32_INC_PATH) $(E32PATH)/eka/include/kernel/$(CPU)
+
+ifeq ($(MEMMODEL),)
+$(error MEMMODEL parameter not specified)
+endif
+
+# Convert MEMMODEL parameter to lower case
+MEMMODEL := $(shell echo $(MEMMODEL) | tr A-Z a-z)
+
+ifeq ($(MEMMODEL),direct)
+CFG_MM := CFG_MMDirect
+HEADERS_MM :=
+endif
+ifeq ($(MEMMODEL),flexible)
+CFG_MM := CFG_MMFlexible
+HEADERS_MM := $(E32PATH)/eka/include/memmodel/epoc/flexible/$(CPU)/mmboot.h
+endif
+ifeq ($(MEMMODEL),moving)
+CFG_MM := CFG_MMMoving
+HEADERS_MM := $(E32PATH)/eka/include/memmodel/epoc/moving/$(CPU)/mmboot.h
+endif
+ifeq ($(MEMMODEL),multiple)
+CFG_MM := CFG_MMMultiple
+HEADERS_MM := $(E32PATH)/eka/include/memmodel/epoc/multiple/$(CPU)/mmboot.h
+endif
+ifndef CFG_MM
+$(error '$(MEMMODEL)' memory model unknown)
+endif
+
+ASM_MACROS := $(ASM_MACROS) $(CFG_MM)
+ifneq ($(SMP),)
+ASM_MACROS := $(ASM_MACROS) SMP
+endif
+
+ASMINCPATHCMD := $(foreach dir,$(ASMINCPATH),$(join -I ,$(dir)))
+ASM_MACROS := $(ASM_MACROS) USE_CXSF
+      
+INCEXT := inc
+ASM_MACRO_CMD := $(foreach macro,$(ASM_MACROS),--predefine "$(macro) SETL {TRUE}")
+AFLAGS := -g --keep $(ASM_MACRO_CMD) $(ASMINCPATHCMD)
+LFLAGS := --ro-base $(LINKBASE) --entry $(LINKBASE) --map
+SYMOPT := --symdefs
+
+define bootstrap_asm
+$(1) : $(2) : $(3)
+	$(call startrule,bootstrap_rvct_asm) \
+	$(ASM) $(AFLAGS) -o $$@ --LIST $$(join $$(basename $$@),.lst) $$< \
+	$(call endrule,bootstrap_rvct_asm)
+endef
+
+define bootstrap_link
+$(EPOCBLDABS)/$(NAME).in : $(LINKOBJECTS) $(LINKFILE) | $(EPOCBLDABS)
+	$(call startrule,bootstrap_rvct_link) \
+	$(LD) $(LFLAGS) $(SYMOPT) $$(join $$(basename $$@),.sym) -o $$@ $$(filter %.o,$$^); \
+	$(GNUCP) $$@ $$(join $$(basename $(TRG)),.sym) \
+	$(call endrule,bootstrap_rvct_link)	
+endef
+
+define bootstrap_strip
+$(TRG) : $(EPOCBLDABS)/$(NAME).in
+	$(call startrule,bootstrap_strip) \
+	$(FROMELF) --bin --output $$@ $$< \
+	$(call endrule,bootstrap_rvct_strip)
+endef
+
+define bootstrap_h2inc
+# How to translate the .h files to .inc
+$(1) : $(2)
+	$(call startrule,bootstrap_h2inc) \
+	$(PERL) $(EPOCROOT)/epoc32/tools/h2inc.pl $$< $$@ ARMASM \
+	$(call endrule, bootsrap_h2inc)
+endef
+
+# Joins two lists with a 1:1 mapping, separated by a ->
+# $(call bootstrap_joinlists,a b c,d e f) returns a->d b->e c->f
+define bootstrap_joinlists
+$(join $(1),$(addprefix ->,$(2)))
+endef
+
+# Path for generic source files
+BASESRCPATH := $(E32PATH)/eka/kernel/$(CPU)
+
+# Generic source files
+BASESOURCES := $(foreach S,$(BASESOURCES_NAMES),$(addprefix $(BASESRCPATH)/,$(S)))
+
+HEADERS:= $(E32PATH)/eka/include/kernel/kernboot.h $(E32PATH)/eka/include/kernel/arm/bootdefs.h $(E32PATH)/eka/include/e32rom.h $(GENINCLUDES_HEADERS) $(HEADERS_MM)
+
+# Generated include files
+BOOTSTRAP_GENINCLUDES := $(foreach f,$(HEADERS),$(basename $(notdir $(f))).$(INCEXT))
+
+# Non-generated generic include files
+ifeq ($(BASEINCLUDES),)
+BASEINCLUDES := $(E32PATH)/eka/include/kernel/$(CPU)/bootcpu.inc $(E32PATH)/eka/include/kernel/$(CPU)/bootmacro.inc
+endif
+INCLUDES2 := $(foreach f,$(INCLUDES2),$(basename $(f)).$(INCEXT))
+
+# Generic object files
+FULLBASEOBJECTS := $(foreach src, $(BASESOURCES_NAMES), $(addprefix $(EPOCBLDABS)/,$(basename $(src)).o))
+
+# Platform specific object files
+FULLOBJECTS := $(foreach src, $(SOURCES), $(addprefix $(EPOCBLDABS)/,$(basename $(notdir $(src))).o))
+
+LINKOBJECTS := $(FULLBASEOBJECTS) $(FULLOBJECTS)
+
+# Generated include files with paths
+FULLGENINCLUDES := $(addprefix $(EPOCBLDABS)/,$(BOOTSTRAP_GENINCLUDES))
+
+CLEANTARGETS := $(CLEANTARGETS) $(FULLBASEOBJECTS) $(FULLOBJECTS) $(LINKOBJECTS) $(FULLGENINCLUDES) 
+
+CLEANTARGETS := $(CLEANTARGETS) $(EPOCBLDABS)/$(NAME).in $(join $(basename $(EPOCBLDABS)/$(NAME).in),.sym)
+
+JOINED_INC := $(call bootstrap_joinlists,$(FULLGENINCLUDES),$(HEADERS))
+$(foreach J,$(JOINED_INC),$(eval $(call bootstrap_h2inc,$(word 1,$(subst ->, ,$(J))),$(word 2,$(subst ->, ,$(J))) | $(EPOCBLDABS))))
+
+# How to strip linked object to binary
+$(eval $(call bootstrap_strip,$(TRG),$(EPOCBLDABS)/$(NAME).in))
+
+LISTFILE := $(foreach f,$(FULLBASEOBJECTS),$(join $(basename $(f)),.lst)) $(foreach f,$(FULLOBJECTS),$(join $(basename $(f)),.lst))
+CLEANTARGETS := $(CLEANTARGETS) $(LISTFILE)
+
+JOINED_BASEOBJECTS := $(call bootstrap_joinlists,$(FULLBASEOBJECTS),$(BASESOURCES))
+
+$(foreach J,$(JOINED_BASEOBJECTS),$(eval $(call bootstrap_asm,$(word 1,$(subst ->, ,$(J))),$(EPOCBLDABS)/%.o,$(word 2,$(subst ->, ,$(J))) $(BASEINCLUDES) $(FULLGENINCLUDES) $(INCLUDES2) | $(EPOCBLDABS))))
+
+JOINED_OBJECTS := $(call bootstrap_joinlists,$(FULLOBJECTS),$(SOURCES))
+
+$(foreach J,$(JOINED_OBJECTS),$(eval $(call bootstrap_asm,$(word 1,$(subst ->, ,$(J))),$(EPOCBLDABS)/%.o,$(word 2,$(subst ->, ,$(J))) $(BASEINCLUDES) $(FULLGENINCLUDES) $(INCLUDES2) |$(EPOCBLDABS))))
+
+# How to link the object files
+$(eval $(bootstrap_link))
+
+# Hook into global targets
+TARGET :: $(TRG)
+
+#############################################
+
+# --what to show releasables
+$(eval $(call whatmacro,$(TRG),USERFLM))
+# create directory
+CREATABLEPATHS := $(EPOCBLDABS) $(EPOCTRG)
+$(call makepath,$(CREATABLEPATHS))
+# clean up
+$(eval $(call GenerateStandardCleanTarget,$(CLEANTARGETS),$(BUILDLOC)))
+
+endif
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/bootstrap.meta	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,21 @@
+# Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# 
+# Contributors:
+#
+# Description:
+# Meta information for the boot strap extension template
+#
+
+platform	win32
+makefile 	gnumake
+techstream	base
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/bootstrap.mk	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,391 @@
+# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+# To ensure that EPOCROOT always ends with a forward slash. 
+TMPROOT:=$(subst \,/,$(EPOCROOT))
+EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
+
+ifndef CPU
+CPU := arm
+endif
+
+ifndef LINKBASE
+LINKBASE := 0x00000000
+endif
+
+include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk
+
+PROCEED:=build
+ifneq "$(PBUILDPID)" ""
+        ifneq "$(CFG)" "UREL"
+                PROCEED:=skip
+        endif
+endif
+
+COPY := $(call ecopy)
+
+ifeq "$(CPU)" "x86"
+        ifeq "$(MEMMODEL)" "direct"
+                BLDSGL:=s
+        else
+                ifeq "$(MEMMODEL)" "flexible"
+                        BLDSGL:=f
+                else
+                        BLDSGL:=
+                endif
+        endif
+        ifdef SMP
+                BLDSMP:=smp
+        else
+                BLDSMP:=
+        endif
+        EPOCROOT:=$(subst /,\,$(EPOCROOT))
+        EPOCBLDABS := $(EPOCROOT)epoc32\build\tasm$(PBUILDPID)\$(BLDSGL)$(VNAME)$(BLDSMP)
+else
+        DRIVELETTER := $(shell cd 2>NUL)
+        DRIVELETTER_2 := $(word 1,$(subst \, ,$(DRIVELETTER)))
+        EPOCBLDABS_1 := $(subst $(TO_ROOT),,$(EPOCBLD))
+        EPOCBLDABS_2 := $(subst $(DRIVELETTER_2),,$(EPOCBLDABS_1))
+        
+        EPOCBLDABS := $(call epocbldabs,$(DRIVELETTER_2),$(EPOCBLDABS_2))/$(NAME)
+endif
+
+EPOCINC := $(INC_PATH)
+EPOCKERNINC := $(EPOCINC)/kernel
+EPOCCPUINC := $(EPOCKERNINC)/$(CPU)
+EPOCMMINC := $(INC_PATH)/memmodel/epoc/$(MEMMODEL)/$(CPU)
+EPOCTRG := $(EPOCROOT)epoc32/release/$(PLATFORM_PATH)
+TRG := $(EPOCTRG)/$(NAME).bin
+TEMPTRG := $(EPOCBLDABS)/$(NAME).bin
+
+ifdef EXTRA_INC_PATH
+ASMINCPATH := $(EXTRA_INC_PATH)
+endif
+
+ifeq "$(CPU)" "arm"
+ASMINCPATH := . $(EPOCBLDABS) $(ASMINCPATH) $(EXTENSION_ROOT) $(EPOCCPUINC)
+ARMASM_OUT := $(shell armasm 2>&1)
+ARMASM_OUT_4 := $(word 4,$(ARMASM_OUT))
+ARMASM_OUT_6 := $(word 6,$(ARMASM_OUT))
+
+# Use GCC toolchain if no other is available
+TOOLVER := GCC
+
+RVCTSTR := $(strip $(findstring RVCT, $(ARMASM_OUT_4)))
+ifeq "$(RVCTSTR)" "RVCT"
+        TOOLVER := RVCT
+        OP := --
+endif
+ifeq "$(ARMASM_OUT_6)" "2.37"
+        TOOLVER := 211
+endif
+endif
+
+ifeq "$(MEMMODEL)" "direct"
+CFG_MM := CFG_MMDirect
+endif
+ifeq "$(MEMMODEL)" "moving"
+CFG_MM := CFG_MMMoving
+endif
+ifeq "$(MEMMODEL)" "multiple"
+CFG_MM := CFG_MMMultiple
+endif
+ifeq "$(MEMMODEL)" "flexible"
+CFG_MM := CFG_MMFlexible
+endif
+ifndef CFG_MM
+$(error Memory model unknown)
+endif
+
+ASM_MACROS += $(CFG_MM)
+ifdef SMP
+        ASM_MACROS += SMP
+endif
+
+ifeq "$(CPU)" "x86"
+        ifndef BASEINCLUDES
+                BASEINCLUDES := bootcpu.inc bootmacr.inc
+        endif
+        ifndef BASESOURCES
+                BASESOURCES := bootmain.asm bootcpu.asm bootutil.asm
+        endif
+        GENINCLUDES := $(GENINCLUDES) x86boot.h
+        ASMINCPATH := . 
+        ASM := tasm
+        LINK := tlink
+        EXE2BIN := exe2bin
+        SRCEXT := asm
+        INCEXT := inc
+        OBJEXT := obj
+        EXEEXT := exe
+        
+        ASMINCPATHCMD := $(foreach dir,$(ASMINCPATH),$(join /i,$(call slash2generic,$(dir))))   
+        ASM_MACRO_CMD := $(foreach macro,$(ASM_MACROS),/d$(macro)=1)
+        AFLAGS := /l /m3 /ML /W-PDC $(ASM_MACRO_CMD) $(ASMINCPATHCMD)
+        LFLAGS := /m /s /n /3 /c
+        ASMTYP := TASM
+        LINKFILE :=
+        define do_asm
+                cd $(EPOCBLDABS) && $(CP) $(call slash2generic,$<) .
+                cd $(EPOCBLDABS) && $(ASM) $(AFLAGS) $(notdir $<)
+        endef
+        define do_link
+                cd $(EPOCBLDABS) && $(LINK) $(LFLAGS) $(filter %.$(OBJEXT),$(foreach obj,$^,$(notdir $(obj)))), temp.exe
+                cd $(EPOCBLDABS) && $(COPY) temp.exe $@
+                cd $(EPOCBLDABS) && $(ERASE) temp.exe
+        endef
+        define do_strip
+                cd $(EPOCBLDABS) && $(COPY) $< temp.exe
+                cd $(EPOCBLDABS) && $(EXE2BIN) temp.exe temp.bin
+                cd $(EPOCBLDABS) && $(COPY) temp.bin $@
+                cd $(EPOCBLDABS) && $(ERASE) temp.exe temp.bin
+        endef
+endif
+ifeq "$(CPU)" "arm"
+        ifeq "$(TOOLVER)" "211"
+                ASM := armasm
+                LINK := armlink
+                SRCEXT := s
+                INCEXT := inc
+                OBJEXT := o
+                EXEEXT := in
+                ASMINCPATHCMD := $(foreach dir,$(ASMINCPATH),$(join -I ,$(dir)))
+                ASM_MACRO_CMD := $(foreach macro,$(ASM_MACROS),-predefine "$(macro) SETL {TRUE}")
+                AFLAGS := $(ASM_ARM211_VARIANTFLAGS) -apcs 3/32bit/nosw -Length 0 -Width 200 $(ASM_MACRO_CMD) $(ASMINCPATHCMD)
+                LFLAGS := -Base $(LINKBASE) -Data 0xf0000000 -Entry $(LINKBASE) -Bin -map
+                SYMOPT := -symbols
+                ASMTYP := ARMASM
+                LINKFILE :=
+                define do_asm
+                        $(ASM) $(AFLAGS) -o $@ -LIST $(join $(basename $@),.lst) $<
+                endef
+                define do_link
+                        $(LINK) $(LFLAGS) $(SYMOPT) $(join $(basename $@),.sym) -o $@ $(filter %.$(OBJEXT),$^)
+                endef
+                define do_strip
+                        @if exist $@ $(ERASE) $(call slash2generic,$@) 
+                        $(COPY) $< $@
+                endef
+        endif
+        ifeq "$(TOOLVER)" "RVCT"
+                ASM_MACROS += USE_CXSF
+                ASM := armasm
+                LINK := armlink
+                FROMELF := fromelf
+                SRCEXT := s
+                INCEXT := inc
+                OBJEXT := o
+                EXEEXT := in
+                ASMINCPATHCMD := $(foreach dir,$(ASMINCPATH),$(join -I ,$(dir)))
+                ASM_MACRO_CMD := $(foreach macro,$(ASM_MACROS),$(OP)predefine "$(macro) SETL {TRUE}")
+                AFLAGS := -g $(OP)keep $(ASM_MACRO_CMD) $(ASMINCPATHCMD) $(ASM_RVCT_VARIANTFLAGS)
+                LFLAGS := $(OP)ro-base $(LINKBASE) $(OP)entry $(LINKBASE) $(OP)map
+                SYMOPT := $(OP)symdefs
+                ASMTYP := ARMASM
+                LINKFILE :=
+                define do_asm
+                        $(ASM) $(AFLAGS) -o $@ $(OP)LIST $(join $(basename $@),.lst) $<
+                endef
+                define do_link
+                        $(LINK) $(LFLAGS) $(SYMOPT) $(join $(basename $@),.sym) -o $@ $(filter %.$(OBJEXT),$^)
+                        $(COPY) $@ $(join $(basename $(TRG)),.sym)
+                endef
+                define do_strip
+                        $(FROMELF) $(OP)bin $(OP)output $@ $<
+                endef
+        endif
+        ifeq "$(TOOLVER)" "GCC"
+                ASM_MACROS += USE_CXSF GNU_ASM
+                ASM := as
+                LINK := ld
+                STRIP := strip
+                SRCEXT := s
+                INCEXT := ginc
+                OBJEXT := o
+                EXEEXT := in
+                ASMINCPATHCMD := $(foreach dir,$(ASMINCPATH),$(join -I ,$(dir)))
+                ASM_MACRO_CMD := $(foreach macro,$(ASM_MACROS),--defsym $(macro)=1 )
+                AFLAGS := -mapcs-32 -R -n $(ASM_MACRO_CMD) -I- $(ASMINCPATHCMD)
+                LFLAGS := -n -x --section-alignment 4 --file-alignment 2 -no-whole-archive
+                SYMOPT := -symdefs
+                ASMTYP := AS
+                PROCESS_INCLUDES := 1
+                ifndef LINKFILE
+                        LINKFILE := bootstrap.lnk
+                endif
+                define do_asm
+                        perl $(EPOCROOT)epoc32/tools/armasm2as.pl $< $(join $(basename $@),.ss)
+                        $(ASM) $(AFLAGS) -acdhlms=$(join $(basename $@),.lst) -o $@ $(join $(basename $@),.ss)
+                endef
+                define do_link
+                        if exist $(join $(basename $@),.lnk) $(ERASE) $(call slash2generic,$(join $(basename $@),.lnk)) 
+                        $(COPY) $(subst /,\,$(filter %.lnk,$^)) $(join $(basename $@),.lnk)
+                        $(LINK) -M -o $@ $(filter %.$(OBJEXT),$^) $(LFLAGS) --script=$(join $(basename $@),.lnk) >$(join $(basename $@),.map)
+                endef
+                define do_strip
+                        $(STRIP) -O binary -o $(TEMPTRG) $<
+                        $(COPY) $(TEMPTRG) $@
+                        $(ERASE) $(call slash2generic,$(TEMPTRG)) 
+                endef
+        endif
+endif
+
+
+
+# Generic source files
+ifndef BASESOURCES
+BASESOURCES := bootmain.s bootcpu.s bootutils.s
+endif
+
+# Path for generic source files
+ifndef BASESRCPATH
+BASESRCPATH := $(E32PATH)/eka/kernel/$(CPU)
+endif
+
+
+# Generated include files
+GENINCLUDES := $(foreach f,$(GENINCLUDES),$(basename $(f)).$(INCEXT))
+GENINCLUDES := $(GENINCLUDES) e32rom.$(INCEXT) kernboot.$(INCEXT)
+GENINCLUDES := $(GENINCLUDES) bootdefs.$(INCEXT)
+ifneq "$(MEMMODEL)" "direct"
+GENINCLUDES := $(GENINCLUDES) mmboot.$(INCEXT)
+endif
+
+# Headers from which GENINCLUDES are generated
+GENHEADERS = $(foreach inc,$(GENINCLUDES),$(basename $(inc)).h)
+
+# Non-generated generic include files
+ifndef BASEINCLUDES
+BASEINCLUDES := bootcpu.inc bootmacro.inc
+endif
+BASEINCLUDES := $(foreach f,$(BASEINCLUDES),$(basename $(f)).$(INCEXT))
+INCLUDES := $(foreach f,$(INCLUDES),$(basename $(f)).$(INCEXT))
+
+# Generic object files
+BASEOBJECTS = $(foreach src, $(BASESOURCES), $(basename $(src)).$(OBJEXT))
+
+# Platform specific object files
+OBJECTS = $(foreach src, $(SOURCES), $(basename $(src)).$(OBJEXT))
+
+# Object files with paths
+FULLBASEOBJECTS = $(addprefix $(EPOCBLDABS)/,$(BASEOBJECTS))
+FULLOBJECTS = $(addprefix $(EPOCBLDABS)/,$(OBJECTS))
+LINKOBJECTS = $(FULLBASEOBJECTS) $(FULLOBJECTS)
+
+# Generated include files with paths
+FULLGENINCLUDES = $(addprefix $(EPOCBLDABS)/,$(GENINCLUDES))
+
+# Tell make where to look for things
+vpath %.h . $(EXTRA_INC_PATH) $(EPOCINC) $(EPOCKERNINC) $(EPOCCPUINC) $(EPOCMMINC)
+vpath %.inc . $(EXTRA_INC_PATH) $(EXTENSION_ROOT) $(EPOCINC) $(EPOCKERNINC) $(EPOCCPUINC) $(EPOCMMINC) $(EPOCBLDABS)
+vpath %.ginc $(EPOCBLDABS)
+vpath %.$(SRCEXT) . $(EXTRA_SRC_PATH) $(EXTENSION_ROOT) $(BASESRCPATH)
+vpath %.$(OBJEXT) $(EPOCBLDABS)
+vpath %.lnk . $(EXTENSION_ROOT) $(EPOCCPUINC)
+
+# How to link the object files 
+$(EPOCBLDABS)/$(NAME).$(EXEEXT): $(LINKOBJECTS) $(LINKFILE) $(call pipe,$(EPOCBLDABS)) 
+	$(do_link)
+
+# How to strip linked object to binary
+$(TRG): $(EPOCBLDABS)/$(NAME).$(EXEEXT)
+	$(do_strip)
+
+# How to assemble the source files
+ifdef PROCESS_INCLUDES
+FULLBASEINCLUDES := $(addprefix $(EPOCBLDABS)/,$(BASEINCLUDES))
+FULLINCLUDES := $(addprefix $(EPOCBLDABS)/,$(INCLUDES))
+
+$(FULLBASEINCLUDES) : $(EPOCBLDABS)/%.$(INCEXT) : %.inc $(call pipe,$(EPOCBLDABS))
+	perl $(EPOCROOT)epoc32/tools/armasm2as.pl $< $@
+
+$(FULLINCLUDES) : $(EPOCBLDABS)/%.$(INCEXT) : %.inc $(call pipe,$(EPOCBLDABS))
+	perl $(EPOCROOT)epoc32/tools/armasm2as.pl $< $@
+
+$(FULLBASEOBJECTS) : $(EPOCBLDABS)/%.$(OBJEXT) : %.$(SRCEXT) $(FULLINCLUDES) $(FULLBASEINCLUDES) $(FULLGENINCLUDES) $(call pipe,$(EPOCBLDABS))
+	$(do_asm)
+
+$(FULLOBJECTS) : $(EPOCBLDABS)/%.$(OBJEXT) : %.$(SRCEXT) $(FULLINCLUDES) $(FULLBASEINCLUDES) $(FULLGENINCLUDES) $(call pipe,$(EPOCBLDABS))
+	$(do_asm)
+
+else
+
+ifeq "$(CPU)" "x86"
+FULLBASEINCLUDES := $(addprefix $(EPOCBLDABS)/,$(BASEINCLUDES))
+FULLINCLUDES := $(addprefix $(EPOCBLDABS)/,$(INCLUDES))
+
+$(FULLBASEINCLUDES) $(FULLINCLUDES) : $(EPOCBLDABS)/%.inc : %.inc
+	$(CP) $(call slash2generic,$<) $(call slash2generic,$@) 
+
+$(FULLBASEOBJECTS) $(FULLOBJECTS) : $(EPOCBLDABS)/%.$(OBJEXT) : %.$(SRCEXT) $(FULLBASEINCLUDES) $(FULLGENINCLUDES) $(FULLINCLUDES)
+	$(do_asm)
+
+else
+$(FULLBASEOBJECTS) $(FULLOBJECTS) : $(EPOCBLDABS)/%.$(OBJEXT) : %.$(SRCEXT) $(BASEINCLUDES) $(FULLGENINCLUDES) $(INCLUDES) $(call pipe,$(EPOCBLDABS))
+	$(do_asm)
+
+endif
+endif
+
+# How to translate the .h files to .inc
+$(FULLGENINCLUDES) : $(EPOCBLDABS)/%.$(INCEXT) : %.h $(call pipe,$(EPOCBLDABS))
+	perl $(EPOCROOT)epoc32/tools/h2inc.pl $< $@ $(ASMTYP)
+
+
+# How to make the working directories
+$(EPOCBLDABS) $(EPOCTRG) :
+	$(call ifnotexistd,$(call slash2generic,$@))
+
+# Makmake targets
+.PHONY : MAKMAKE FREEZE LIB CLEANLIB RESOURCE FINAL BLD SAVESPACE RELEASABLES CLEAN
+.PHONY : build skip
+
+MAKMAKE :
+	echo Nothing to do
+	echo $(BASESRCPATH)
+
+FREEZE :
+	echo Nothing to do
+	echo $(BASESRCPATH)
+
+LIB :
+	echo Nothing to do
+	echo $(BASESRCPATH)
+
+CLEANLIB :
+	echo Nothing to do
+	echo $(BASESRCPATH)
+
+RESOURCE :
+	echo Nothing to do
+	echo $(BASESRCPATH)
+
+FINAL :
+	echo Nothing to do
+
+BLD SAVESPACE : $(PROCEED)
+
+RELEASABLES :
+	@echo $(TRG)
+
+CLEAN :
+	-$(ERASE) $(call slash2generic,$(TRG)) 
+	-$(ERASE) $(call slash2generic,$(EPOCBLDABS)/*.*) 
+
+build: $(EPOCTRG) $(EPOCBLDABS) $(TRG)
+	echo Bootstrap built for $(PLATFORM) $(CFG)
+
+skip:
+	echo Bootstrap build skipped for $(PLATFORM) $(CFG)
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/bootstrap.xml	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="ISO-8859-1" ?>
+<build xmlns="http://symbian.com/xml/build" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://symbian.com/xml/build build/2_0.xsd">
+
+<!-- Extension interfaces : replacements for Template Extension Makefiles 
+-->
+
+<interface name="base.bootstrap" extends="Symbian.KernelFLM" flm="bootstrap.flm">
+		<param name="E32PATH" />
+		<param name="NAME" />
+		<param name="MEMMODEL" />
+		<param name="EXTRA_INC_PATH" default=''/>
+		<param name="EXTRA_EPOC32_INC_PATH" default=''/>
+		<param name="SOURCES" />
+		<param name="INCLUDES" />
+		<param name="ASM_MACROS" default='' />
+		<param name="GENINCLUDES_HEADERS" default=''/>
+		<param name="CPU" default='arm'/>
+		<param name="SMP" default=''/>
+		<param name="LINKBASE" default='0x00000000'/>
+		<param name="BASESOURCES_NAMES" default="bootmain.s bootcpu.s bootutils.s"/>
+		<param name="INC_PATH" default=''/>
+	</interface>
+</build>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/config.meta	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,21 @@
+# Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# 
+# Contributors:
+#
+# Description:
+# Meta information for the config extension template
+#
+
+platform	win32
+makefile 	gnumake
+techstream	base
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/config.mk	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,65 @@
+# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+# To guarantee there is a slash at the end of EPOCROOT in case there is not. 
+# This is needed to ensure compatibility with SBSv1.
+TMPROOT:=$(subst \,/,$(EPOCROOT))
+EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
+
+include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk
+
+
+ifndef HALPATH
+HALPATH := ..
+endif
+
+ifndef SOURCE
+SOURCE := hal
+endif
+
+#MDIR := $(call generated,generatedcpp/hal) # abld
+#MDIR := $(call generated,base/lubbock) # raptor
+MDIR := $(call generatedcpp)
+
+MAKMAKE : $(MDIR)/$(PREFIX)values.cpp $(MDIR)/$(PREFIX)config.cpp
+
+FREEZE :
+
+LIB :
+
+CLEANLIB :
+
+RESOURCE :
+
+FINAL :
+
+BLD SAVESPACE : $(MDIR)/$(PREFIX)values.cpp $(MDIR)/$(PREFIX)config.cpp
+
+RELEASABLES :
+
+CLEAN :
+	-$(ERASE) $(call slash2generic,$(MDIR)/$(PREFIX)values.cpp) 
+	-$(ERASE) $(call slash2generic,$(MDIR)/$(PREFIX)config.cpp) 
+#	-$(ERASE) $(MDIR)/$(PREFIX)values.cpp
+#	-$(ERASE) $(MDIR)/$(PREFIX)config.cpp
+
+$(MDIR)/$(PREFIX)values.cpp : $(SOURCE)/values.hda $(EPOCROOT)epoc32/include/platform/hal_data.h
+	-$(call createdir,"$(MDIR)")
+	perl $(HALPATH)/hal/halcfg.pl $(EPOCROOT)epoc32/include/platform/hal_data.h $(SOURCE)/values.hda $(MDIR)/$(PREFIX)values.cpp
+
+$(MDIR)/$(PREFIX)config.cpp : $(SOURCE)/config.hcf $(EPOCROOT)epoc32/include/platform/hal_data.h
+	-$(call createdir,"$(MDIR)")
+	perl $(HALPATH)/hal/halcfg.pl -x $(EPOCROOT)epoc32/include/platform/hal_data.h $(SOURCE)/config.hcf $(MDIR)/$(PREFIX)config.cpp
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/copy_default.meta	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,21 @@
+# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# 
+# Contributors:
+#
+# Description:
+# Meta information for the copy_default extension template
+#
+
+platform	win32
+makefile 	gnumake
+techstream	base
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/copy_default.mk	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,48 @@
+# Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+# To guarantee there is a slash at the end of EPOCROOT in case there is not.
+# This is needed to ensure compatibility with SBSv1. 
+TMPROOT:=$(subst \,/,$(EPOCROOT))
+EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
+
+include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk
+
+
+SOURCE_COPY=$(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/$(SOURCES)
+TARGET_COPY=$(EPOCROOT)epoc32/release/$(PLATFORM_PATH)/$(CFG_PATH)/$(TARGET)
+
+$(TARGET_COPY) : $(SOURCE_COPY)
+	$(call cpfeature,"$(SOURCE_COPY)","$(TARGET_COPY)")
+#	perl $(EPOCROOT)epoc32/tools/copyfeaturevariants.pl "$(SOURCE_COPY)" "$(TARGET_COPY)"
+#	$(CP) "$?" "$@"
+
+#
+# The targets invoked by abld...
+#
+
+MAKMAKE BLD SAVESPACE FREEZE LIB CLEANLIB RESOURCE :
+	@echo Nothing to do for "$@"
+
+CLEAN : 
+	-$(ERASE) $(TARGET_COPY)
+
+RELEASABLES : 
+	@echo $(TARGET_COPY)
+
+# we have to wait until the SOURCE_COPY is built before we can copy it...
+#
+FINAL : $(TARGET_COPY)
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/genexec.meta	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,21 @@
+# Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+# 
+# Contributors:
+#
+# Description:
+# Meta information for the genexec extension template
+#
+
+platform	win32
+makefile 	gnumake
+techstream	base
+
+
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/kernel/eka/extension/genexec.mk	Mon Oct 04 02:35:35 2010 +0300
@@ -0,0 +1,71 @@
+# Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+# All rights reserved.
+# This component and the accompanying materials are made available
+# under the terms of "Eclipse Public License v1.0"
+# which accompanies this distribution, and is available
+# at the URL "http://www.eclipse.org/legal/epl-v10.html".
+#
+# Initial Contributors:
+# Nokia Corporation - initial contribution.
+#
+# Contributors:
+#
+# Description:
+#
+
+# To guarantee there is a slash at the end of EPOCROOT in case there is not.
+# This is needed to ensure compatibility with SBSv1. 
+TMPROOT:=$(subst \,/,$(EPOCROOT))
+EPOCROOT:=$(patsubst %/,%,$(TMPROOT))/
+
+include $(EPOCROOT)epoc32/tools/shell/$(notdir $(basename $(SHELL))).mk
+
+
+XINCDIR := $(INC_PATH)
+XINCKDIR := $(INC_PATH)/kernel
+
+PROCEED:=all
+ifneq "$(PBUILDPID)" ""
+	ifneq "$(PLATFORM)" "$(__firstplat)"
+		PROCEED:=skip
+	endif
+endif
+
+.PHONY : MAKMAKE FREEZE LIB CLEANLIB RESOURCE FINAL BLD SAVESPACE RELEASABLES CLEAN
+.PHONY : all skip
+
+MAKMAKE : $(PROCEED)
+
+FREEZE :
+
+LIB : $(PROCEED)
+
+CLEANLIB :
+
+RESOURCE :
+
+FINAL :
+
+BLD SAVESPACE : $(PROCEED)
+
+RELEASABLES :
+
+CLEAN :
+	-$(ERASE) $(call slash2generic,$(XINCDIR)/exec_enum.h) 
+	-$(ERASE) $(call slash2generic,$(XINCDIR)/exec_user.h) 
+	-$(ERASE) $(call slash2generic,$(XINCKDIR)/exec_kernel.h) 
+
+all: $(XINCDIR)/exec_enum.h $(XINCDIR)/exec_user.h $(XINCKDIR)/exec_kernel.h
+
+$(XINCDIR)/exec_enum.h : $(EXTRA_SRC_PATH)/execs.txt $(EXTRA_SRC_PATH)/genexec.pl
+	perl $(EXTRA_SRC_PATH)/genexec.pl -i $(EXTRA_SRC_PATH)/execs.txt -e $(XINCDIR)/exec_enum.h -u $(XINCDIR)/exec_user.h -k $(XINCKDIR)/exec_kernel.h
+
+$(XINCDIR)/exec_user.h : $(EXTRA_SRC_PATH)/execs.txt $(EXTRA_SRC_PATH)/genexec.pl
+	perl $(EXTRA_SRC_PATH)/genexec.pl -i $(EXTRA_SRC_PATH)/execs.txt -e $(XINCDIR)/exec_enum.h -u $(XINCDIR)/exec_user.h -k $(XINCKDIR)/exec_kernel.h
+
+$(XINCKDIR)/exec_kernel.h :  $(EXTRA_SRC_PATH)/execs.txt $(EXTRA_SRC_PATH)/genexec.pl
+	perl $(EXTRA_SRC_PATH)/genexec.pl -i $(EXTRA_SRC_PATH)/execs.txt -e $(XINCDIR)/exec_enum.h -u $(XINCDIR)/exec_user.h -k $(XINCKDIR)/exec_kernel.h
+
+
+skip:
+	echo GENEXEC skipped for $(PLATFORM) $(CFG)
--- a/kernel/eka/include/e32base.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/include/e32base.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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;
--- a/kernel/eka/include/e32base.inl	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/include/e32base.inl	Mon Oct 04 02:35:35 2010 +0300
@@ -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.
 */
 	{}
 
--- a/kernel/eka/include/e32const.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/include/e32const.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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,
--- a/kernel/eka/include/e32ver.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/include/e32ver.h	Mon Oct 04 02:35:35 2010 +0300
@@ -28,7 +28,7 @@
 
 const TInt KE32MajorVersionNumber=2;
 const TInt KE32MinorVersionNumber=0;
-const TInt KE32BuildVersionNumber=3117;
+const TInt KE32BuildVersionNumber=3119;
 
 const TInt KMachineConfigurationMajorVersionNumber=1;
 const TInt KMachineConfigurationMinorVersionNumber=0;
--- a/kernel/eka/kernel/random.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/kernel/random.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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<KRandomBufferSize> randomBuffer;
 
 	TInt err = KErrNone;
--- a/kernel/eka/release.txt	Fri Sep 17 08:37:04 2010 +0300
+++ b/kernel/eka/release.txt	Mon Oct 04 02:35:35 2010 +0300
@@ -1,3 +1,58 @@
+Version 2.00.3119
+=================
+(Made by fadhliM 31/08/2010)
+
+1.	vfebvre
+	1.	ou1cimx1#545656 ENV Generic base system build extensions must be moved to kernelhwsrv
+	2.	ou1cimx1#545743 ENV Compilation warnings in the boardsupport area
+
+2.	gayarama
+	1.	ou1cimx1#550692 DEV Registration of resources for idle is not complete - Test
+
+3.	haifeyan
+	1.	ou1cimx1#550516 Build warnings of e32test in BTB build for OST submission
+
+4.	dogunjum
+	1.	ou1cimx1#547410 MCL - Domain Manager2 - Bad use of RArray::Append()  
+
+5.	davegord
+	1.	ou1cimx1#543672 [mcl] Problem with ExecHandler::FsRegisterThread()
+
+
+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 <OpenSystemTrace.h>" 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)
--- a/kerneltest/e32test/bench/t_svr5.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/bench/t_svr5.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -624,6 +624,30 @@
 	return KErrNone;
 	}
 
+TInt RogueThread5(TAny*)
+	{
+	// try to masquerade as the WindowServer
+	UserSvr::WsRegisterThread();			// this should panic the thread
+	return KErrNone;
+	}
+
+TInt RogueThread6(TAny*)
+	{
+	// try to masquerade as the FileServer
+	UserSvr::FsRegisterThread();			// this should panic the thread
+	return KErrNone;
+	}
+
+TInt RogueThread7(TAny*)
+	{
+	// try to masquerade as the FileServer
+	RChunk myChunk;
+	TInt err = myChunk.CreateLocal(4096, 8192);
+	if (err == KErrNone)
+		UserSvr::RegisterTrustedChunk(myChunk.Handle());	// this should panic the thread
+	return err;
+	}
+
 void DisplayThreadExitInfo(const RThread& aThread)
 	{
 	TFullName fn=aThread.FullName();
@@ -675,6 +699,33 @@
 	test(thread.ExitType()==EExitPanic);
 	test(thread.ExitReason()==EBadMessageHandle);
 	thread.Close();
+
+	test.Next(_L("Rogue thread test 5"));
+	r=thread.Create(_L("Rogue5"),RogueThread5,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
+	test_KErrNone(r);
+	RunPanicThread(thread);	// wait for rogue thread to die
+	DisplayThreadExitInfo(thread);
+	test(thread.ExitType()==EExitPanic);
+	test(thread.ExitReason()==EAccessDenied);
+	thread.Close();
+
+	test.Next(_L("Rogue thread test 6"));
+	r=thread.Create(_L("Rogue6"),RogueThread6,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
+	test_KErrNone(r);
+	RunPanicThread(thread);	// wait for rogue thread to die
+	DisplayThreadExitInfo(thread);
+	test(thread.ExitType()==EExitPanic);
+	test(thread.ExitReason()==EAccessDenied);
+	thread.Close();
+
+	test.Next(_L("Rogue thread test 7"));
+	r=thread.Create(_L("Rogue7"),RogueThread7,KDefaultStackSize,KHeapSize,KHeapSize,NULL);
+	test_KErrNone(r);
+	RunPanicThread(thread);	// wait for rogue thread to die
+	DisplayThreadExitInfo(thread);
+	test(thread.ExitType()==EExitPanic);
+	test(thread.ExitReason()==EAccessDenied);
+	thread.Close();
 	}
 
 TInt SecondClient(TAny* aSession)
--- a/kerneltest/e32test/bmarm/resourcecontroller.def	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/bmarm/resourcecontroller.def	Mon Oct 04 02:35:35 2010 +0300
@@ -28,4 +28,5 @@
 	AllocReserve__20PowerResourceManagerUiUcUc @ 27 NONAME R3UNUSED ; PowerResourceManager::AllocReserve(unsigned int, unsigned char, unsigned char)
 	InitController__24DPowerResourceController @ 28 NONAME R3UNUSED ; DPowerResourceController::InitController(void)
 	RegisterArrayOfStaticResources__24DPowerResourceControllerUiRPP20DStaticPowerResourceUi @ 29 NONAME R3UNUSED ; DPowerResourceController::RegisterArrayOfStaticResources(unsigned int, DStaticPowerResource **&, unsigned int)
+	ResourceControllerRegistration__33DSimulatedPowerResourceController @ 30 NONAME R3UNUSED ; DSimulatedPowerResourceController::ResourceControllerRegistration(void)
 
--- a/kerneltest/e32test/bmarm/resourcecontroller_extended.def	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/bmarm/resourcecontroller_extended.def	Mon Oct 04 02:35:35 2010 +0300
@@ -33,4 +33,5 @@
 	__21DDynamicPowerResourceRC6TDesC8i @ 32 NONAME R3UNUSED ; DDynamicPowerResource::DDynamicPowerResource(TDesC8 const &, int)
 	AllocReserve__20PowerResourceManagerUiUcUc @ 33 NONAME R3UNUSED ; PowerResourceManager::AllocReserve(unsigned int, unsigned char, unsigned char)
 	RegisterArrayOfStaticResources__24DPowerResourceControllerUiRPP20DStaticPowerResourceUi @ 34 NONAME R3UNUSED ; DPowerResourceController::RegisterArrayOfStaticResources(unsigned int, DStaticPowerResource **&, unsigned int)
+	ResourceControllerRegistration__33DSimulatedPowerResourceController @ 35 NONAME R3UNUSED ; DSimulatedPowerResourceController::ResourceControllerRegistration(void)
 
--- a/kerneltest/e32test/bwins/resourcecontroller.def	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/bwins/resourcecontroller.def	Mon Oct 04 02:35:35 2010 +0300
@@ -28,4 +28,5 @@
 	?RequestNotification@PowerResourceManager@@SAHIIAAVDPowerResourceNotification@@HH@Z @ 27 NONAME ; public: static int __cdecl PowerResourceManager::RequestNotification(unsigned int,unsigned int,class DPowerResourceNotification &,int,int)
 	?InitController@DPowerResourceController@@SAHXZ @ 28 NONAME ; public: static int __cdecl DPowerResourceController::InitController(void)
 	?RegisterArrayOfStaticResources@DPowerResourceController@@SAHIAAPAPAVDStaticPowerResource@@I@Z @ 29 NONAME ; public: static int __cdecl DPowerResourceController::RegisterArrayOfStaticResources(unsigned int,class DStaticPowerResource * * &,unsigned int)
+	?ResourceControllerRegistration@DSimulatedPowerResourceController@@SAHXZ @ 30 NONAME ; int DSimulatedPowerResourceController::ResourceControllerRegistration(void)
 
--- a/kerneltest/e32test/bwins/resourcecontroller_extended.def	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/bwins/resourcecontroller_extended.def	Mon Oct 04 02:35:35 2010 +0300
@@ -33,4 +33,5 @@
 	?RequestNotification@PowerResourceManager@@SAHIIAAVDPowerResourceNotification@@@Z @ 32 NONAME ; public: static int __cdecl PowerResourceManager::RequestNotification(unsigned int,unsigned int,class DPowerResourceNotification &)
 	?RequestNotification@PowerResourceManager@@SAHIIAAVDPowerResourceNotification@@HH@Z @ 33 NONAME ; public: static int __cdecl PowerResourceManager::RequestNotification(unsigned int,unsigned int,class DPowerResourceNotification &,int,int)
 	?RegisterArrayOfStaticResources@DPowerResourceController@@SAHIAAPAPAVDStaticPowerResource@@I@Z @ 34 NONAME ; public: static int __cdecl DPowerResourceController::RegisterArrayOfStaticResources(unsigned int,class DStaticPowerResource * * &,unsigned int)
+	?ResourceControllerRegistration@DSimulatedPowerResourceController@@SAHXZ @ 35 NONAME ; int DSimulatedPowerResourceController::ResourceControllerRegistration(void)
 
--- a/kerneltest/e32test/device/t_usbcsc.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/device/t_usbcsc.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -24,6 +24,7 @@
 #include "t_usblib.h"
 #include <e32svr.h>
 #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<KUsbDescSize_Otg> 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++)
--- a/kerneltest/e32test/domainmgr/t_domain.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/domainmgr/t_domain.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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"
@@ -806,7 +806,9 @@
 	void Perform();
 	void Release();
 	TInt TransitionNotification(MDmDomainMember& aDomainMember);
-	void TransitionRequestComplete();
+	void TransitionRequestComplete();	
+	void RunTestOnGetTransitionFailures(RArray<const TTransitionFailure>& aTransitionFailure);
+	
 	CDmTest5(TDmDomainId aPowerId, TDmDomainId aTestId, TDmDomainState aPowerState, TDmDomainState aTestState) : 
 		CActive(CActive::EPriorityStandard), 
 		iPowerDomainId(aPowerId), iTestDomainId(aTestId), iPowerState(aPowerState), iTestState(aTestState) {}
@@ -846,7 +848,28 @@
 	TInt				iTransitionsExpected;
 	};
 
-
+void CDmTest5::RunTestOnGetTransitionFailures(RArray<const TTransitionFailure>& aTransitionFailure)
+	{
+	//*************************************************
+	// Test - OOM Testing on GetTransitionFailures()
+	// Simulates heap failure in GetTransitionFailures()
+	//*************************************************
+	TInt error = 0;
+	TInt count = 0;	
+	do
+		{		
+		__UHEAP_SETFAIL(RHeap::EFailNext, ++count);
+		error = iTestDomainManager.GetTransitionFailures(aTransitionFailure);						
+		test.Printf( _L( "CDmTest5::RunTestOnGetTransitionFailures, simulating heap failure on GetTransitionFailures(), Error=%d, Run=%d\n" ), error, count );
+		}while(error == KErrNoMemory);		
+		
+	__UHEAP_RESET;
+	
+	//Actual count of heap failure as the final iteration which terminates the loop would not return KErrNoMemory 
+	--count;
+	test(count > 0);
+	test.Printf( _L( "Out of memory tests on GetTransitionFailures() succeeded at heap failure rate of %i\n" ), count );
+	}
 
 //! @SYMTestCaseID PBASE-T_DOMAIN-5
 //! @SYMTestType CT
@@ -1106,6 +1129,18 @@
 	testFailureCount = iTestDomainManager.GetTransitionFailureCount();
 	test (testFailureCount == 1);
 
+#ifdef _DEBUG
+	//***************************************************************
+	// OOM Testing: Simulates heap failure in GetTransitionFailures()
+	//***************************************************************
+	__UHEAP_MARK;
+	RArray<const TTransitionFailure> oomTestFailures;
+	RunTestOnGetTransitionFailures(oomTestFailures);
+	test(oomTestFailures.Count()==1);
+	oomTestFailures.Close();
+	__UHEAP_MARKEND;
+#endif
+	
 	r = iTestDomainManager.GetTransitionFailures(testFailures);
 	test(r == KErrNone);
 	test(testFailureCount == testFailures.Count());
@@ -2210,7 +2245,6 @@
 		{
 		MDmTest* tests[] = 
 			{
-
 			new CDmTest1(KDmIdRoot, EPwStandby),
 			new CDmTest1(KDmIdRoot, EPwOff),
 			new CDmTest1(KDmIdRoot, EPwActive),
--- a/kerneltest/e32test/eabi/resourcecontroller.def	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/eabi/resourcecontroller.def	Mon Oct 04 02:35:35 2010 +0300
@@ -30,4 +30,5 @@
 	_ZTV20DStaticPowerResource @ 29 NONAME
 	_ZN24DPowerResourceController14InitControllerEv @ 30 NONAME
 	_ZN24DPowerResourceController30RegisterArrayOfStaticResourcesEjRPP20DStaticPowerResourcej @ 31 NONAME
+	_ZN33DSimulatedPowerResourceController30ResourceControllerRegistrationEv @ 32 NONAME
 
--- a/kerneltest/e32test/eabi/resourcecontroller_extended.def	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/eabi/resourcecontroller_extended.def	Mon Oct 04 02:35:35 2010 +0300
@@ -45,4 +45,5 @@
 	_ZTV21DStaticPowerResourceD @ 44 NONAME
 	_ZTV22DDynamicPowerResourceD @ 45 NONAME
 	_ZN24DPowerResourceController30RegisterArrayOfStaticResourcesEjRPP20DStaticPowerResourcej @ 46 NONAME
+	_ZN33DSimulatedPowerResourceController30ResourceControllerRegistrationEv @ 47 NONAME
 
--- a/kerneltest/e32test/group/t_usb_device.mmp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/group/t_usb_device.mmp	Mon Oct 04 02:35:35 2010 +0300
@@ -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
 
--- a/kerneltest/e32test/group/t_usb_scdevice.mmp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/group/t_usb_scdevice.mmp	Mon Oct 04 02:35:35 2010 +0300
@@ -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
--- a/kerneltest/e32test/group/t_usbcsc.mmp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/group/t_usbcsc.mmp	Mon Oct 04 02:35:35 2010 +0300
@@ -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
--- a/kerneltest/e32test/mmu/t_shbuf.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/mmu/t_shbuf.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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<RShBuf>& 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<RShBuf>& 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
--- a/kerneltest/e32test/resourceman/d_rescontrolcli.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/resourceman/d_rescontrolcli.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -526,6 +526,7 @@
 		&& (aFunction != RTestResMan::EDeRegisterClientLevelFromResource) 
 		&& (aFunction != RTestResMan::ECheckPostBootLevelNotifications)
 		&& (aFunction != RTestResMan::EGetControllerVersion)
+		&& (aFunction != RTestResMan::ERegisterResourceController)
 #ifdef PRM_ENABLE_EXTENDED_VERSION
 		   && (aFunction != RTestResMan::ERegisterDynamicResource))
 #else
@@ -1004,6 +1005,11 @@
 				}
 			break;
 			}
+		case RTestResMan::ERegisterResourceController:
+			{
+			r = DSimulatedPowerResourceController::ResourceControllerRegistration();
+			break;
+			}
 #ifdef PRM_ENABLE_EXTENDED_VERSION
 		case RTestResMan::ERegisterDynamicResource:
 			{
--- a/kerneltest/e32test/resourceman/d_rescontrolcli.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/resourceman/d_rescontrolcli.h	Mon Oct 04 02:35:35 2010 +0300
@@ -88,6 +88,7 @@
 		ECheckPostBootLevelNotifications,
 		ECancelNotification, 
 		EGetControllerVersion,
+		ERegisterResourceController,
 #ifdef PRM_ENABLE_EXTENDED_VERSION
 		ERegisterDynamicResource,
 		EDeRegisterDynamicResource,
@@ -134,6 +135,7 @@
 	TInt DeRegisterClientLevelFromResource(TInt aClientId, TUint aResId);
 	TInt CheckPostBootLevelNotifications();
 	TInt GetResourceControllerVersion(TUint aClientId, TUint& aVersion);
+	TInt CheckResourceControllerRegistration();
 #ifdef PRM_ENABLE_EXTENDED_VERSION
 	TInt RegisterDynamicResource(TUint aClientId, TUint& aResourceId);
 	TInt DeRegisterDynamicResource(TUint aClientId, TUint aResourceId, TInt *aLevel);
@@ -507,6 +509,11 @@
 	return DoControl(EGetControllerVersion, (TAny*)aClientId, (TAny*)&aVersion);
 	}
 
+TInt RTestResMan::CheckResourceControllerRegistration()
+	{
+	return DoControl(ERegisterResourceController, (TAny*)NULL, (TAny*)NULL);
+	}
+
 #ifdef PRM_ENABLE_EXTENDED_VERSION
 /** Register dynamic resource.
 	@Param - aClientId - Id of the client that is registering the dynamic resource
--- a/kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -175,6 +175,22 @@
 	return(TheController.InitResources());
 	}
 
+/** This function is used only for testing purpose. Test default implementation DPowerController::DoRegisterResourceController() 
+	*/
+EXPORT_C TInt DSimulatedPowerResourceController::ResourceControllerRegistration()
+	{
+	Kern::Printf("DSimulatedPowerResourceController::ResourceControllerRegistration()\n");
+	TInt r = KErrNone;
+    if(TPowerController::PowerController())
+		{
+		r =	TPowerController::PowerController()->DoRegisterResourceController();
+		}
+	else 
+		r = KErrNotFound;
+
+	return r;
+	}
+
 /** This function changes the state of the resource to appropriate value */
 TInt DSimulatedPowerResourceController::ChangeResource(TPowerRequest& req, TInt& aCurrentLevel, TInt aMaxLevel, TInt aMinLevel)
 	{
--- a/kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/resourceman/resourceman_psl/rescontrol_psl.h	Mon Oct 04 02:35:35 2010 +0300
@@ -71,6 +71,7 @@
     TInt ProcessEventResources(TPowerRequest& req, TInt& aClientLevel, TInt aMaxLevel, TInt aMinLevel, TInt aDefaultLevel, TInt aBlockTime = 0);
     IMPORT_C static TInt CaptureIdleResourcesInfo(TUint aControllerId, TUint aNumResources, TPtr* aPtr);
 	IMPORT_C static TInt CompleteResourceControllerInitialisation();
+	IMPORT_C static TInt ResourceControllerRegistration();
 #ifdef PRM_ENABLE_EXTENDED_VERSION
 	TInt DoRegisterStaticResourcesDependency(RPointerArray <DStaticPowerResourceD> & aStaticResourceDArray);
 	TInt CreateResourceDependency(RPointerArray <DStaticPowerResourceD> & pResArray);
--- a/kerneltest/e32test/resourceman/t_rescontrolcli.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/resourceman/t_rescontrolcli.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -4355,6 +4355,11 @@
 	//Check whether the notifications recieved as a result of postboot level setting is as expected.
 	r = lddChan.CheckPostBootLevelNotifications();
 	test(r == KErrNone);
+	
+	//Test resource controller registration
+	r = lddChan.CheckResourceControllerRegistration();
+	test(r == KErrNone);
+
 	TBool regressionTesting = EFalse;
 	//Parse the command line arguments.
 	TBuf<0x50> cmd;
--- a/kerneltest/e32test/thread/t_thread.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/thread/t_thread.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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();
--- a/kerneltest/e32test/usb/t_usb_device/src/activecontrol.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/usb/t_usb_device/src/activecontrol.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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<KUsbDescSize_Otg> 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);
@@ -1533,6 +1559,7 @@
 
 void CActiveControl::PrintHostLog()
 	{
+#ifdef OST_TRACE_COMPILER_IN_USE
 	TRequestStatus status = 0;
 	wchar_t lineBuf[128];
 	TUint j = 0;
@@ -1551,76 +1578,78 @@
 	TUint readSize;
 	TBool readZlp = EFalse;
 
-	r = iPort->OpenEndpoint(scReadBuf,firstBulkOutEndpoint);
-	test_KErrNone(r);
-	do
-		{
-		r = scReadBuf.GetBuffer (scReadData,readSize,readZlp,status);
-		// The following line can be reinstated once the shared chunk failure is fixed
-		// that prevents the readZlp flag from being set
-		// test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof));
-		if (r == KErrCompletion)
-			{
-			TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readSize);
-			if(gVerbose)
-			    {
-			    OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP01, "Host log file %d bytes read\n",readSize);
-			    }
-			scCharPtr = (TUint8 *)scReadData;
-			// Print the host log file
-			for (TUint i = 0; i < readSize; i++)
-				{
-				if (* scCharPtr == '\r')
-					{
-					lineBuf[j++] = '\0';
-					OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP02, "%S",*lineBuf);
-					j = 0;
-					}
-				else
-					{
-					if (* scCharPtr != '\n')
-						{
-						lineBuf[j++] = * scCharPtr;
-						}
-					}
-				scCharPtr++;
-				}
-			}
-		if (r == KErrNone)
-			{
-			User::WaitForRequest(status);
-			test_KErrNone(status.Int());
-			}
-		}
-	while (r >= KErrNone && !readZlp);
-	#else
-	TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize);
-	iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf);
-	User::WaitForRequest(status);
-	test_KErrNone(status.Int());
-	TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readBuf.Length());
-	if(gVerbose)
-	    {
-	    OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP03, "Host log file %d bytes read\n",readBuf.Length());
-	    }
-	for (TUint i = 0; i < readBuf.Length(); i++)
-		{
-		if (readBuf[i] == '\r')
-			{
-			lineBuf[j++] = '\0';
-			OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP04, "%s",*lineBuf);
-			j = 0;
-			}
-		else
-			{
-			if (readBuf[i] != '\n')
-				{
-				lineBuf[j++] = readBuf[i];
-				}
-			}
-		}
-	User::Free ((TAny *)readBuf.Ptr());
-	#endif
+    r = iPort->OpenEndpoint(scReadBuf,firstBulkOutEndpoint);
+    test_KErrNone(r);
+    do
+        {
+        r = scReadBuf.GetBuffer (scReadData,readSize,readZlp,status);
+        // The following line can be reinstated once the shared chunk failure is fixed
+        // that prevents the readZlp flag from being set
+        // test_Value(r, (r == KErrNone) || (r == KErrCompletion) || (r == KErrEof));
+        if (r == KErrCompletion)
+            {
+            TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readSize);
+            if(gVerbose)
+                {
+                OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP01, "Host log file %d bytes read\n",readSize);
+                }
+            scCharPtr = (TUint8 *)scReadData;
+            // Print the host log file
+            for (TUint i = 0; i < readSize; i++)
+                {
+                if (* scCharPtr == '\r')
+                    {
+                    lineBuf[j++] = '\0';
+                    OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP02, "%S",*lineBuf);
+                    j = 0;
+                    }
+                else
+                    {
+                    if (* scCharPtr != '\n')
+                        {
+                        lineBuf[j++] = * scCharPtr;
+                        }
+                    }
+                scCharPtr++;
+                }
+            }
+        if (r == KErrNone)
+            {
+            User::WaitForRequest(status);
+            test_KErrNone(status.Int());
+            }
+        }
+    while (r >= KErrNone && !readZlp);
+    #else
+    TPtr8 readBuf((TUint8 *)User::Alloc(KHostLogFileSize),KHostLogFileSize,KHostLogFileSize);
+    iPort[0].ReadUntilShort(status, (TEndpointNumber)firstBulkOutEndpoint, readBuf);
+    User::WaitForRequest(status);
+    test_KErrNone(status.Int());
+    TUSB_VERBOSE_PRINT1("Host log file %d bytes read\n",readBuf.Length());
+    if(gVerbose)
+        {
+        OstTrace1(TRACE_VERBOSE, CACTIVECONTROL_PRINTHOSTLOG_DUP03, "Host log file %d bytes read\n",readBuf.Length());
+        }
+    for (TUint i = 0; i < readBuf.Length(); i++)
+        {
+        if (readBuf[i] == '\r')
+            {
+            lineBuf[j++] = '\0';
+            OstTraceExt1(TRACE_NORMAL, CACTIVECONTROL_PRINTHOSTLOG_DUP04, "%s",*lineBuf);
+            j = 0;
+            }
+        else
+            {
+            if (readBuf[i] != '\n')
+                {
+                lineBuf[j++] = readBuf[i];
+                }
+            }
+        }
+    User::Free ((TAny *)readBuf.Ptr());
+    #endif
+    
+#endif // OST_TRACE_COMPILER_IN_USE
 	}
 
 void CActiveControl::QueryUsbClientL(LDDConfigPtr aLddPtr, RDEVCLIENT* aPort)
@@ -2360,4 +2389,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-
--- a/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1231.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/PBASE-T_USBDI-1231.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -27,455 +27,464 @@
 #endif
 
 namespace NUnitTesting_USBDI
-	{
+    {
 
-	_LIT(KTestCaseId,"PBASE-T_USBDI-1231");
-	// the name is very important 
-	const TFunctorTestCase<CUT_PBASE_T_USBDI_1231,TBool>
-			CUT_PBASE_T_USBDI_1231::iFunctor(KTestCaseId);
+    _LIT(KTestCaseId,"PBASE-T_USBDI-1231");
+    // the name is very important 
+    const TFunctorTestCase<CUT_PBASE_T_USBDI_1231,TBool>
+            CUT_PBASE_T_USBDI_1231::iFunctor(KTestCaseId);
 
-	CUT_PBASE_T_USBDI_1231* CUT_PBASE_T_USBDI_1231::NewL(TBool aHostRole)
-		{
-		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_NEWL_ENTRY, aHostRole );
-		CUT_PBASE_T_USBDI_1231* self = new (ELeave) CUT_PBASE_T_USBDI_1231(aHostRole);
-		CleanupStack::PushL(self);
-		self->ConstructL();
-		CleanupStack::Pop(self);
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_NEWL_EXIT, ( TUint )( self ) );
-		return self;
-		}
+    CUT_PBASE_T_USBDI_1231* CUT_PBASE_T_USBDI_1231::NewL(TBool aHostRole)
+        {
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_NEWL_ENTRY, aHostRole );
+        CUT_PBASE_T_USBDI_1231* self = new (ELeave) CUT_PBASE_T_USBDI_1231(aHostRole);
+        CleanupStack::PushL(self);
+        self->ConstructL();
+        CleanupStack::Pop(self);
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_NEWL_EXIT, ( TUint )( self ) );
+        return self;
+        }
 
-	CUT_PBASE_T_USBDI_1231::CUT_PBASE_T_USBDI_1231(TBool aHostRole) :
-		CBaseTestCase(KTestCaseId, aHostRole), iInterface0Resumed(EFalse)
-		{
-		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_ENTRY, this );
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_EXIT, this );
-		}
+    CUT_PBASE_T_USBDI_1231::CUT_PBASE_T_USBDI_1231(TBool aHostRole) :
+        CBaseTestCase(KTestCaseId, aHostRole), iInterface0Resumed(EFalse)
+        {
+        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_ENTRY, this );
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::ConstructL()
-		{
-		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_ENTRY, this );
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231, "====> Constructor entry priority = %d", RThread().Priority());
+    void CUT_PBASE_T_USBDI_1231::ConstructL()
+        {
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_ENTRY, this );
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231, "====> Constructor entry priority = %d", RThread().Priority());
 
-		// Collect existing thread priority (to reinstate later)
-		iPriority = RThread().Priority();
+        // Collect existing thread priority (to reinstate later)
+        iPriority = RThread().Priority();
 
-		iTestDevice = new RUsbDeviceA(this);
-		BaseConstructL();
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_EXIT, this );
-		}
+        iTestDevice = new RUsbDeviceA(this);
+        BaseConstructL();
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CONSTRUCTL_EXIT, this );
+        }
 
-	CUT_PBASE_T_USBDI_1231::~CUT_PBASE_T_USBDI_1231()
-		{
+    CUT_PBASE_T_USBDI_1231::~CUT_PBASE_T_USBDI_1231()
+        {
         OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_ENTRY_DUP01, this );
 
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231, "====> Destructor entry priority = %d", RThread().Priority());
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231, "====> Destructor entry priority = %d", RThread().Priority());
 
-		// Reinstate original priority
+        // Reinstate original priority
 
-		RThread().SetPriority(iPriority);
+        RThread().SetPriority(iPriority);
 
-		// Cancel any async operations
+        // Cancel any async operations
 
-		Cancel(); // Cancel host timer
+        Cancel(); // Cancel host timer
 
-		// Destroy the watchers
-		// they still use opened interfaces to cancel the suspend if active
-		delete iInterface1Watcher;
-		delete iInterface0Watcher;
+        // Destroy the watchers
+        // they still use opened interfaces to cancel the suspend if active
+        delete iInterface1Watcher;
+        delete iInterface0Watcher;
 
-		// Close the interfaces
-		iUsbInterface1.Close();
-		iUsbInterface0.Close();
+        // Close the interfaces
+        iUsbInterface1.Close();
+        iUsbInterface0.Close();
 
-		delete iControlEp0;
-		delete iActorFDF;
-		if (!IsHost() && iTestDevice)
-			{
-			iTestDevice->Close();
-			}
-		delete iTestDevice;
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_EXIT_DUP01, this );
-		}
+        delete iControlEp0;
+        delete iActorFDF;
+        if (!IsHost() && iTestDevice)
+            {
+            iTestDevice->Close();
+            }
+        delete iTestDevice;
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_CUT_PBASE_T_USBDI_1231_EXIT_DUP01, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::ExecuteHostTestCaseL()
-		{
+    void CUT_PBASE_T_USBDI_1231::ExecuteHostTestCaseL()
+        {
         OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_EXECUTEHOSTTESTCASEL_ENTRY, this );
 
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP01, "====> ExecuteHostTestCaseL entry priority = %d",
-				RThread().Priority());
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP01, "====> ExecuteHostTestCaseL entry priority = %d",
+                RThread().Priority());
 
-		// Bump thread priority for this test only
+        // Bump thread priority for this test only
 
-		RThread().SetPriority(EPriorityAbsoluteHigh);
-		OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP02, "Thread priority raised %d->%d", iPriority, RThread().Priority());
+        RThread().SetPriority(EPriorityAbsoluteHigh);
+        OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP02, "Thread priority raised %d->%d", iPriority, RThread().Priority());
 
-		iCaseStep = EInProcess;
-		iActorFDF = CActorFDF::NewL(*this);
-		iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
-		iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1231::Interface0ResumedL,this));
-		iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_1231::Interface1ResumedL,this));
+        iCaseStep = EInProcess;
+        iActorFDF = CActorFDF::NewL(*this);
+        iControlEp0 = new (ELeave) CEp0Transfer(iUsbInterface0);
+        iInterface0Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface0,TCallBack(CUT_PBASE_T_USBDI_1231::Interface0ResumedL,this));
+        iInterface1Watcher = new (ELeave) CInterfaceWatcher(iUsbInterface1,TCallBack(CUT_PBASE_T_USBDI_1231::Interface1ResumedL,this));
 
-		// Monitor for device connections
-		iActorFDF->Monitor();
+        // Monitor for device connections
+        iActorFDF->Monitor();
 
-		// Start the connection timeout	
-		TimeoutIn(30);
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EXECUTEHOSTTESTCASEL_EXIT, this );
-		}
+        // Start the connection timeout    
+        TimeoutIn(30);
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EXECUTEHOSTTESTCASEL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::ExecuteDeviceTestCaseL()
-		{
+    void CUT_PBASE_T_USBDI_1231::ExecuteDeviceTestCaseL()
+        {
         OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_EXECUTEDEVICETESTCASEL_ENTRY, this );
 
-		// Construct the device for the test case
-		iTestDevice->OpenL(TestCaseId());
-		iTestDevice->SubscribeToReports(iStatus);
-		SetActive();
+        // Construct the device for the test case
+        iTestDevice->OpenL(TestCaseId());
+        iTestDevice->SubscribeToReports(iStatus);
+        SetActive();
 
-		// Connect the test device	
-		iTestDevice->SoftwareConnect();
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EXECUTEDEVICETESTCASEL_EXIT, this );
-		}
+        // Connect the test device    
+        iTestDevice->SoftwareConnect();
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EXECUTEDEVICETESTCASEL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::HostDoCancel()
-		{
+    void CUT_PBASE_T_USBDI_1231::HostDoCancel()
+        {
         OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_HOSTDOCANCEL_ENTRY, this );
 
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP03, "====> HostDoCancel entry priority = %d", RThread().Priority());
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP03, "====> HostDoCancel entry priority = %d", RThread().Priority());
 
-		// Cancel the timeout timer
-		CancelTimeout();
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_HOSTDOCANCEL_EXIT, this );
-		}
+        // Cancel the timeout timer
+        CancelTimeout();
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_HOSTDOCANCEL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::DeviceDoCancel()
-		{
+    void CUT_PBASE_T_USBDI_1231::DeviceDoCancel()
+        {
         OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_DEVICEDOCANCEL_ENTRY, this );
 
-		// Cancel the device	
-		iTestDevice->CancelSubscriptionToReports();
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEDOCANCEL_EXIT, this );
-		}
+        // Cancel the device    
+        iTestDevice->CancelSubscriptionToReports();
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEDOCANCEL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::DeviceInsertedL(TUint aDeviceHandle)
-		{
+    void CUT_PBASE_T_USBDI_1231::DeviceInsertedL(TUint aDeviceHandle)
+        {
         OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_DEVICEINSERTEDL_ENTRY, this );
 
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP04, "====> DeviceInsertedL entry priority = %d", RThread().Priority());
-		
-		iInterface0Resumed = EFalse;
-		
-		Cancel(); // Cancel the timer
-		TInt err(KErrNone);
-		iDeviceHandle = aDeviceHandle;
-		iActorFDF->Monitor();
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP04, "====> DeviceInsertedL entry priority = %d", RThread().Priority());
+        
+        iInterface0Resumed = EFalse;
+        
+        Cancel(); // Cancel the timer
+        TInt err(KErrNone);
+        iDeviceHandle = aDeviceHandle;
+        iActorFDF->Monitor();
 
-		// Validate that device is as expected
-		CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
-		if (testDevice.SerialNumber().Compare(TestCaseId()) != 0)
-			{
-			// Incorrect device for this test case
+        // Validate that device is as expected
+        CUsbTestDevice& testDevice = iActorFDF->DeviceL(aDeviceHandle);
+        if (testDevice.SerialNumber().Compare(TestCaseId()) != 0)
+            {
+            // Incorrect device for this test case
 
-			RDebug::Printf(
-					"<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
-					KErrNotFound, &testDevice.SerialNumber(), &TestCaseId());
+            RDebug::Printf(
+                    "<Warning %d> Incorrect device serial number (%S) connected for this test case (%S)",
+                    KErrNotFound, &testDevice.SerialNumber(), &TestCaseId());
 
-			// Start the connection timeout again
-			TimeoutIn(30);
-			OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEINSERTEDL_EXIT, this );
-			return;
-			}
-		// Check tree now	
-		CHECK(CheckTreeAfterDeviceInsertion(testDevice, _L("RDeviceA")) == KErrNone);
+            // Start the connection timeout again
+            TimeoutIn(30);
+            OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEINSERTEDL_EXIT, this );
+            return;
+            }
+        // Check tree now    
+        CHECK(CheckTreeAfterDeviceInsertion(testDevice, _L("RDeviceA")) == KErrNone);
 
-		// Perform the correct test step				
-		switch (iCaseStep)
-			{
-			case EInProcess:
-				{
-				TUint32 token1(0);
-				TUint32 token2(0);
+        // Perform the correct test step                
+        switch (iCaseStep)
+            {
+            case EInProcess:
+                {
+                TUint32 token1(0);
+                TUint32 token2(0);
 
-				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP05, "Obtaining token for interface 0");
-				err = testDevice.Device().GetTokenForInterface(0, token1);
-				if (err != KErrNone)
-					{
-					RDebug::Printf(
-							"<Error %d> Token for interface 0 could not be retrieved",
-							err);
-					return TestFailed(err);
-					}
-				OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP06, "Token 1 (%d) retrieved", token1);
-				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP07, "Opening interface 0");
-				err = iUsbInterface0.Open(token1); // Alternate interface setting 0
-				if (err != KErrNone)
-					{
-					RDebug::Printf(
-							"<Error %d> Interface 0 could not be opened", err);
-					return TestFailed(err);
-					}
-				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP08, "Interface 0 opened");
+                OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP05, "Obtaining token for interface 0");
+                err = testDevice.Device().GetTokenForInterface(0, token1);
+                if (err != KErrNone)
+                    {
+                    RDebug::Printf(
+                            "<Error %d> Token for interface 0 could not be retrieved",
+                            err);
+                    return TestFailed(err);
+                    }
+                OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP06, "Token 1 (%d) retrieved", token1);
+                OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP07, "Opening interface 0");
+                err = iUsbInterface0.Open(token1); // Alternate interface setting 0
+                if (err != KErrNone)
+                    {
+                    RDebug::Printf(
+                            "<Error %d> Interface 0 could not be opened", err);
+                    return TestFailed(err);
+                    }
+                OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP08, "Interface 0 opened");
 
-				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP09, "Obtaining token for interface 1");
-				err = testDevice.Device().GetTokenForInterface(1, token2);
-				if (err != KErrNone)
-					{
-					RDebug::Printf(
-							"<Error %d> Token for interface 1 could not be retrieved",
-							err);
-					return TestFailed(err);
-					}
-				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP10, "Opening interface 1");
-				err = iUsbInterface1.Open(token2); // Alternate interface setting 0
-				if (err != KErrNone)
-					{
-					RDebug::Printf(
-							"<Error %d> Interface 1 could not be opened", err);
-					return TestFailed(err);
-					}
-				OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP11, "Interface 1 opened");
+                OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP09, "Obtaining token for interface 1");
+                err = testDevice.Device().GetTokenForInterface(1, token2);
+                if (err != KErrNone)
+                    {
+                    RDebug::Printf(
+                            "<Error %d> Token for interface 1 could not be retrieved",
+                            err);
+                    return TestFailed(err);
+                    }
+                OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP10, "Opening interface 1");
+                err = iUsbInterface1.Open(token2); // Alternate interface setting 0
+                if (err != KErrNone)
+                    {
+                    RDebug::Printf(
+                            "<Error %d> Interface 1 could not be opened", err);
+                    return TestFailed(err);
+                    }
+                OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP11, "Interface 1 opened");
 
-				ResumeWhenSuspending();
+                ResumeWhenSuspending();
 
-				}
-				break;
+                }
+                break;
 
-			default:
-				TestFailed(KErrCorrupt);
-				break;
-			}
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEINSERTEDL_EXIT_DUP01, this );
-		}
+            default:
+                TestFailed(KErrCorrupt);
+                break;
+            }
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEINSERTEDL_EXIT_DUP01, this );
+        }
 
-	TInt CUT_PBASE_T_USBDI_1231::Interface0ResumedL(TAny* aPtr)
-		{
+    TInt CUT_PBASE_T_USBDI_1231::Interface0ResumedL(TAny* aPtr)
+        {
         OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_INTERFACE0RESUMEDL_ENTRY, 0 );
 
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP12, "====> Interface0ResumedL entry priority = %d", RThread().Priority());
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP12, "====> Interface0ResumedL entry priority = %d", RThread().Priority());
+
+        OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP13, "-Interface 0 resumed");
+        CUT_PBASE_T_USBDI_1231* self =
+                reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr);
+        
+        TInt completionCode=self->iInterface0Watcher->CompletionCode();
+        
 
-		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP13, "-Interface 0 resumed");
-		CUT_PBASE_T_USBDI_1231* self =
-				reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr);
-		
-		TInt completionCode=self->iInterface0Watcher->CompletionCode();
-		
-		TInt testStep = self->iCaseStep;
-		OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP14, " -watcher 0 iStatus = %d <teststep %d>",completionCode, testStep);
+#ifdef OST_TRACE_COMPILER_IN_USE
+        TInt testStep = self->iCaseStep;
+#endif
+        OstTraceExt2(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP14, " -watcher 0 iStatus = %d <teststep %d>",completionCode, testStep);
            
-		self->iInterface0Resumed = ETrue;
-		
-		switch (self->iCaseStep)
-			{
+        self->iInterface0Resumed = ETrue;
+        
+        switch (self->iCaseStep)
+            {
 
-			case EValidResumeWhenSuspending:
-				{
-				if (completionCode == KErrNone)
-				 {
-				 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP15, "Device resume while suspending succeed!");
-				 self->TimeoutIn(10);
-				 self->iCaseStep = EPassed;
-				 self->SendEp0Request();
-				 }
-				else
-					{
-					RDebug::Printf(
-							"Device resume while suspending failed,<err %d>",
-							completionCode);
-					self->iCaseStep = EFailed;
-					self->SendEp0Request();
-					}
-				}
-				break;
+            case EValidResumeWhenSuspending:
+                {
+                if (completionCode == KErrNone)
+                 {
+                 OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP15, "Device resume while suspending succeed!");
+                 self->TimeoutIn(10);
+                 self->iCaseStep = EPassed;
+                 self->SendEp0Request();
+                 }
+                else
+                    {
+                    RDebug::Printf(
+                            "Device resume while suspending failed,<err %d>",
+                            completionCode);
+                    self->iCaseStep = EFailed;
+                    self->SendEp0Request();
+                    }
+                }
+                break;
 
-			default:
-				break;
-			};
+            default:
+                break;
+            };
 
-		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1231_INTERFACE0RESUMEDL_EXIT, 0, KErrNone );
-		return KErrNone;
-		}
+        OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1231_INTERFACE0RESUMEDL_EXIT, 0, KErrNone );
+        return KErrNone;
+        }
 
-	TInt CUT_PBASE_T_USBDI_1231::Interface1ResumedL(TAny* aPtr)
-		{
+    TInt CUT_PBASE_T_USBDI_1231::Interface1ResumedL(TAny* aPtr)
+        {
         OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_INTERFACE1RESUMEDL_ENTRY, 0 );
 
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP16, "====> Interface1ResumedL entry priority = %d", RThread().Priority());
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP16, "====> Interface1ResumedL entry priority = %d", RThread().Priority());
 
-		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP17, "Interface 1 resumed");
-		CUT_PBASE_T_USBDI_1231* self =
-				reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr);
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP18, "watcher 1 iStatus=%d",
-				self->iInterface1Watcher->CompletionCode());
-		OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1231_INTERFACE1RESUMEDL_EXIT, 0, KErrNone );
-		return KErrNone;
-		}
+        OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP17, "Interface 1 resumed");
+        
+        CUT_PBASE_T_USBDI_1231* self = reinterpret_cast<CUT_PBASE_T_USBDI_1231*>(aPtr);
+        
+#ifdef OST_TRACE_COMPILER_IN_USE        
+        TInt status = 
+#endif        
+        self->iInterface1Watcher->CompletionCode();
+        
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP18, "watcher 1 iStatus=%d",status);
+                
+        OstTraceFunctionExitExt( CUT_PBASE_T_USBDI_1231_INTERFACE1RESUMEDL_EXIT, 0, KErrNone );
+        return KErrNone;
+        }
 
-	void CUT_PBASE_T_USBDI_1231::DeviceRemovedL(TUint aDeviceHandle)
-		{
+    void CUT_PBASE_T_USBDI_1231::DeviceRemovedL(TUint aDeviceHandle)
+        {
         OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_DEVICEREMOVEDL_ENTRY, this );
 
-		// The test device should not be removed until the test case has passed
-		// so this test case has not completed, and state this event as an error
+        // The test device should not be removed until the test case has passed
+        // so this test case has not completed, and state this event as an error
 
-		TestFailed(KErrDisconnected);
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEREMOVEDL_EXIT, this );
-		}
+        TestFailed(KErrDisconnected);
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICEREMOVEDL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::BusErrorL(TInt aError)
-		{
+    void CUT_PBASE_T_USBDI_1231::BusErrorL(TInt aError)
+        {
         OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_BUSERRORL_ENTRY, this );
 
-		// This test case handles no failiures on the bus
+        // This test case handles no failiures on the bus
 
-		TestFailed(aError);
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_BUSERRORL_EXIT, this );
-		}
+        TestFailed(aError);
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_BUSERRORL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::DeviceStateChangeL(
-			RUsbDevice::TDeviceState aPreviousState,
-			RUsbDevice::TDeviceState aNewState, TInt aCompletionCode)
-		{
-		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_DEVICESTATECHANGEL_ENTRY, this );
-		Cancel();
+    void CUT_PBASE_T_USBDI_1231::DeviceStateChangeL(
+            RUsbDevice::TDeviceState aPreviousState,
+            RUsbDevice::TDeviceState aNewState, TInt aCompletionCode)
+        {
+        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_DEVICESTATECHANGEL_ENTRY, this );
+        Cancel();
 
-		// test RInterface , the  RUsbDevice notification logic not used . 
-		OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP19, " -Device State change from %d to %d err=%d",
-				aPreviousState, aNewState, aCompletionCode);
+        // test RInterface , the  RUsbDevice notification logic not used . 
+        OstTraceExt3(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP19, " -Device State change from %d to %d err=%d",
+                aPreviousState, aNewState, aCompletionCode);
 
-		switch (iCaseStep)
-			{
-			case EValidDeviceSuspend:
-				if (aNewState == RUsbDevice::EDeviceSuspended)
-					{
-					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP20, "Device suspend!");
-					iCaseStep = EValidDeviceResume;
-					}
-				else
-					{
-					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP21, "Device suspend failed!");
-					iCaseStep = EFailed;
-					SendEp0Request();
-					}
-				break;
-			case EValidDeviceResume:
+        switch (iCaseStep)
+            {
+            case EValidDeviceSuspend:
+                if (aNewState == RUsbDevice::EDeviceSuspended)
+                    {
+                    OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP20, "Device suspend!");
+                    iCaseStep = EValidDeviceResume;
+                    }
+                else
+                    {
+                    OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP21, "Device suspend failed!");
+                    iCaseStep = EFailed;
+                    SendEp0Request();
+                    }
+                break;
+            case EValidDeviceResume:
 
-				if (aNewState == RUsbDevice::EDeviceActive)
-					{
-					OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP22, "Device resume!");
-					if (!iInterface0Resumed)
+                if (aNewState == RUsbDevice::EDeviceActive)
+                    {
+                    OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP22, "Device resume!");
+                    if (!iInterface0Resumed)
                         {
                         iCaseStep = EValidResumeWhenSuspending;
                         }
-					else
-					    {
-					    iCaseStep = EPassed;
-					    SendEp0Request();
-					    }
-					}
-				else
-					{					
-					iCaseStep = EFailed;
-					SendEp0Request();
-					}
+                    else
+                        {
+                        iCaseStep = EPassed;
+                        SendEp0Request();
+                        }
+                    }
+                else
+                    {                    
+                    iCaseStep = EFailed;
+                    SendEp0Request();
+                    }
 
-				break;
-			default:
-				break;
-			}
+                break;
+            default:
+                break;
+            }
 
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICESTATECHANGEL_EXIT, this );
-		}
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICESTATECHANGEL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::Ep0TransferCompleteL(TInt aCompletionCode)
-		{
-		OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_EP0TRANSFERCOMPLETEL_ENTRY, this );
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP23, "Ep0TransferCompleteL with aCompletionCode = %d",
-				aCompletionCode);
-		switch (iCaseStep)
-			{
+    void CUT_PBASE_T_USBDI_1231::Ep0TransferCompleteL(TInt aCompletionCode)
+        {
+        OstTraceFunctionEntryExt( CUT_PBASE_T_USBDI_1231_EP0TRANSFERCOMPLETEL_ENTRY, this );
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP23, "Ep0TransferCompleteL with aCompletionCode = %d",
+                aCompletionCode);
+        switch (iCaseStep)
+            {
 
-			default:
-			case EFailed:
-				TestFailed(KErrCompletion);
-				break;
+            default:
+            case EFailed:
+                TestFailed(KErrCompletion);
+                break;
 
-			case EPassed:
-				TestPassed();
-				break;
-			}
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EP0TRANSFERCOMPLETEL_EXIT, this );
-		}
+            case EPassed:
+                TestPassed();
+                break;
+            }
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_EP0TRANSFERCOMPLETEL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::HostRunL()
-		{
+    void CUT_PBASE_T_USBDI_1231::HostRunL()
+        {
         OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_HOSTRUNL_ENTRY, this );
 
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP24, "====> HostRunL entry priority = %d", RThread().Priority());
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP24, "====> HostRunL entry priority = %d", RThread().Priority());
 
-		// Obtain the completion code
-		TInt completionCode(iStatus.Int());
+        // Obtain the completion code
+        TInt completionCode(iStatus.Int());
 
-		if (completionCode == KErrNone)
-			{
-			// Action timeout
-			OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP25, "<Error> Action timeout");
-			TestFailed(KErrTimedOut);
-			}
-		else
-			{
-			OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP26, "<Error %d> Timeout timer could not complete",
-					completionCode);
-			TestFailed(completionCode);
-			}
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_HOSTRUNL_EXIT, this );
-		}
+        if (completionCode == KErrNone)
+            {
+            // Action timeout
+            OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP25, "<Error> Action timeout");
+            TestFailed(KErrTimedOut);
+            }
+        else
+            {
+            OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP26, "<Error %d> Timeout timer could not complete",
+                    completionCode);
+            TestFailed(completionCode);
+            }
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_HOSTRUNL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::DeviceRunL()
-		{
+    void CUT_PBASE_T_USBDI_1231::DeviceRunL()
+        {
         OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_DEVICERUNL_ENTRY, this );
 
-		// Disconnect the device
+        // Disconnect the device
 
-		iTestDevice->SoftwareDisconnect();
+        iTestDevice->SoftwareDisconnect();
 
-		// Complete the test case request
+        // Complete the test case request
 
-		TestPolicy().SignalTestComplete(iStatus.Int());
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICERUNL_EXIT, this );
-		}
+        TestPolicy().SignalTestComplete(iStatus.Int());
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_DEVICERUNL_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::ResumeWhenSuspending()
-		{
-		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_RESUMEWHENSUSPENDING_ENTRY, this );
-		OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP27, "====> ResumeWhenSuspending entry priority = %d",
-				RThread().Priority());
+    void CUT_PBASE_T_USBDI_1231::ResumeWhenSuspending()
+        {
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_RESUMEWHENSUSPENDING_ENTRY, this );
+        OstTrace1(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP27, "====> ResumeWhenSuspending entry priority = %d",
+                RThread().Priority());
 
-		// Suspend interface 0
-		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP28, "Suspending interface 0");
-		iInterface0Watcher->SuspendAndWatch();
+        // Suspend interface 0
+        OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP28, "Suspending interface 0");
+        iInterface0Watcher->SuspendAndWatch();
 
-		// Suspend interface 1
-		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP29, "Suspending interface 1");
-		iInterface1Watcher->SuspendAndWatch();
+        // Suspend interface 1
+        OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP29, "Suspending interface 1");
+        iInterface1Watcher->SuspendAndWatch();
 
-		// Cancel suspend-in-progress
-		OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP30, "Cancel Suspend interface 0");
-		iUsbInterface0.CancelPermitSuspend();
+        // Cancel suspend-in-progress
+        OstTrace0(TRACE_NORMAL, CUT_PBASE_T_USBDI_1231_DCUT_PBASE_T_USBDI_1231_DUP30, "Cancel Suspend interface 0");
+        iUsbInterface0.CancelPermitSuspend();
 
-		iCaseStep = EValidDeviceSuspend;
+        iCaseStep = EValidDeviceSuspend;
 
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_RESUMEWHENSUSPENDING_EXIT, this );
-		}
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_RESUMEWHENSUSPENDING_EXIT, this );
+        }
 
-	void CUT_PBASE_T_USBDI_1231::SendEp0Request()
-		{
-		OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_SENDEP0REQUEST_ENTRY, this );
-		TTestCasePassed request;
-		iControlEp0->SendRequest(request, this);
-		OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_SENDEP0REQUEST_EXIT, this );
-		}
+    void CUT_PBASE_T_USBDI_1231::SendEp0Request()
+        {
+        OstTraceFunctionEntry1( CUT_PBASE_T_USBDI_1231_SENDEP0REQUEST_ENTRY, this );
+        TTestCasePassed request;
+        iControlEp0->SendRequest(request, this);
+        OstTraceFunctionExit1( CUT_PBASE_T_USBDI_1231_SENDEP0REQUEST_EXIT, this );
+        }
 
-	}//end namespace
+    }//end namespace
 
 
--- a/kerneltest/e32test/usbho/t_usbdi/src/TestDeviceBase.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/src/TestDeviceBase.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -32,61 +32,61 @@
 #include <e32property.h>
 
 namespace NUnitTesting_USBDI
-	{
+    {
 
 RUsbTestDevice::RUsbTestDevice()
-: 	iStateWatcher(NULL), 
-	iCurrentState(EUsbcDeviceStateUndefined), 
-	iDeviceEp0(NULL), 
-	iConnectTimer(NULL), iWakeupTimer(NULL),
-	iAuxBuffer(NULL)
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_RUSBTESTDEVICE_ENTRY, this );
-	OstTraceFunctionExit1( RUSBTESTDEVICE_RUSBTESTDEVICE_EXIT, this );
-	}
-	
+:     iStateWatcher(NULL), 
+    iCurrentState(EUsbcDeviceStateUndefined), 
+    iDeviceEp0(NULL), 
+    iConnectTimer(NULL), iWakeupTimer(NULL),
+    iAuxBuffer(NULL)
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_RUSBTESTDEVICE_ENTRY, this );
+    OstTraceFunctionExit1( RUSBTESTDEVICE_RUSBTESTDEVICE_EXIT, this );
+    }
+    
 RUsbTestDevice::RUsbTestDevice(CBaseTestCase* aTestCase)
-: 	iStateWatcher(NULL), 
-	iCurrentState(EUsbcDeviceStateUndefined), 
-	iDeviceEp0(NULL), 
-	iConnectTimer(NULL), iWakeupTimer(NULL),
-	iAuxBuffer(NULL)
-	{
-	OstTraceFunctionEntryExt( RUSBTESTDEVICE_RUSBTESTDEVICE_ENTRY_DUP01, this );
-	iTestCase = aTestCase;
-	OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_RUSBTESTDEVICE, "iTestCase = %d", iTestCase);
-	OstTraceFunctionExit1( RUSBTESTDEVICE_RUSBTESTDEVICE_EXIT_DUP01, this );
-	}
-		
+:     iStateWatcher(NULL), 
+    iCurrentState(EUsbcDeviceStateUndefined), 
+    iDeviceEp0(NULL), 
+    iConnectTimer(NULL), iWakeupTimer(NULL),
+    iAuxBuffer(NULL)
+    {
+    OstTraceFunctionEntryExt( RUSBTESTDEVICE_RUSBTESTDEVICE_ENTRY_DUP01, this );
+    iTestCase = aTestCase;
+    OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_RUSBTESTDEVICE, "iTestCase = %d", iTestCase);
+    OstTraceFunctionExit1( RUSBTESTDEVICE_RUSBTESTDEVICE_EXIT_DUP01, this );
+    }
+        
 void RUsbTestDevice::ResetState()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_RESETSTATE_ENTRY, this );
-	iCurrentState = EUsbcDeviceStateUndefined;
-	OstTraceFunctionExit1( RUSBTESTDEVICE_RESETSTATE_EXIT, this );
-	}
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_RESETSTATE_ENTRY, this );
+    iCurrentState = EUsbcDeviceStateUndefined;
+    OstTraceFunctionExit1( RUSBTESTDEVICE_RESETSTATE_EXIT, this );
+    }
 
 RUsbTestDevice::~RUsbTestDevice()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_RUSBTESTDEVICE_ENTRY_DUP02, this );
-	
-	OstTraceFunctionExit1( RUSBTESTDEVICE_RUSBTESTDEVICE_EXIT_DUP02, this );
-	}
-	
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_RUSBTESTDEVICE_ENTRY_DUP02, this );
+    
+    OstTraceFunctionExit1( RUSBTESTDEVICE_RUSBTESTDEVICE_EXIT_DUP02, this );
+    }
+    
 void RUsbTestDevice::Close()
-	{
+    {
 OstTraceFunctionEntry1( RUSBTESTDEVICE_CLOSE_ENTRY, this );
 
-	delete iWakeupTimer;
-	delete iConnectTimer;
-	delete iDeviceEp0;
-	delete iStateWatcher;
-		
-	iInterfaces.ResetAndDestroy();
+    delete iWakeupTimer;
+    delete iConnectTimer;
+    delete iDeviceEp0;
+    delete iStateWatcher;
+        
+    iInterfaces.ResetAndDestroy();
 
-	iClientDriver.Close(); 
-	
-	if(!iTestCase->IsHost()) // process only started in client rom
-		{
+    iClientDriver.Close(); 
+    
+    if(!iTestCase->IsHost()) // process only started in client rom
+        {
         // create a publish/subscribe key to allow usbhost_usbman to be killed
         // cleanly
         static const TUid KWordOfDeathCat = {0x01066600};
@@ -97,637 +97,642 @@
             {
             OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_CLOSE, "Could not create the WordOfDeath P&S   (%d)", r);
             }
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_CLOSE_DUP01, "killing t_usbhost_usbman.exe");
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_CLOSE_DUP01, "killing t_usbhost_usbman.exe");
         RProperty::Set(KWordOfDeathCat, KWordOfDeathKey, KErrAbort);   // Send the word of death
         User::After(1000000); //allow time for t_usbhost_usbman.exe to clean up
-		}
-	OstTraceFunctionExit1( RUSBTESTDEVICE_CLOSE_EXIT, this );
-	}
+        }
+    OstTraceFunctionExit1( RUSBTESTDEVICE_CLOSE_EXIT, this );
+    }
 
 
 void RUsbTestDevice::SubscribeToReports(TRequestStatus& aObserverStatus)
-	{
-	OstTraceFunctionEntryExt( RUSBTESTDEVICE_SUBSCRIBETOREPORTS_ENTRY, this );
-	
-	// Signal the request as pending
-	
-	iObserverStatus = &aObserverStatus;
-	*iObserverStatus = KRequestPending;
-	OstTraceFunctionExit1( RUSBTESTDEVICE_SUBSCRIBETOREPORTS_EXIT, this );
-	}
+    {
+    OstTraceFunctionEntryExt( RUSBTESTDEVICE_SUBSCRIBETOREPORTS_ENTRY, this );
+    
+    // Signal the request as pending
+    
+    iObserverStatus = &aObserverStatus;
+    *iObserverStatus = KRequestPending;
+    OstTraceFunctionExit1( RUSBTESTDEVICE_SUBSCRIBETOREPORTS_EXIT, this );
+    }
 
 
 void RUsbTestDevice::CancelSubscriptionToReports()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_CANCELSUBSCRIPTIONTOREPORTS_ENTRY, this );
-	
-	// Signal the request as cancelled
-	User::RequestComplete(iObserverStatus,KErrCancel);
-	OstTraceFunctionExit1( RUSBTESTDEVICE_CANCELSUBSCRIPTIONTOREPORTS_EXIT, this );
-	}
-	
-		
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_CANCELSUBSCRIPTIONTOREPORTS_ENTRY, this );
+    
+    // Signal the request as cancelled
+    User::RequestComplete(iObserverStatus,KErrCancel);
+    OstTraceFunctionExit1( RUSBTESTDEVICE_CANCELSUBSCRIPTIONTOREPORTS_EXIT, this );
+    }
+    
+        
 void RUsbTestDevice::OpenL()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_OPENL_ENTRY, this );
-	TInt err = KErrNone;
-	
-	OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_OPENL, "starting t_usbhost_usbman.exe");
-	TInt r = iOtgUsbMan.Create(_L("t_usbhost_usbman.exe"), _L("client"));
-	gtest(r == KErrNone);
-	iOtgUsbMan.Resume();	
-	
-	User::After(1500000);
-	
-	// Open channel to driver
-	err = iClientDriver.Open(0);
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP01, "<Error %d> Unable to open a channel to USB client driver",err);
-		User::Leave(err);
-		}
-	
-	// Hide bus from host while interfaces are being set up
-	err = iClientDriver.DeviceDisconnectFromHost();
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP02, "<Error %d> unable to disconnect device from host",err);
-		User::Leave(err);
-		}
-	
-	// Create the client usb state watcher
-	iStateWatcher = CUsbClientStateWatcher::NewL(iClientDriver,*this);
-		
-	// Create the Ep0 reader
-	iDeviceEp0 = CDeviceEndpoint0::NewL(*this);
-		
-	// Create the timer for software connection/disconnection
-	iConnectTimer = CSoftwareConnectTimer::NewL(*this);
-	
-	// Create the timer for remote wakeup events
-	iWakeupTimer = CRemoteWakeupTimer::NewL(*this);
-	_LIT8(KYes, "yes");
-	_LIT8(KNo, "no");
-	User::LeaveIfError(iClientDriver.DeviceCaps(iDeviceCaps));
- 	OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP03, "------ USB device capabilities -------");
-	OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP04, "Number of endpoints:                %d",iDeviceCaps().iTotalEndpoints);	
-	OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP05, "Supports Software-Connect:          %s",iDeviceCaps().iConnect ? KYes() : KNo());
-	OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP06, "Device is Self-Powered:             %S",iDeviceCaps().iSelfPowered ? KYes() : KNo());
-	OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP07, "Supports Remote-Wakeup:             %S",iDeviceCaps().iRemoteWakeup ? KYes() : KNo());
-	OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP08, "Supports High-speed:                %S",iDeviceCaps().iHighSpeed ? KYes() : KNo());
-	OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP09, "Supports unpowered cable detection: %S",(iDeviceCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? KYes() : KNo());
-	OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP10, "--------------------------------------");
-	
-	OstTraceFunctionExit1( RUSBTESTDEVICE_OPENL_EXIT, this );
-	}
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_OPENL_ENTRY, this );
+    TInt err = KErrNone;
+    
+    OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_OPENL, "starting t_usbhost_usbman.exe");
+    TInt r = iOtgUsbMan.Create(_L("t_usbhost_usbman.exe"), _L("client"));
+    gtest(r == KErrNone);
+    iOtgUsbMan.Resume();    
+    
+    User::After(1500000);
+    
+    // Open channel to driver
+    err = iClientDriver.Open(0);
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP01, "<Error %d> Unable to open a channel to USB client driver",err);
+        User::Leave(err);
+        }
+    
+    // Hide bus from host while interfaces are being set up
+    err = iClientDriver.DeviceDisconnectFromHost();
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP02, "<Error %d> unable to disconnect device from host",err);
+        User::Leave(err);
+        }
+    
+    // Create the client usb state watcher
+    iStateWatcher = CUsbClientStateWatcher::NewL(iClientDriver,*this);
+        
+    // Create the Ep0 reader
+    iDeviceEp0 = CDeviceEndpoint0::NewL(*this);
+        
+    // Create the timer for software connection/disconnection
+    iConnectTimer = CSoftwareConnectTimer::NewL(*this);
+    
+    // Create the timer for remote wakeup events
+    iWakeupTimer = CRemoteWakeupTimer::NewL(*this);
+
+    User::LeaveIfError(iClientDriver.DeviceCaps(iDeviceCaps));
+
+#ifdef OST_TRACE_COMPILER_IN_USE
+    _LIT8(KYes, "yes");
+    _LIT8(KNo, "no");
+#endif
+    
+     OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP03, "------ USB device capabilities -------");
+    OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP04, "Number of endpoints:                %d",iDeviceCaps().iTotalEndpoints);    
+    OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP05, "Supports Software-Connect:          %s",iDeviceCaps().iConnect ? KYes() : KNo());
+    OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP06, "Device is Self-Powered:             %S",iDeviceCaps().iSelfPowered ? KYes() : KNo());
+    OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP07, "Supports Remote-Wakeup:             %S",iDeviceCaps().iRemoteWakeup ? KYes() : KNo());
+    OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP08, "Supports High-speed:                %S",iDeviceCaps().iHighSpeed ? KYes() : KNo());
+    OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP09, "Supports unpowered cable detection: %S",(iDeviceCaps().iFeatureWord1 & KUsbDevCapsFeatureWord1_CableDetectWithoutPower) ? KYes() : KNo());
+    OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_OPENL_DUP10, "--------------------------------------");
+    
+    OstTraceFunctionExit1( RUSBTESTDEVICE_OPENL_EXIT, this );
+    }
 
 
 TInt RUsbTestDevice::SetClassCode(TUint8 aClassCode,TUint8 aSubClassCode,TUint8 aDeviceProtocol)
-	{
+    {
     OstTraceFunctionEntryExt( RUSBTESTDEVICE_SETCLASSCODE_ENTRY, this );
 
-	// Get Device descriptor
-	TBuf8<KUsbDescSize_Device> deviceDescriptor;
-	TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETCLASSCODE, "<Error %d> Unable to obtain device descriptor",err);
-		}
-	else
-		{
-		deviceDescriptor[KDevDescOffset_bDeviceClass] = aClassCode;
-		deviceDescriptor[KDevDescOffset_bDeviceSubClass] = aSubClassCode;
-		deviceDescriptor[KDevDescOffset_bDeviceProtocol] = aDeviceProtocol;	
-		
-		err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETCLASSCODE_DUP01, "<Error %d> Unable to set the device dsecriptor",err);
-			}
-		}
-	OstTraceFunctionExitExt( RUSBTESTDEVICE_SETCLASSCODE_EXIT, this, err );
-	return err;
-	}
+    // Get Device descriptor
+    TBuf8<KUsbDescSize_Device> deviceDescriptor;
+    TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETCLASSCODE, "<Error %d> Unable to obtain device descriptor",err);
+        }
+    else
+        {
+        deviceDescriptor[KDevDescOffset_bDeviceClass] = aClassCode;
+        deviceDescriptor[KDevDescOffset_bDeviceSubClass] = aSubClassCode;
+        deviceDescriptor[KDevDescOffset_bDeviceProtocol] = aDeviceProtocol;    
+        
+        err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETCLASSCODE_DUP01, "<Error %d> Unable to set the device dsecriptor",err);
+            }
+        }
+    OstTraceFunctionExitExt( RUSBTESTDEVICE_SETCLASSCODE_EXIT, this, err );
+    return err;
+    }
 
 
 TInt RUsbTestDevice::SetUsbSpecification(TUint16 aSpecification)
-	{
+    {
     OstTraceFunctionEntryExt( RUSBTESTDEVICE_SETUSBSPECIFICATION_ENTRY, this );
 
-	// Get Device descriptor
-	TBuf8<KUsbDescSize_Device> deviceDescriptor;
-	TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETUSBSPECIFICATION, "<Error %d> Unable to obtain device descriptor",err);
-		}
-	else
-		{
-		// Set bcdUSB
-		TUint8* p = reinterpret_cast<TUint8*>(&aSpecification);
-		deviceDescriptor[KDevDescOffset_bcdUSB] = *p;
-		deviceDescriptor[KDevDescOffset_bcdUSB+1] = *(p+1);
-		
-		// Symbian currently supports only devices with one configuration by selecting the configurations
-		// that has the lowest power consumption
-		
-		deviceDescriptor[KDevDescOffset_bNumConfigurations] = 0x01;
-		
-		err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETUSBSPECIFICATION_DUP01, "<Error %d> Unable to set the device dsecriptor",err);
-			}
-		}
-	OstTraceFunctionExitExt( RUSBTESTDEVICE_SETUSBSPECIFICATION_EXIT, this, err );
-	return err;
-	}
+    // Get Device descriptor
+    TBuf8<KUsbDescSize_Device> deviceDescriptor;
+    TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETUSBSPECIFICATION, "<Error %d> Unable to obtain device descriptor",err);
+        }
+    else
+        {
+        // Set bcdUSB
+        TUint8* p = reinterpret_cast<TUint8*>(&aSpecification);
+        deviceDescriptor[KDevDescOffset_bcdUSB] = *p;
+        deviceDescriptor[KDevDescOffset_bcdUSB+1] = *(p+1);
+        
+        // Symbian currently supports only devices with one configuration by selecting the configurations
+        // that has the lowest power consumption
+        
+        deviceDescriptor[KDevDescOffset_bNumConfigurations] = 0x01;
+        
+        err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETUSBSPECIFICATION_DUP01, "<Error %d> Unable to set the device dsecriptor",err);
+            }
+        }
+    OstTraceFunctionExitExt( RUSBTESTDEVICE_SETUSBSPECIFICATION_EXIT, this, err );
+    return err;
+    }
 
 
 TInt RUsbTestDevice::SetVendor(TUint16 aVendorId)
-	{
+    {
     OstTraceFunctionEntryExt( RUSBTESTDEVICE_SETVENDOR_ENTRY, this );
 
-	// Get Device descriptor
-	TBuf8<KUsbDescSize_Device> deviceDescriptor;
-	TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETVENDOR, "<Error %d> Unable to obtain device descriptor",err);
-		}
-	else
-		{
-		// Set VID
-		TUint8* p = reinterpret_cast<TUint8*>(&aVendorId);
-		deviceDescriptor[KDevDescOffset_idVendor] = *p;
-		deviceDescriptor[KDevDescOffset_idVendor+1] = *(p+1);
-		
-		err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETVENDOR_DUP01, "<Error %d> Unable to set the device descriptor",err);
-			}
-		}
-	OstTraceFunctionExitExt( RUSBTESTDEVICE_SETVENDOR_EXIT, this, err );
-	return err;
-	}
+    // Get Device descriptor
+    TBuf8<KUsbDescSize_Device> deviceDescriptor;
+    TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETVENDOR, "<Error %d> Unable to obtain device descriptor",err);
+        }
+    else
+        {
+        // Set VID
+        TUint8* p = reinterpret_cast<TUint8*>(&aVendorId);
+        deviceDescriptor[KDevDescOffset_idVendor] = *p;
+        deviceDescriptor[KDevDescOffset_idVendor+1] = *(p+1);
+        
+        err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETVENDOR_DUP01, "<Error %d> Unable to set the device descriptor",err);
+            }
+        }
+    OstTraceFunctionExitExt( RUSBTESTDEVICE_SETVENDOR_EXIT, this, err );
+    return err;
+    }
 
 
 TInt RUsbTestDevice::SetProduct(TUint16 aProductId,const TDesC16& aProductString,
-				const TDesC16& aManufacturerString,const TDesC16& aSerialNumberString)
-	{
+                const TDesC16& aManufacturerString,const TDesC16& aSerialNumberString)
+    {
     OstTraceFunctionEntryExt( RUSBTESTDEVICE_SETPRODUCT_ENTRY, this );
 
-	// Get Device descriptor
-	TBuf8<KUsbDescSize_Device> deviceDescriptor;
-	TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT, "<Error %d> Unable to obtain device descriptor",err);
-		}
-	else
-		{
-		// Set PID
-		TUint8* p = reinterpret_cast<TUint8*>(&aProductId);
-		deviceDescriptor[KDevDescOffset_idProduct] = *p;
-		deviceDescriptor[KDevDescOffset_idProduct+1] = *(p+1);
-		
-		err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP01, "<Error %d> Unable to set the device dsecriptor",err);
-			OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT, this, err );
-			return err;
-			}
-		
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP02, "Product Identity set");
-	
-		// Product string
-		err = iClientDriver.SetProductStringDescriptor(aProductString);
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP03, "<Error %d> Unable to set product string descriptor",err);
-			OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP01, this, err );
-			return err;
-			}
+    // Get Device descriptor
+    TBuf8<KUsbDescSize_Device> deviceDescriptor;
+    TInt err(iClientDriver.GetDeviceDescriptor(deviceDescriptor));
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT, "<Error %d> Unable to obtain device descriptor",err);
+        }
+    else
+        {
+        // Set PID
+        TUint8* p = reinterpret_cast<TUint8*>(&aProductId);
+        deviceDescriptor[KDevDescOffset_idProduct] = *p;
+        deviceDescriptor[KDevDescOffset_idProduct+1] = *(p+1);
+        
+        err = iClientDriver.SetDeviceDescriptor(deviceDescriptor);
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP01, "<Error %d> Unable to set the device dsecriptor",err);
+            OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT, this, err );
+            return err;
+            }
+        
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP02, "Product Identity set");
+    
+        // Product string
+        err = iClientDriver.SetProductStringDescriptor(aProductString);
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP03, "<Error %d> Unable to set product string descriptor",err);
+            OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP01, this, err );
+            return err;
+            }
 
-		// Manufacturer string
-		err = iClientDriver.SetManufacturerStringDescriptor(aManufacturerString);
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP04, "<Error %d> Unable to set the manufacturer string descriptor",err);
-			OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP02, this, err );
-			return err;
-			}
-	
-		// Serial number string
-		err = iClientDriver.SetSerialNumberStringDescriptor(aSerialNumberString);
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP05, "<Error %d> Unable to set the serial number string descriptor",err);
-			OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP03, this, err );
-			return err;
-			}
-		}
-	OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP04, this, KErrNone );
-	return KErrNone;
-	}
+        // Manufacturer string
+        err = iClientDriver.SetManufacturerStringDescriptor(aManufacturerString);
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP04, "<Error %d> Unable to set the manufacturer string descriptor",err);
+            OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP02, this, err );
+            return err;
+            }
+    
+        // Serial number string
+        err = iClientDriver.SetSerialNumberStringDescriptor(aSerialNumberString);
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETPRODUCT_DUP05, "<Error %d> Unable to set the serial number string descriptor",err);
+            OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP03, this, err );
+            return err;
+            }
+        }
+    OstTraceFunctionExitExt( RUSBTESTDEVICE_SETPRODUCT_EXIT_DUP04, this, KErrNone );
+    return KErrNone;
+    }
 
 
 TInt RUsbTestDevice::SetConfigurationString(const TDesC16& aConfigString)
-	{
+    {
     OstTraceFunctionEntryExt( RUSBTESTDEVICE_SETCONFIGURATIONSTRING_ENTRY, this );
 
-	TInt err(iClientDriver.SetConfigurationStringDescriptor(aConfigString));
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETCONFIGURATIONSTRING, "<Error %d> Unable to set configuration string descriptor",err);
-		}
-	OstTraceFunctionExitExt( RUSBTESTDEVICE_SETCONFIGURATIONSTRING_EXIT, this, err );
-	return err;
-	}
+    TInt err(iClientDriver.SetConfigurationStringDescriptor(aConfigString));
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SETCONFIGURATIONSTRING, "<Error %d> Unable to set configuration string descriptor",err);
+        }
+    OstTraceFunctionExitExt( RUSBTESTDEVICE_SETCONFIGURATIONSTRING_EXIT, this, err );
+    return err;
+    }
 
 
 void RUsbTestDevice::AddInterface(CInterfaceBase* aInterface)
-	{
-	OstTraceFunctionEntryExt( RUSBTESTDEVICE_ADDINTERFACE_ENTRY, this );
-		
-	// Add the interface to the device
-	TInt err = iInterfaces.Append(aInterface);
-	
-	if(err != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_ADDINTERFACE, "<Error %d> Unable to add interface",err);
-		return ReportError(err);
-		}
-	OstTraceFunctionExit1( RUSBTESTDEVICE_ADDINTERFACE_EXIT, this );
-	}
+    {
+    OstTraceFunctionEntryExt( RUSBTESTDEVICE_ADDINTERFACE_ENTRY, this );
+        
+    // Add the interface to the device
+    TInt err = iInterfaces.Append(aInterface);
+    
+    if(err != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_ADDINTERFACE, "<Error %d> Unable to add interface",err);
+        return ReportError(err);
+        }
+    OstTraceFunctionExit1( RUSBTESTDEVICE_ADDINTERFACE_EXIT, this );
+    }
 
 
 CInterfaceBase& RUsbTestDevice::Interface(TInt aIndex)
-	{
-	OstTraceFunctionEntryExt( RUSBTESTDEVICE_INTERFACE_ENTRY, this );
-	OstTraceFunctionExit1( RUSBTESTDEVICE_INTERFACE_EXIT, this );
-	return *iInterfaces[aIndex];
-	}
+    {
+    OstTraceFunctionEntryExt( RUSBTESTDEVICE_INTERFACE_ENTRY, this );
+    OstTraceFunctionExit1( RUSBTESTDEVICE_INTERFACE_EXIT, this );
+    return *iInterfaces[aIndex];
+    }
 
 
 void RUsbTestDevice::SoftwareConnect()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_SOFTWARECONNECT_ENTRY, this );
-	TInt err(iClientDriver.PowerUpUdc());
-	if((err != KErrNone) && (err != KErrNotReady))
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWARECONNECT, "<Error %d> Power Up Udc",err);
-		ReportError(err);
-		}
-		
-	if(iDeviceCaps().iConnect) 
-		{
-		err = iClientDriver.DeviceConnectToHost();
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWARECONNECT_DUP01, "<Error %d> Unable to connect to the host",err);
-			ReportError(err);
-			}
-		}
-	else
-		{
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWARECONNECT_DUP02, "Please connect device to Host");
-		}	
-	OstTraceFunctionExit1( RUSBTESTDEVICE_SOFTWARECONNECT_EXIT, this );
-	}   	
-	 
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_SOFTWARECONNECT_ENTRY, this );
+    TInt err(iClientDriver.PowerUpUdc());
+    if((err != KErrNone) && (err != KErrNotReady))
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWARECONNECT, "<Error %d> Power Up Udc",err);
+        ReportError(err);
+        }
+        
+    if(iDeviceCaps().iConnect) 
+        {
+        err = iClientDriver.DeviceConnectToHost();
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWARECONNECT_DUP01, "<Error %d> Unable to connect to the host",err);
+            ReportError(err);
+            }
+        }
+    else
+        {
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWARECONNECT_DUP02, "Please connect device to Host");
+        }    
+    OstTraceFunctionExit1( RUSBTESTDEVICE_SOFTWARECONNECT_EXIT, this );
+    }       
+     
 void RUsbTestDevice::SoftwareDisconnect()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_SOFTWAREDISCONNECT_ENTRY, this );
-	
-	if(iDeviceCaps().iConnect) 
-		{
-		TInt err(iClientDriver.DeviceDisconnectFromHost());
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWAREDISCONNECT, "<Error %d> Unable to disconnect from the host",err);
-			ReportError(err);
-			}
-		}
-	else
-		{
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWAREDISCONNECT_DUP01, "Please disconnect device from Host");
-		}
-		
-	OstTraceFunctionExit1( RUSBTESTDEVICE_SOFTWAREDISCONNECT_EXIT, this );
-	}       
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_SOFTWAREDISCONNECT_ENTRY, this );
+    
+    if(iDeviceCaps().iConnect) 
+        {
+        TInt err(iClientDriver.DeviceDisconnectFromHost());
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWAREDISCONNECT, "<Error %d> Unable to disconnect from the host",err);
+            ReportError(err);
+            }
+        }
+    else
+        {
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_SOFTWAREDISCONNECT_DUP01, "Please disconnect device from Host");
+        }
+        
+    OstTraceFunctionExit1( RUSBTESTDEVICE_SOFTWAREDISCONNECT_EXIT, this );
+    }       
 
 
 void RUsbTestDevice::RemoteWakeup()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_REMOTEWAKEUP_ENTRY, this );
-	if(iDeviceCaps().iConnect) 
-		{
-		TInt err(iClientDriver.SignalRemoteWakeup());
-		if(err != KErrNone)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_REMOTEWAKEUP, "<Error %d> Unable to perform a remote wakeup",err);
-			ReportError(err);
-			}
-		}
-	else
-		{
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_REMOTEWAKEUP_DUP01, "remote wakeup not supported");
-		}
-	OstTraceFunctionExit1( RUSBTESTDEVICE_REMOTEWAKEUP_EXIT, this );
-	}
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_REMOTEWAKEUP_ENTRY, this );
+    if(iDeviceCaps().iConnect) 
+        {
+        TInt err(iClientDriver.SignalRemoteWakeup());
+        if(err != KErrNone)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_REMOTEWAKEUP, "<Error %d> Unable to perform a remote wakeup",err);
+            ReportError(err);
+            }
+        }
+    else
+        {
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_REMOTEWAKEUP_DUP01, "remote wakeup not supported");
+        }
+    OstTraceFunctionExit1( RUSBTESTDEVICE_REMOTEWAKEUP_EXIT, this );
+    }
 
 
 TInt RUsbTestDevice::ProcessRequestL(TUint8 aRequest,TUint16 aValue,TUint16 aIndex,
-	TUint16 aDataReqLength,const TDesC8& aPayload)
-	{
-	OstTraceFunctionEntryExt( RUSBTESTDEVICE_PROCESSREQUESTL_ENTRY, this );
-	
-	if(aRequest == KVendorEmptyRequest)
-		{
-		// Handle an empty request (i.e. do nothing)
-		
-		AcknowledgeRequestReceived();
-		}
-	else if(aRequest == KVendorReconnectRequest)
-		{
-		// Handle a reconnect requests from the host
-		
-		AcknowledgeRequestReceived();
-		iConnectTimer->SoftwareReConnect(aValue);
-		}
-	else if(aRequest == KVendorDisconnectDeviceAThenConnectDeviceCRequest)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL, "**aRequest == KVendorDisconnectDeviceAThenConnectDeviceCRequest, this = 0x%08x", this);
-		// Handle a reconnect requests from the host		
-		AcknowledgeRequestReceived();			
-		
-		SoftwareDisconnect();	
-		User::After(1000000);
-		//	connect device C now	
-		CUT_PBASE_T_USBDI_0486* iTestCaseT_USBDI_0486 = reinterpret_cast<CUT_PBASE_T_USBDI_0486*>(iTestCase);
-		Close(); 		
-		
-		User::After(3000000);
-		iTestCaseT_USBDI_0486->TestDeviceC()->OpenL(KTestDeviceC_SN);		
-		// Connect the device to the host	
-		iTestCaseT_USBDI_0486->TestDeviceC()->SoftwareConnect();
-		OstTraceFunctionExitExt( RUSBTESTDEVICE_PROCESSREQUESTL_EXIT, this, KErrAbort );
-		return KErrAbort;
-		}
-	else if(aRequest == KVendorDisconnectDeviceCThenConnectDeviceARequest)
-		{
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP01, "**aRequest == KVendorDisconnectDeviceCThenConnectDeviceARequest, this = 0x%08x", this);
-		// Handle a reconnect requests from the host		
-		AcknowledgeRequestReceived();		
-		 
-		SoftwareDisconnect();	
-		User::After(1000000); 
-		 
-		//	connect device A now	
-		CUT_PBASE_T_USBDI_0486* iTestCaseT_USBDI_0486 = reinterpret_cast<CUT_PBASE_T_USBDI_0486*>(iTestCase);
-		
-		
-		Close();		
-		User::After(3000000); 		
-		iTestCaseT_USBDI_0486->Cancel();
-		iTestCaseT_USBDI_0486->HandleDeviceDConnection();
-		iTestCaseT_USBDI_0486->TestDeviceD()->OpenL(iTestCaseT_USBDI_0486->TestCaseId());	
-		
-		// Connect the device to the host	
-		iTestCaseT_USBDI_0486->TestDeviceD()->SoftwareConnect();	
-		OstTraceFunctionExitExt( RUSBTESTDEVICE_PROCESSREQUESTL_EXIT_DUP01, this, KErrAbort );
-		return KErrAbort;
-		}		
-	else if(aRequest == KVendorTestCasePassed)
-		{ 
-		// Test case has completed successfully 
-		// so report to client test case that host is happy		
-		
-		AcknowledgeRequestReceived();
-		ReportError(KErrNone);
-		}
-	else if(aRequest == KVendorTestCaseFailed)
-		{
-		// The test case has failed, so report to client test case
-		// and display/log the error message
-		
-		AcknowledgeRequestReceived();
-		
-		HBufC16* msg = HBufC16::NewL(aPayload.Length());
-		msg->Des().Copy(aPayload);
-		OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP02, "<Host> Test case failed: %S",*msg);
-		delete msg;
-		msg = 0;
-		ReportError(-aValue);
-		}
-	else if(aRequest == KVendorRemoteWakeupRequest)
-		{
-		// Handle a remote wakeup request
+    TUint16 aDataReqLength,const TDesC8& aPayload)
+    {
+    OstTraceFunctionEntryExt( RUSBTESTDEVICE_PROCESSREQUESTL_ENTRY, this );
+    
+    if(aRequest == KVendorEmptyRequest)
+        {
+        // Handle an empty request (i.e. do nothing)
+        
+        AcknowledgeRequestReceived();
+        }
+    else if(aRequest == KVendorReconnectRequest)
+        {
+        // Handle a reconnect requests from the host
+        
+        AcknowledgeRequestReceived();
+        iConnectTimer->SoftwareReConnect(aValue);
+        }
+    else if(aRequest == KVendorDisconnectDeviceAThenConnectDeviceCRequest)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL, "**aRequest == KVendorDisconnectDeviceAThenConnectDeviceCRequest, this = 0x%08x", this);
+        // Handle a reconnect requests from the host        
+        AcknowledgeRequestReceived();            
+        
+        SoftwareDisconnect();    
+        User::After(1000000);
+        //    connect device C now    
+        CUT_PBASE_T_USBDI_0486* iTestCaseT_USBDI_0486 = reinterpret_cast<CUT_PBASE_T_USBDI_0486*>(iTestCase);
+        Close();         
+        
+        User::After(3000000);
+        iTestCaseT_USBDI_0486->TestDeviceC()->OpenL(KTestDeviceC_SN);        
+        // Connect the device to the host    
+        iTestCaseT_USBDI_0486->TestDeviceC()->SoftwareConnect();
+        OstTraceFunctionExitExt( RUSBTESTDEVICE_PROCESSREQUESTL_EXIT, this, KErrAbort );
+        return KErrAbort;
+        }
+    else if(aRequest == KVendorDisconnectDeviceCThenConnectDeviceARequest)
+        {
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP01, "**aRequest == KVendorDisconnectDeviceCThenConnectDeviceARequest, this = 0x%08x", this);
+        // Handle a reconnect requests from the host        
+        AcknowledgeRequestReceived();        
+         
+        SoftwareDisconnect();    
+        User::After(1000000); 
+         
+        //    connect device A now    
+        CUT_PBASE_T_USBDI_0486* iTestCaseT_USBDI_0486 = reinterpret_cast<CUT_PBASE_T_USBDI_0486*>(iTestCase);
+        
+        
+        Close();        
+        User::After(3000000);         
+        iTestCaseT_USBDI_0486->Cancel();
+        iTestCaseT_USBDI_0486->HandleDeviceDConnection();
+        iTestCaseT_USBDI_0486->TestDeviceD()->OpenL(iTestCaseT_USBDI_0486->TestCaseId());    
+        
+        // Connect the device to the host    
+        iTestCaseT_USBDI_0486->TestDeviceD()->SoftwareConnect();    
+        OstTraceFunctionExitExt( RUSBTESTDEVICE_PROCESSREQUESTL_EXIT_DUP01, this, KErrAbort );
+        return KErrAbort;
+        }        
+    else if(aRequest == KVendorTestCasePassed)
+        { 
+        // Test case has completed successfully 
+        // so report to client test case that host is happy        
+        
+        AcknowledgeRequestReceived();
+        ReportError(KErrNone);
+        }
+    else if(aRequest == KVendorTestCaseFailed)
+        {
+        // The test case has failed, so report to client test case
+        // and display/log the error message
+        
+        AcknowledgeRequestReceived();
+        
+        HBufC16* msg = HBufC16::NewL(aPayload.Length());
+        msg->Des().Copy(aPayload);
+        OstTraceExt1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP02, "<Host> Test case failed: %S",*msg);
+        delete msg;
+        msg = 0;
+        ReportError(-aValue);
+        }
+    else if(aRequest == KVendorRemoteWakeupRequest)
+        {
+        // Handle a remote wakeup request
 
-		AcknowledgeRequestReceived();
-		iWakeupTimer->WakeUp(aValue);
-		}
-	else if(aRequest == KVendorPutPayloadRequest)
-		{
-		// Handle a payload request from the host
+        AcknowledgeRequestReceived();
+        iWakeupTimer->WakeUp(aValue);
+        }
+    else if(aRequest == KVendorPutPayloadRequest)
+        {
+        // Handle a payload request from the host
 
-		AcknowledgeRequestReceived();
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP03, "Put payload");
-		if(aPayload.Compare(_L8("DEADBEEF")) != 0)
-			{
-			OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP04, "<Error %d> Payload not as expected",KErrCorrupt);
-			ReportError(KErrCorrupt);
-			}
-		}
-	else if(aRequest == KVendorGetPayloadRequest)
-		{
-		// Handle a payload request to the host
+        AcknowledgeRequestReceived();
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP03, "Put payload");
+        if(aPayload.Compare(_L8("DEADBEEF")) != 0)
+            {
+            OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP04, "<Error %d> Payload not as expected",KErrCorrupt);
+            ReportError(KErrCorrupt);
+            }
+        }
+    else if(aRequest == KVendorGetPayloadRequest)
+        {
+        // Handle a payload request to the host
 
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP05, "Get payload");
-		__ASSERT_DEBUG(iAuxBuffer, User::Panic(_L("Trying to write non-allocated buffer"), KErrGeneral));
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP06, "iAuxBuffer = ....");
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP05, "Get payload");
+        __ASSERT_DEBUG(iAuxBuffer, User::Panic(_L("Trying to write non-allocated buffer"), KErrGeneral));
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP06, "iAuxBuffer = ....");
         OstTraceData(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP56, "", iAuxBuffer->Ptr(), iAuxBuffer->Length());
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP07, "\n");
-		
-		//Perform synchronous write to EP0
-		//This allows the subsequent 'Read' request to
-		//take place
-		TInt ret = iDeviceEp0->SendDataSynchronous(*iAuxBuffer);
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP08, "Write (from device callback) executed with error %d", ret);
-		}
-	else if(aRequest == KVendorUnrespondRequest)
-		{
-		// Do not acknowledge this request
-		
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP09, "Unrespond request: continually NAK the host");
-		}
-	else if(aRequest == KVendorStallRequest)
-		{
-		// Stall the specified endpoint
-		
-		AcknowledgeRequestReceived();
-		OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP10, "Stalling endpoint %d",aValue);
-						
-		}
-	else
-		{
-		// Maybe forward to derived classes
-		}
-	OstTraceFunctionExitExt( RUSBTESTDEVICE_PROCESSREQUESTL_EXIT_DUP02, this, KErrNone );
-	return KErrNone;
-	}
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP07, "\n");
+        
+        //Perform synchronous write to EP0
+        //This allows the subsequent 'Read' request to
+        //take place
+        TInt ret = iDeviceEp0->SendDataSynchronous(*iAuxBuffer);
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP08, "Write (from device callback) executed with error %d", ret);
+        }
+    else if(aRequest == KVendorUnrespondRequest)
+        {
+        // Do not acknowledge this request
+        
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP09, "Unrespond request: continually NAK the host");
+        }
+    else if(aRequest == KVendorStallRequest)
+        {
+        // Stall the specified endpoint
+        
+        AcknowledgeRequestReceived();
+        OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_PROCESSREQUESTL_DUP10, "Stalling endpoint %d",aValue);
+                        
+        }
+    else
+        {
+        // Maybe forward to derived classes
+        }
+    OstTraceFunctionExitExt( RUSBTESTDEVICE_PROCESSREQUESTL_EXIT_DUP02, this, KErrNone );
+    return KErrNone;
+    }
 
 
 void RUsbTestDevice::StateChangeL(TUsbcDeviceState aNewState,TInt aChangeCompletionCode)
-	{
-	OstTraceFunctionEntryExt( RUSBTESTDEVICE_STATECHANGEL_ENTRY, this );
-	
-	OstTraceExt2(TRACE_NORMAL, RUSBTESTDEVICE_STATECHANGEL, "Client state change to %d err=%d",aNewState,aChangeCompletionCode);
-	
-	// Notify the test case of failed state change notification
-	
-	if(aChangeCompletionCode != KErrNone)
-		{
-		return ReportError(aChangeCompletionCode);
-		}
-	
-	// Check the state change
-	
-	if(iCurrentState == EUsbcDeviceStateConfigured)
-		{
-		// Device is already in a fully configured state
-		
-		if(aNewState == EUsbcDeviceStateConfigured)
-			{
-			// Do nothing as this is the current state anyway
-			}
-		else
-			{
-			// The is a state change from EUsbcDeviceStateConfigured to aNewState
-			// so stop reading from control ep0
-			
-			OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_STATECHANGEL_DUP01, "Ignoring control ep0");
-			
-			// Stop reading ep0 directed requests
-			
-			StopEp0Reading();
-			
-			// Update state
-						
-			iCurrentState = aNewState;
-			}
-		}
-	else
-		{
-		// Device is not in a fully configured state
-		
-		if(aNewState == EUsbcDeviceStateConfigured)
-			{
-			// Device has now been placed into a fully configured state by the host
-			// so start reading from control ep0
-			
-			OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_STATECHANGEL_DUP02, "Reading from control ep0");
-			
-			// Start reading ep0 directed requests
-			
-			StartEp0Reading();
-			
-			// Update state
-						
-			iCurrentState = aNewState;
-			}
-		else
-			{
-			// Just update the state
-			
-			iCurrentState = aNewState;
-			}
-		}
-				
-	// Forward the state change notification to derived classes
-	
-	OnStateChangeL(aNewState);
-	OstTraceFunctionExit1( RUSBTESTDEVICE_STATECHANGEL_EXIT, this );
-	}
-	
+    {
+    OstTraceFunctionEntryExt( RUSBTESTDEVICE_STATECHANGEL_ENTRY, this );
+    
+    OstTraceExt2(TRACE_NORMAL, RUSBTESTDEVICE_STATECHANGEL, "Client state change to %d err=%d",aNewState,aChangeCompletionCode);
+    
+    // Notify the test case of failed state change notification
+    
+    if(aChangeCompletionCode != KErrNone)
+        {
+        return ReportError(aChangeCompletionCode);
+        }
+    
+    // Check the state change
+    
+    if(iCurrentState == EUsbcDeviceStateConfigured)
+        {
+        // Device is already in a fully configured state
+        
+        if(aNewState == EUsbcDeviceStateConfigured)
+            {
+            // Do nothing as this is the current state anyway
+            }
+        else
+            {
+            // The is a state change from EUsbcDeviceStateConfigured to aNewState
+            // so stop reading from control ep0
+            
+            OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_STATECHANGEL_DUP01, "Ignoring control ep0");
+            
+            // Stop reading ep0 directed requests
+            
+            StopEp0Reading();
+            
+            // Update state
+                        
+            iCurrentState = aNewState;
+            }
+        }
+    else
+        {
+        // Device is not in a fully configured state
+        
+        if(aNewState == EUsbcDeviceStateConfigured)
+            {
+            // Device has now been placed into a fully configured state by the host
+            // so start reading from control ep0
+            
+            OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_STATECHANGEL_DUP02, "Reading from control ep0");
+            
+            // Start reading ep0 directed requests
+            
+            StartEp0Reading();
+            
+            // Update state
+                        
+            iCurrentState = aNewState;
+            }
+        else
+            {
+            // Just update the state
+            
+            iCurrentState = aNewState;
+            }
+        }
+                
+    // Forward the state change notification to derived classes
+    
+    OnStateChangeL(aNewState);
+    OstTraceFunctionExit1( RUSBTESTDEVICE_STATECHANGEL_EXIT, this );
+    }
+    
 
 void RUsbTestDevice::StartEp0Reading()
-	{
+    {
     OstTraceFunctionEntry1( RUSBTESTDEVICE_STARTEP0READING_ENTRY, this );
 
-	// Start reading device directed ep0 requests
-	
-	TInt err(iDeviceEp0->Start());
-	if(err != KErrNone)
-		{
-		return ReportError(err);
-		}
-		
-	// Start reading interface directed requests
-			
-	TInt interfaceCount(iInterfaces.Count());
-	for(TInt i=0; i<interfaceCount; i++)
-		{
-		iInterfaces[i]->StartEp0Reading();
-		}
-	OstTraceFunctionExit1( RUSBTESTDEVICE_STARTEP0READING_EXIT, this );
-	}
+    // Start reading device directed ep0 requests
+    
+    TInt err(iDeviceEp0->Start());
+    if(err != KErrNone)
+        {
+        return ReportError(err);
+        }
+        
+    // Start reading interface directed requests
+            
+    TInt interfaceCount(iInterfaces.Count());
+    for(TInt i=0; i<interfaceCount; i++)
+        {
+        iInterfaces[i]->StartEp0Reading();
+        }
+    OstTraceFunctionExit1( RUSBTESTDEVICE_STARTEP0READING_EXIT, this );
+    }
 
 
 void RUsbTestDevice::StopEp0Reading()
-	{
+    {
     OstTraceFunctionEntry1( RUSBTESTDEVICE_STOPEP0READING_ENTRY, this );
 
-	// Stop reading interface directed requests
-	
-	TInt interfaceCount(iInterfaces.Count());
-	for(TInt i=0; i<interfaceCount; i++)
-		{
-		iInterfaces[i]->StopEp0Reading();
-		}
-		
-	// Stop reading device directed requests from ep0
-			
-	TInt err(iDeviceEp0->Stop());
-	if(err != KErrNone)
-		{
-		return ReportError(err);
-		}
-	OstTraceFunctionExit1( RUSBTESTDEVICE_STOPEP0READING_EXIT, this );
-	}
+    // Stop reading interface directed requests
+    
+    TInt interfaceCount(iInterfaces.Count());
+    for(TInt i=0; i<interfaceCount; i++)
+        {
+        iInterfaces[i]->StopEp0Reading();
+        }
+        
+    // Stop reading device directed requests from ep0
+            
+    TInt err(iDeviceEp0->Stop());
+    if(err != KErrNone)
+        {
+        return ReportError(err);
+        }
+    OstTraceFunctionExit1( RUSBTESTDEVICE_STOPEP0READING_EXIT, this );
+    }
 
 
 void RUsbTestDevice::AcknowledgeRequestReceived()
-	{
-	OstTraceFunctionEntry1( RUSBTESTDEVICE_ACKNOWLEDGEREQUESTRECEIVED_ENTRY, this );
-	
-	TInt err(iDeviceEp0->Reader().Acknowledge());
-	OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_ACKNOWLEDGEREQUESTRECEIVED, "err = %d",err);
-	if(err != KErrNone)
-		{
-		ReportError(err);
-		}
-	OstTraceFunctionExit1( RUSBTESTDEVICE_ACKNOWLEDGEREQUESTRECEIVED_EXIT, this );
-	}
+    {
+    OstTraceFunctionEntry1( RUSBTESTDEVICE_ACKNOWLEDGEREQUESTRECEIVED_ENTRY, this );
+    
+    TInt err(iDeviceEp0->Reader().Acknowledge());
+    OstTrace1(TRACE_NORMAL, RUSBTESTDEVICE_ACKNOWLEDGEREQUESTRECEIVED, "err = %d",err);
+    if(err != KErrNone)
+        {
+        ReportError(err);
+        }
+    OstTraceFunctionExit1( RUSBTESTDEVICE_ACKNOWLEDGEREQUESTRECEIVED_EXIT, this );
+    }
 
 
 
 void RUsbTestDevice::ReportError(TInt aCompletionCode)
-	{
-	OstTraceFunctionEntryExt( RUSBTESTDEVICE_REPORTERROR_ENTRY, this );
-	OstTraceExt3(TRACE_NORMAL, RUSBTESTDEVICE_REPORTERROR, "err or aCompletionCode = %d, observer status = %d, KRequestPending = %d",
-			aCompletionCode, iObserverStatus->Int(), KRequestPending);
-	if(*iObserverStatus == KRequestPending)
-		{
-		OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_REPORTERROR_DUP01, "In complete request");
-		User::RequestComplete(iObserverStatus,aCompletionCode);
-		}
-	OstTraceFunctionExit1( RUSBTESTDEVICE_REPORTERROR_EXIT, this );
-	}
-	
+    {
+    OstTraceFunctionEntryExt( RUSBTESTDEVICE_REPORTERROR_ENTRY, this );
+    OstTraceExt3(TRACE_NORMAL, RUSBTESTDEVICE_REPORTERROR, "err or aCompletionCode = %d, observer status = %d, KRequestPending = %d",
+            aCompletionCode, iObserverStatus->Int(), KRequestPending);
+    if(*iObserverStatus == KRequestPending)
+        {
+        OstTrace0(TRACE_NORMAL, RUSBTESTDEVICE_REPORTERROR_DUP01, "In complete request");
+        User::RequestComplete(iObserverStatus,aCompletionCode);
+        }
+    OstTraceFunctionExit1( RUSBTESTDEVICE_REPORTERROR_EXIT, this );
+    }
+    
 
-	}
-	
+    }
+    
--- a/kerneltest/e32test/usbho/t_usbdi/t_usbhost_usbman_src/t_usbhost_usbman.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/e32test/usbho/t_usbdi/t_usbhost_usbman_src/t_usbhost_usbman.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -33,87 +33,87 @@
 TBool RunHost(RUsbOtgDriver& aOtg, TInt event);
 
 TInt E32Main()
-	{
-	OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN, "---> Main OTG Sub-Process");
+    {
+    OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN, "---> Main OTG Sub-Process");
 
-	CTrapCleanup* trapHandler = CTrapCleanup::New();
+    CTrapCleanup* trapHandler = CTrapCleanup::New();
 
-	if(!trapHandler)
-		{
-		return KErrNoMemory;
-		}
+    if(!trapHandler)
+        {
+        return KErrNoMemory;
+        }
 
-	TBool clientFlag = EFalse; // default to host
-	
-	// Process the command line option for role
-	TInt cmdLineLength(User::CommandLineLength());
+    TBool clientFlag = EFalse; // default to host
+    
+    // Process the command line option for role
+    TInt cmdLineLength(User::CommandLineLength());
 
-	if(cmdLineLength != 0)
-		{
-		HBufC* cmdLine = HBufC::NewMax(cmdLineLength);	
-		TPtr cmdLinePtr = cmdLine->Des();
-		User::CommandLine(cmdLinePtr);
-		TLex args(*cmdLine);
-		args.SkipSpace();
-		
-		// Obtain the role of this test module
-		TPtrC firstToken = args.NextToken(); // e.g. client ??
+    if(cmdLineLength != 0)
+        {
+        HBufC* cmdLine = HBufC::NewMax(cmdLineLength);    
+        TPtr cmdLinePtr = cmdLine->Des();
+        User::CommandLine(cmdLinePtr);
+        TLex args(*cmdLine);
+        args.SkipSpace();
+        
+        // Obtain the role of this test module
+        TPtrC firstToken = args.NextToken(); // e.g. client ??
 
-		if(firstToken.Compare(KArgClient) == 0)
-			{
-			clientFlag = ETrue;
+        if(firstToken.Compare(KArgClient) == 0)
+            {
+            clientFlag = ETrue;
             OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP01, "usbhost_usbman running as a Client");
-			}
-		else
-			{
-			clientFlag = EFalse;
+            }
+        else
+            {
+            clientFlag = EFalse;
             OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP02, "usbhost_usbman running as a Host");
-			}
+            }
 
-		delete cmdLine;
-		}			
+        delete cmdLine;
+        }            
 
-	TInt r = User::LoadLogicalDevice(KOtgdiLddFileName);
+    TInt r = User::LoadLogicalDevice(KOtgdiLddFileName);
 
-	if(r != KErrNone && r != KErrAlreadyExists) // persistent loading since process will be killed while it is in the loop below and doesnt unload it
-		{
-		OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN_DUP03, "   LoadLogicalDevice(KOtgdiLddFileName) error = %d", r);
-		delete trapHandler;
-		return r;		
-		}
+    if(r != KErrNone && r != KErrAlreadyExists) // persistent loading since process will be killed while it is in the loop below and doesnt unload it
+        {
+        OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN_DUP03, "   LoadLogicalDevice(KOtgdiLddFileName) error = %d", r);
+        delete trapHandler;
+        return r;        
+        }
 
-	
-	RUsbOtgDriver otg;
-	RProperty wordofdeath;
-	TRequestStatus waiting_for_death;
-	TRequestStatus status;
-	RUsbOtgDriver::TOtgEvent event;
-	TBool running = ETrue;
-	
-	OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP04, "   opening otg driver");
-	
-	r = otg.Open();
-	if(r != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN_DUP05, "   otg.Open fails %d", r);
+    
+    RUsbOtgDriver otg;
+    RProperty wordofdeath;
+    TRequestStatus waiting_for_death;
+    TRequestStatus status;
+    RUsbOtgDriver::TOtgEvent event;
+    TBool running = ETrue;
+    
+    OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP04, "   opening otg driver");
+    
+    r = otg.Open();
+    if(r != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN_DUP05, "   otg.Open fails %d", r);
         goto Abort;
-		}
+        }
 
-	OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP06, "   otg driver successfully opened");
+    OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP06, "   otg driver successfully opened");
 
-	OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP07, "   otg : starting stacks now");
-	
-	r = otg.StartStacks();
+    OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP07, "   otg : starting stacks now");
+    
+    r = otg.StartStacks();
 
-	if(r != KErrNone)
-		{
-		OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN_DUP08, "   otg.StartStacks fails %d", r);
+    if(r != KErrNone)
+        {
+        OstTrace1(TRACE_NORMAL, E32MAIN_E32MAIN_DUP08, "   otg.StartStacks fails %d", r);
         goto Abort;
-		}	
+        }    
 
-	OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP09, "   otg stacks successfully started");
+    OstTrace0(TRACE_NORMAL, E32MAIN_E32MAIN_DUP09, "   otg stacks successfully started");
 
-//	RProcess::Rendezvous(KErrNone);
+//    RProcess::Rendezvous(KErrNone);
 
     // attach to the word of deathproperty
     r = wordofdeath.Attach(KWordOfDeathCat, KWordOfDeathKey, EOwnerThread);
@@ -126,8 +126,8 @@
     wordofdeath.Subscribe(waiting_for_death);
     while(running)
         {
-		otg.QueueOtgEventRequest(event, status);
-		User::WaitForRequest(status, waiting_for_death);
+        otg.QueueOtgEventRequest(event, status);
+        User::WaitForRequest(status, waiting_for_death);
 
         OstTrace1(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP01, "waiting_for_death= %d", waiting_for_death.Int());
         OstTrace1(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP02, "Otg Event        = %d", status.Int());
@@ -144,7 +144,7 @@
             {
             // Run client or host modes against this otg event
             if(clientFlag)
-                {		
+                {        
                 running = RunClient(otg, event);
                 }
             else
@@ -154,7 +154,7 @@
             }
         }
 
-	// Shut down nicely
+    // Shut down nicely
 
     OstTrace0(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP03, "StopStacks()");
 
@@ -176,7 +176,7 @@
 
     return KErrNone;
     }
-	
+    
 
 
 
@@ -205,14 +205,18 @@
 
 TBool RunHost(RUsbOtgDriver& aOtg, TInt event)
     {
-    TInt r;
     switch(event)
         {
     case RUsbOtgDriver::EEventAPlugInserted:
-        OstTrace0(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP11, "Host side otg got APlugInserted Event");
-        r = aOtg.BusRequest();
-        OstTrace1(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP12, "BusRequest() made - returned %d", r);
-        break;
+            {
+            OstTrace0(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP11, "Host side otg got APlugInserted Event");
+#ifdef OST_TRACE_COMPILER_IN_USE
+            TInt r = 
+#endif
+            aOtg.BusRequest();
+            OstTrace1(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP12, "BusRequest() made - returned %d", r);
+            }
+            break;
 
     case RUsbOtgDriver::EEventAPlugRemoved:
         OstTrace0(TRACE_NORMAL, RPROCESS_RENDEZVOUS_DUP13, "Host side otg got APlugRemoved Event - shutting down");
--- a/kerneltest/f32test/bench/t_fsrdirload.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/bench/t_fsrdirload.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -18,7 +18,7 @@
 #include <f32file.h>
 #include <e32test.h>
 #include "t_select.h"
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 #include "t_benchmain.h"
 
 
--- a/kerneltest/f32test/bench/t_fsrdirscan.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/bench/t_fsrdirscan.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -18,7 +18,7 @@
 #include <f32file.h>
 #include <e32test.h>
 #include "t_select.h"
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 #include "t_benchmain.h"
 
 GLDEF_D RTest test(_L("File Server Benchmarks, DirScan"));
--- a/kerneltest/f32test/bench/t_fsropen.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/bench/t_fsropen.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -18,7 +18,7 @@
 #include <f32file.h>
 #include <e32test.h>
 #include "t_select.h"
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 #include "t_benchmain.h"
 
 GLDEF_D RTest test(_L("File Server Benchmarks, Open File"));
--- a/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_charconv.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_charconv.h	Mon Oct 04 02:35:35 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 1997-2008 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 1997-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"
@@ -21,11 +21,11 @@
 #define __CHARCONV_H__
 
 #if !defined(__E32STD_H__)
-#include <E32STD.H>
+#include <e32std.h>
 #endif
 
 #if !defined(__E32BASE_H__)
-#include <E32BASE.H>
+#include <e32base.h>
 #endif
 
 /** 
--- a/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_complocl.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_complocl.h	Mon Oct 04 02:35:35 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2000-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"
@@ -21,7 +21,7 @@
 #define __COMPLOCL_H__
 
 #if !defined(__E32STD_H__)
-#include <E32std.h>
+#include <e32std.h>
 #endif
 
 class LLocaleData
--- a/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_convutils.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_convutils.h	Mon Oct 04 02:35:35 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2000-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"
@@ -21,15 +21,15 @@
 #define __CONVUTILS_H__
 
 #if !defined(__E32STD_H__)
-#include <E32STD.H>
+#include <e32std.h>
 #endif
 
 #if !defined(__E32BASE_H__)
-#include <E32BASE.H>
+#include <e32base.h>
 #endif
 
 #if !defined(__CHARCONV_H__)
-#include "T_TLOCL32_CHARCONV.H"
+#include "t_tlocl32_charconv.h"
 #endif
 
 struct SCnvConversionData;
--- a/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_shiftjis.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/locl/localeutils/elocl32_japan/inc/t_tlocl32_shiftjis.h	Mon Oct 04 02:35:35 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2000 Nokia Corporation and/or its subsidiary(-ies). 
+* Copyright (c) 2000-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"
@@ -21,15 +21,15 @@
 #define __SHIFTJIS_H__
 
 #if !defined(__E32STD_H__)
-#include <E32STD.H>
+#include <e32std.h>
 #endif
 
 #if !defined(__CHARCONV_H__)
-#include "T_TLOCL32_CHARCONV.H"
+#include "t_tlocl32_charconv.h"
 #endif
 
 #if !defined(__CONVUTILS_H__)
-#include "T_TLOCL32_CONVUTILS.H"
+#include "t_tlocl32_convutils.h"
 #endif
 
 class CnvShiftJis 
--- a/kerneltest/f32test/manager/t_romg.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/manager/t_romg.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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"
@@ -11,7 +11,7 @@
 // Contributors:
 //
 // Description:
-// f32test\manager\t_romg.cpp
+// f32test/manager/t_romg.cpp
 // 
 //
 
@@ -19,7 +19,7 @@
 #include <f32file.h>
 #include <e32test.h>
 #include <e32rom.h>
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 
 const TInt KBufSize=0x10000;
 const TInt KFillerSize=0x100;
--- a/kerneltest/f32test/outsideBMP/src/t_surrogatepair.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/outsideBMP/src/t_surrogatepair.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -11,17 +11,17 @@
 // Contributors:
 //
 // Description:
-// f32test\locl\localeutils\T_SURROGATEPAIR.cpp
+// f32test/outsidebmp/t_surrogatepair.cpp
 // 
 //
 
 #define __E32TEST_EXTENSION__
 
 #include <e32test.h>
-#include <HAL.H>
+#include <hal.h>
 #include <f32fsys.h>
 #include <f32dbg.h>
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 
 RTest test(_L("T_SURROGATEPAIR"));
 
--- a/kerneltest/f32test/plugins/version_1/virus/t_virus.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/plugins/version_1/virus/t_virus.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2005-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"
@@ -21,13 +21,13 @@
 #include <f32dbg.h>
 #include "t_server.h"
 
-GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[]);
+GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[]);
 
 #define TEST_FOR_ERROR( r )	TestIfEqual( r, KErrNone, __LINE__, __FILE__)
 #define TEST_FOR_VALUE( r, expected ) TestIfEqual( r, expected, __LINE__, __FILE__)
 
 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[])
 	{
 	if( aExpected != aValue )
 		{
--- a/kerneltest/f32test/plugins/version_2/src/AllSupportedDrives_plugin.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/plugins/version_2/src/AllSupportedDrives_plugin.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "AllSupportedDrives_plugin.h"
+#include "allsupporteddrives_plugin.h"
 #include <f32pluginutils.h>
 
 /**
--- a/kerneltest/f32test/plugins/version_2/src/combinational2_plugin.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/plugins/version_2/src/combinational2_plugin.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "Combinational2_plugin.h"
+#include "combinational2_plugin.h"
 #include "plugincommon.h"
 #include <f32pluginutils.h>
 
--- a/kerneltest/f32test/plugins/version_2/src/drivec_plugin.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/plugins/version_2/src/drivec_plugin.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "DriveC_plugin.h"
+#include "drivec_plugin.h"
 #include <f32pluginutils.h>
 #include "plugincommon.h"
 
--- a/kerneltest/f32test/plugins/version_2/src/drivez_plugin.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/plugins/version_2/src/drivez_plugin.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -13,7 +13,7 @@
 // Description:
 //
 
-#include "DriveZ_plugin.h"
+#include "drivez_plugin.h"
 #include <f32pluginutils.h>
 #include "plugincommon.h"
 
--- a/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/plugins/version_2beta/t_plugin_v2beta.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2006-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"
@@ -24,7 +24,7 @@
 #include "encrypt.h"
 #include "hex.h"
 
-GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[]);
+GLREF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[]);
 
 #define TEST_FOR_ERROR( r )	{ TInt _r = (r); if (_r < 0) HandleError(_r, __LINE__); }
 #define TEST_FOR_VALUE( r, expected ) TestIfEqual( r, expected, __LINE__, __FILE__)
@@ -51,7 +51,7 @@
 					"line 9 abcdefghijklmnopqrstuvwxyz\n");
 
 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[])
 	{
 	if( aExpected != aValue )
 		{
--- a/kerneltest/f32test/server/t_cp_plugintest.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_cp_plugintest.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2007 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2007-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"
@@ -12,17 +12,17 @@
 * Contributors:
 *
 * Description:
-*
+* /sf/os/kernelhwsrv/kerneltest/f32test/server/t_cp_plugintest.cpp
 */
 
 
 #define __E32TEST_EXTENSION__
 
 #include <e32test.h>
-#include <HAL.H>
+#include <hal.h>
 #include <f32fsys.h>
 #include <f32dbg.h>
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 #include "fat_utils.h"
 
 	
--- a/kerneltest/f32test/server/t_dspace.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_dspace.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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);
--- a/kerneltest/f32test/server/t_fatcharsetconv_Cases.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_fatcharsetconv_Cases.h	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-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"
@@ -11,7 +11,7 @@
 // Contributors:
 //
 // Description:
-// f32test\server\T_Fatcharsetconv_Cases.h
+// f32test\server\t_fatcharsetconv_cases.h
 // 
 //
 
@@ -19,7 +19,7 @@
 #ifndef T_FATCHARSETCONV_CASES_H
 #define T_FATCHARSETCONV_CASES_H
 
-#include "T_Fatcharsetconv_Aux.h"
+#include "t_fatcharsetconv_aux.h"
 
 #if defined(_DEBUG) || defined(_DEBUG_RELEASE)
 extern CFileMan* gFileman;
--- a/kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_fatcharsetconv_SpecificCases.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,5 +1,5 @@
 /*
-* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* Copyright (c) 2009-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"
@@ -16,14 +16,14 @@
 */
 #define __E32TEST_EXTENSION__
 
-#include "T_Fatcharsetconv_aux.h"
+#include "t_fatcharsetconv_aux.h"
 #include <f32file.h>
 #include <e32test.h>
 #include <e32svr.h>
-#include <HAL.H>
+#include <hal.h>
 #include <f32fsys.h>
 #include <f32dbg.h>
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 
 //#include "fat_utils.h"
 
@@ -572,15 +572,9 @@
 	gLogFailureData.iTCTypeName = KSymbianFATSpecific;
 	gLogFailureData.iAPIName= KNone;
 
-	// Store current file name
-	TFileName fileName;
-	TInt i=0;
-	while(__FILE__[i]!='\0')
-		{
-		fileName.SetLength(i+1);
-		fileName[i] = __FILE__[i++];
-		}
-	gFileName = fileName;
+	// the preprocessor macro gives a C/C++ zero-terminated string; use overloaded ::Copy()
+	// Why oh why does TPtrC8 not have a "char *" constructor ...
+	gFileName.Copy(TPtrC8((const TUint8*)__FILE__));
 
 	gLogFailureData.iFuncName = KTestLeadingE5Handling;
 	TestLeadingE5Handling();
--- a/kerneltest/f32test/server/t_fatcharsetconv_aux.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_fatcharsetconv_aux.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-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"
@@ -11,12 +11,12 @@
 // Contributors:
 //
 // Description:
-// f32test\server\T_Fatcharsetconv_Aux.cpp
+// f32test\server\t_fatcharsetconv_aux.cpp
 // 
 //
 
 #include <f32dbg.h>
-#include "T_fatcharsetconv_Aux.h"
+#include "t_fatcharsetconv_aux.h"
 
 CFileMan* gFileMan = NULL;
 RPointerArray<RFile>* gFileHandles = NULL;
--- a/kerneltest/f32test/server/t_fatcharsetconv_main.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_fatcharsetconv_main.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2008-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"
@@ -11,7 +11,7 @@
 // Contributors:
 //
 // Description:
-// f32test\server\T_FatCharSetConv_Main.cpp
+// f32test\server\t_fatcharsetconv_main.cpp
 // 
 //
 
@@ -25,7 +25,7 @@
 #include "t_server.h"
 #include "t_chlffs.h"
 #include "fat_utils.h"
-#include "T_Fatcharsetconv_Cases.h"
+#include "t_fatcharsetconv_cases.h"
 
 
 RTest test(_L("T_FatCharSetConv"));
--- a/kerneltest/f32test/server/t_file64bit.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_file64bit.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1996-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1996-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of the License "Eclipse Public License v1.0"
@@ -31,7 +31,7 @@
 #include <e32svr.h>
 #include "t_server.h"
 #include "t_file64bit.h"
-#include "..\\fileshare\\handshare64bit.h"
+#include "../fileshare/handshare64bit.h"
 #include <f32pluginutils.h>
 #include <massstorage.h>
 #include <e32math.h>
--- a/kerneltest/f32test/server/t_fman.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_fman.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -27,6 +27,8 @@
 LOCAL_D TBool gAsynch=EFalse;
 LOCAL_D TRequestStatus gStat;
 LOCAL_D TBool testingInvalidPathLengths;
+LOCAL_D TChar gSecDrive;        // a second drive for inter-drive tests
+LOCAL_D TBool gSecDriveReady;
 
 class CFileManObserver : public CBase, public MFileManObserver
 	{
@@ -66,6 +68,30 @@
 	return(MFileManObserver::EContinue);
 	}
 
+LOCAL_C TBool GetSecondDrive(TChar& aDrive) // Get the drive that is ready.
+    {
+    TDriveList list;
+    TheFs.DriveList(list);
+    if (list[EDriveD] != 0)
+        {
+        aDrive = 'D';
+        return ETrue;
+        }
+    
+    TInt drv;
+    // In minibsp rom(sirocco) there is no D drive
+    for(drv = EDriveE; drv < EDriveZ; drv++)
+        {
+        if (list[drv] != 0) 
+            {
+            aDrive = 'A' + drv;
+            return ETrue;
+            }
+        }
+    aDrive = '?';
+    return EFalse;
+    }
+
 LOCAL_C void WaitForSuccess()
 //
 // Wait for gStat to complete with KErrNone
@@ -175,6 +201,7 @@
 		{
 #if !defined(__WINS__)
 		*aDestOtherDrive = gSessionPath[0] == 'C' ? _L("D:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\");
+        (*aDestOtherDrive)[0] = (TText) gSecDrive;
 #else
 		*aDestOtherDrive = gSessionPath[0] == 'C' ? _L("Y:\\F32-TST\\TFMAN\\dest\\") : _L("C:\\F32-TST\\TFMAN\\dest\\");
 #endif
@@ -2163,10 +2190,15 @@
    	
 	TFileName trgPath = _L("?:\\F32-TST\\");
 
-	if (gSessionPath[0]!='D'&& gSessionPath[0]!='Y')
+	if (gSessionPath[0]!='D'&& gSessionPath[0]!='Y' && gSessionPath[0]!='I')
 		{
 #if !defined(__WINS__)
-		trgPath[0] = 'D';
+        if (!gSecDriveReady)
+            {
+            test.Printf(_L("Second drive not available for test, skip..."));
+            return;
+            }
+		trgPath[0] = (TText) gSecDrive;
 #else
 		trgPath[0] = 'Y';
 #endif
@@ -2793,8 +2825,15 @@
 	if (gSessionPath[0]=='C')
 		{
 #if !defined(__WINS__)
-		trgDir	   = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\");
-		trgSpec	   = _L("D:\\F32-TST\\TFMAN\\RECMOVE2\\*");
+        if (!gSecDriveReady)
+            {
+            test.Printf(_L("Second drive not available for test, skip..."));
+            return;
+            }
+		trgDir	   = _L("?:\\F32-TST\\TFMAN\\RECMOVE2\\");
+		trgSpec	   = _L("?:\\F32-TST\\TFMAN\\RECMOVE2\\*");     
+        trgDir[0] = (TText) gSecDrive;;
+        trgSpec[0] = (TText) gSecDrive;;
 #else
 		trgDir     = _L("Y:\\F32-TST\\TFMAN\\RECMOVE2\\");
 		trgSpec    = _L("Y:\\F32-TST\\TFMAN\\RECMOVE2\\*");
@@ -2825,24 +2864,30 @@
 	RmDir(_L("C:\\F32-TST\\TFMAN\\AFTER\\"));
 	RmDir(_L("C:\\F32-TST\\TFMAN\\RECMOVE\\"));
 	
+    TFileName destOtherDrive;
 	//
 	// Test moving empty directories (DEF073924)
 	//
 	test.Next(_L("Test moving empty directories"));
-
-	TFileName destOtherDrive;
-	SetupDirectories(EFalse, &destOtherDrive);
-
-	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
-	test_Equal(KErrNotFound, err);	// Expected - directory is empty
-
-	// Test that all directories are still present
-	TEntry entry;
-	err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
-	test_KErrNone(err);
-	err = TheFs.Entry(destOtherDrive, entry);
-	test_KErrNone(err);
-
+	
+	if (gSecDriveReady)
+	    {
+        SetupDirectories(EFalse, &destOtherDrive);
+    
+        err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
+        test_Equal(KErrNotFound, err);	// Expected - directory is empty
+    
+        // Test that all directories are still present
+        TEntry entry;
+        err = TheFs.Entry(_L("\\F32-TST\\TFMAN\\source\\"), entry);
+        test_KErrNone(err);
+        err = TheFs.Entry(destOtherDrive, entry);
+        test_KErrNone(err);
+	    }
+	else
+	    {
+        test.Printf(_L("Second drive not available for test, skip..."));
+	    }
 	//--------------------------------------------- 
 	//! @SYMTestCaseID			PBASE-T_FMAN-0571
 	//! @SYMTestType			UT
@@ -2882,13 +2927,19 @@
 	//
 	test.Next(_L("Test moving a directory containing subdirectories"));
 
-	SetupDirectories(ETrue, &destOtherDrive);
-	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse | CFileMan::EOverWrite);
-	test_KErrNone(err);
-
-	destOtherDrive.Append(_L("*"));
-	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
-
+    if (gSecDriveReady)
+        {
+        SetupDirectories(ETrue, &destOtherDrive);
+        err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse | CFileMan::EOverWrite);
+        test_KErrNone(err);
+        
+        destOtherDrive.Append(_L("*"));
+        Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
+        }
+    else
+        {
+        test.Printf(_L("Second drive not available for test, skip..."));
+        }
 	//--------------------------------------------- 
 	//! @SYMTestCaseID			PBASE-T_FMAN-0161
 	//! @SYMTestType			UT 
@@ -2900,41 +2951,48 @@
 	//! @SYMTestStatus			Implemented 
 	//--------------------------------------------- 	
 	test.Next(_L("Test moving when the target directory does not exist"));
-
-	SetupDirectories(ETrue, &destOtherDrive);
-	
-	RmDir(destOtherDrive);
-
-	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
-	test_KErrNone(err);
-
-	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
-
-	SetupDirectories(ETrue, &destOtherDrive);
-	
-	RmDir(destOtherDrive);
-
-	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), destOtherDrive, CFileMan::ERecurse);
-	test_KErrNone(err);
-
-	MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
-	destOtherDrive.Append(_L("source\\"));
-	Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
-	RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
-
-	SetupDirectories(ETrue, &destOtherDrive);
-
-	RmDir(destOtherDrive);
-
-	err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), destOtherDrive, CFileMan::ERecurse);
-	test_KErrNone(err);
-
-	CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
-	destOtherDrive.Append(_L("File1.TXT"));
-	CheckFileExists(destOtherDrive, KErrNone, ETrue);
-
-	RmDir(destOtherDrive);
-	RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
+    
+	if (gSecDriveReady)
+        {
+        SetupDirectories(ETrue, &destOtherDrive);
+        
+        RmDir(destOtherDrive);
+    
+        err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\"), destOtherDrive, CFileMan::ERecurse);
+        test_KErrNone(err);
+    
+        Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
+    
+        SetupDirectories(ETrue, &destOtherDrive);
+        
+        RmDir(destOtherDrive);
+    
+        err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source"), destOtherDrive, CFileMan::ERecurse);
+        test_KErrNone(err);
+    
+        MakeDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
+        destOtherDrive.Append(_L("source\\"));
+        Compare(_L("\\F32-TST\\TFMAN\\compare\\*"), destOtherDrive);
+        RmDir(_L("\\F32-TST\\TFMAN\\compare\\subdir\\"));
+    
+        SetupDirectories(ETrue, &destOtherDrive);
+    
+        RmDir(destOtherDrive);
+    
+        err = gFileMan->Move(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), destOtherDrive, CFileMan::ERecurse);
+        test_KErrNone(err);
+    
+        CheckFileExists(_L("\\F32-TST\\TFMAN\\source\\File1.TXT"), KErrNotFound, ETrue);
+        destOtherDrive.Append(_L("File1.TXT"));
+        CheckFileExists(destOtherDrive, KErrNone, ETrue);
+    
+        RmDir(destOtherDrive);
+        RmDir(_L("\\F32-TST\\TFMAN\\source\\"));
+        }
+    else
+        {
+        test.Printf(_L("Second drive not available for test, skip..."));
+        }
 
 	//
 	// Test recursive move of complex directory structure into itself (INC078759)
@@ -3777,10 +3835,19 @@
 	if (gSessionPath[0]=='C')
 		{
 #if !defined(__WINS__)
-		trgDrive   = _L("D:\\");
-		trgFile    = _L("D:\\Sketch");
-		trgDir     = _L("D:\\DRIVEMOVE\\");
-		trgDirFile = _L("D:\\DRIVEMOVE\\Sketch");
+        if (!gSecDriveReady)
+            {
+            test.Printf(_L("Second drive not available for test, skip..."));
+            return;
+            }
+		trgDrive   = _L("?:\\");
+		trgFile    = _L("?:\\Sketch");
+		trgDir     = _L("?:\\DRIVEMOVE\\");
+		trgDirFile = _L("?:\\DRIVEMOVE\\Sketch");
+		trgDrive[0] = (TText) gSecDrive;;
+        trgFile[0]  = (TText) gSecDrive;
+        trgDir[0]   = (TText) gSecDrive;
+        trgDirFile[0]  = (TText) gSecDrive;		
 #else
 		trgDrive   = _L("Y:\\");
 		trgFile    = _L("Y:\\Sketch");
@@ -3885,9 +3952,17 @@
 	if (gSessionPath[0]=='C')
 		{
 #if !defined(__WINS__)
-		trgDirRoot = _L("D:\\F32-TST\\TFMAN\\");
-		trgDirFull = _L("D:\\F32-TST\\TFMAN\\CANCELMOVE\\");
-        trgDirFile = _L("D:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE");
+        if (!gSecDriveReady)
+            {
+            test.Printf(_L("Second drive not available for test, skip..."));
+            return;
+            }
+		trgDirRoot = _L("?:\\F32-TST\\TFMAN\\");
+		trgDirFull = _L("?:\\F32-TST\\TFMAN\\CANCELMOVE\\");
+        trgDirFile = _L("?:\\F32-TST\\TFMAN\\CANCELMOVE\\FILE");
+        trgDirRoot[0] = (TText) gSecDrive;
+        trgDirFull[0] = (TText) gSecDrive;
+        trgDirFile[0] = (TText) gSecDrive;
 #else
 		trgDirRoot = _L("Y:\\F32-TST\\TFMAN\\");
 		trgDirFull = _L("Y:\\F32-TST\\TFMAN\\CANCELMOVE\\");
@@ -3969,7 +4044,13 @@
 	test.Next(_L("Test move empty directory"));
 
 #if !defined(__WINS__)
-	TFileName trgDrive=_L("D:\\");
+    if (!gSecDriveReady)
+        {
+        test.Printf(_L("Second drive not available for test, skip..."));
+        return;
+        }
+	TFileName trgDrive=_L("?:\\");
+	trgDrive[0] = (TText) gSecDrive;
 #else
 	if (gSessionPath[0]!='C')
 		return;
@@ -4114,6 +4195,7 @@
 	gFileMan=CFileMan::NewL(TheFs);
 	gObserver=new(ELeave) CFileManObserver(gFileMan);
 	gFileMan->SetObserver(gObserver);
+	gSecDriveReady = GetSecondDrive(gSecDrive);
 	}
 
 LOCAL_C void Cleanup()
--- a/kerneltest/f32test/server/t_fsys.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_fsys.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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<KMaxDrives;++i)
+    TBuf<60>  buf;
+    TInt nRes;
+
+    TDriveList drvList;
+    nRes = TheFs.DriveList(drvList);
+    test_KErrNone(nRes);
+
+    for(TInt i=0; i<KMaxDrives; ++i)
         {
-        r=TheFs.FileSystemName(name,i);
-        test_Value(r, r == KErrNone || r==KErrNotFound);
-        TChar c;
-        r=RFs::DriveToChar(i,c);
-        test_KErrNone(r);
-        if(name.Length())       
-            test.Printf(_L("File System Name on drive %c is %S\n"),(char)c,&name);
+        buf.Format(_L("drv %C: att:0x%02x"), 'A'+i, drvList[i]);
+        
+        nRes = TheFs.FileSystemName(name, i);
+        test_Value(nRes, nRes == KErrNone || nRes==KErrNotFound);
+        
+        if(nRes == KErrNone)
+            {
+            buf.AppendFormat(_L(" Mounted FS:%S"), &name);
+            }
         else
-            test.Printf(_L("No file system on drive %c\n"),(char)c);
+            {
+            buf.Append(_L(" Mounted FS:"));
+            }
+
+        buf.Append(_L("\n"));
+        test.Printf(buf);
         }
+    
     }
 
+//---------------------------------------------------
 static void CheckDismount(TDesC& aFs,TInt aDrive)
     {
 
@@ -216,32 +241,32 @@
     TDriveInfo di;
     r=TheFs.Drive(di,aDrive);
     test_KErrNone(r);
-    b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
+    b.Format(_L("Test dismounting of test file system on %c: (DrvAtt:%x MedAtt:%x)\n"),(TUint)c,di.iDriveAtt,di.iMediaAtt);
     test.Next(b);
     
     // Test cannot dismount on rom drive
-    test.Next(_L("Test cannot dismount on Rom drive"));
+    test.Next(_L("Test cannot dismount on Rom drive\n"));
     TFullName zName;
     r=TheFs.FileSystemName(zName,EDriveZ);
     test_KErrNone(r);
     r=TheFs.DismountFileSystem(zName,EDriveZ);
-    test.Printf(_L("r=%d"),r);
+    test.Printf(_L("r=%d\n"),r);
     // NB if paging is enabled on a ROFS partition which is part of the composite file system then the 
     // likelihood is that there will be a at least one file clamped: in this case there error will be KErrInUse
     test_Value(r, r == KErrAccessDenied || r==KErrInUse);
 
     // Test cannot dismount on wrong drive
-    test.Next(_L("Test cannot dismount on wrong drive"));
+    test.Next(_L("Test cannot dismount on wrong drive\n"));
     r=TheFs.DismountFileSystem(aFs,EDriveA);
     test_Value(r, r == KErrNotReady);
 
     // Test cannot dismount with wrong name
-    test.Next(_L("Test cannot dismount with wrong file system name"));
+    test.Next(_L("Test cannot dismount with wrong file system name\n"));
     r=TheFs.DismountFileSystem(_L("abc"),aDrive);
     test_Value(r, r == KErrNotFound);
  
     // Test cannot dismount with a file open
-    test.Next(_L("Test cannot dismount with a file open"));
+    test.Next(_L("Test cannot dismount with a file open\n"));
     r=TheFs.SetSessionPath(newSess);
     RFile file;
     r=file.Replace(TheFs,_L("abc"),EFileShareAny);
@@ -256,11 +281,11 @@
     file.Close();
 
     // Now test dismount works
-    test.Next(_L("Test dismounts OK"));
+    test.Next(_L("Test dismounts OK\n"));
     r=TheFs.DismountFileSystem(aFs,aDrive);
     if(r!=KErrNone)
         {
-        test.Printf(_L("Error = %d"),r);    
+        test.Printf(_L("Error = %d\n"),r);    
         test(EFalse);
         }
     TFullName n;
@@ -289,7 +314,7 @@
 
 static void TestDismountFileSystem(TInt aDrive)
     {
-
+    test.Next(_L("TestDismountFileSystem()\n"));
     TInt r;
     TFullName name;
     r=TheFs.FileSystemName(name,aDrive);
@@ -298,12 +323,20 @@
         CheckDismount(name,aDrive);
     }
 
-#if defined(__EPOC32__)
-static void TestFileSystem(TInt aDrive)
+//---------------------------------------------------
 //
 // Mount a new CTestFileSystem on the drive under test
 //
+static void TestFileSystem(TInt aDrive)
     {
+    test.Next(_L("TestFileSystem()\n"));
+
+    if(Is_SimulatedSystemDrive(TheFs, aDrive))
+        {
+        test.Printf(_L("Can't test on a simulated drive, skipping!\n"));
+        return;
+        }
+
     TBuf<64> 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<KMaxDrives; ++drv)
+        {
+        if(!drvList[drv])
+            break;
+        }
 
-    r = TheFs.AddFileSystem(KFsNm);
-    test.Printf(_L("afs: r = %d\n"), r);
-    test_Value(r, r == KErrNone || r == KErrAlreadyExists);
-    test.Next(_L("mounting FAT on drive R"));
-    r = TheFs.MountFileSystem(KFileSystemName_FAT, EDriveR);
-    test_Value(r, r == KErrArgument);
+    test.Printf(_L("Try mounting a test FS onto drive:%C:\n"), 'A'+drv);
+
+    nRes = TheFs.AddFileSystem(KTestFsy);
+    test_Value(nRes, nRes == KErrNone || nRes == KErrAlreadyExists);
+
+    nRes = TheFs.MountFileSystem(KTestFsName, drv);
+    test_Value(nRes, nRes == KErrArgument);
     
-    test.End();
     }
 
 // Additional step for INC083446: Corrupted miniSD not detected as corrupted by phone 
@@ -409,14 +443,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_TFSYS2"));
+    test.Next(_L("Test mounting of test file system\n"));
+    r=TheFs.AddFileSystem(KTestFsy2);
     if(r!=KErrNone && r!=KErrAlreadyExists)
         {
-        test.Printf(_L("error=%d"),r);
+        test.Printf(_L("error=%d\n"),r);
         test(EFalse);
         }
 
@@ -426,16 +460,16 @@
     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("Test2"),aDrive);
+    r=TheFs.MountFileSystem(KTestFsName2 ,aDrive);
     test_Value(r, r == KErrCorrupt);
 
     TFileName newFs;
     r=TheFs.FileSystemName(newFs,aDrive);
     test_KErrNone(r);
-    test(newFs.Compare(_L("Test2"))==0);
+    test(newFs.Compare(KTestFsName2)==0);
 
     // Get the number of remounts by checking the volume attributes -
     // T_TFSYS2 hijacks the iBattery member to report back the number of times MountL() has been called
@@ -446,7 +480,7 @@
     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
     remounts = (TInt) info.iBattery;
-    test.Printf(_L("Initial remounts = %d"), remounts);
+    test.Printf(_L("Initial remounts = %d\n"), remounts);
 
     // Make the file server attempt to remount the drive by looking for a non-existant DLL
     // The file server should setop trying to remount the driver after KMaxMountFailures attempts
@@ -465,7 +499,7 @@
     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
     remounts = (TInt) info.iBattery;
-    test.Printf(_L("Remounts = %d"), remounts);
+    test.Printf(_L("Remounts = %d\n"), remounts);
     test(remounts ==  KMaxMountFailures);
     
     // simulate a media change to reset failure count
@@ -484,7 +518,7 @@
     test.Printf(_L("iType=%d,iBattery=%d,iDriveAtt=%x,iMediaAtt=%x\n"),(TUint)info.iType,\
         (TUint)info.iBattery,info.iDriveAtt,info.iMediaAtt);
     remounts = (TInt) info.iBattery;
-    test.Printf(_L("Remounts = %d"), remounts);
+    test.Printf(_L("Remounts = %d\n"), remounts);
     test(remounts ==  KMaxMountFailures * 2);
     
 
@@ -494,10 +528,10 @@
     r=TheFs.MountFileSystem(oldFs,aDrive);
     test_KErrNone(r);
     
-    r=TheFs.RemoveFileSystem(_L("Test2"));
+    r=TheFs.RemoveFileSystem(KTestFsName2);
     if(r!=KErrNone)
         {
-        test.Printf(_L("error=%d"),r);
+        test.Printf(_L("error=%d\n"),r);
         test(EFalse);
         }
     }
@@ -508,7 +542,7 @@
 */
 static void TestSubstDriveMediaSerialNumber()
 {
-    test.Next(_L("Test obtaining media serial number for the substituted drives"));
+    test.Next(_L("Test obtaining media serial number for the substituted drives\n"));
 
     TInt  nRes;
     const TInt currDrvNum=CurrentDrive();
@@ -587,7 +621,7 @@
 //----------------------------------------------------------------------------------------------
 static void TestFileSystemSubTypeQuery()
     {
-    test.Next(_L("Test querying sub type of the mounted file system"));
+    test.Next(_L("Test querying sub type of the mounted file system\n"));
     TFSName fsName;
     TPckgBuf<TFSName> 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<TVolumeIOParamInfo> 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<TVolumeIOParamInfo> 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<TFSName> 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<TVolumeIOParamInfo> 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<TFSName> 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<TVolumeIOParamInfo> 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();
 
     //---------------------------------------
--- a/kerneltest/f32test/server/t_localeutils_cp932.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_localeutils_cp932.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 2007-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 2007-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"
@@ -19,11 +19,11 @@
 
 
 #include <e32test.h>
-#include <HAL.H>
+#include <hal.h>
 #include <f32fsys.h>
 #include <f32dbg.h>
 #include <e32svr.h>
-#include "..\server\t_server.h"
+#include "../server/t_server.h"
 #include "fat_utils.h"
 
 RTest test(_L("T_LOCALEUTILS_CP932"));
--- a/kerneltest/f32test/server/t_prel.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/server/t_prel.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1998-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1998-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"
@@ -22,8 +22,8 @@
 EXPORT_C void FurtiveD(TFileName &aInfo)
 	{
 
-	char *dummy="Link unit for Preload test";
-	dummy=dummy;
+	const char* dummy = "Link unit for Preload test";
+	dummy = dummy;
 	TFileName name;
 	Dll::FileName(name);
 	aInfo.Append(name);
--- a/kerneltest/f32test/smassstorage/inc/t_ms_main.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/smassstorage/inc/t_ms_main.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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"
@@ -31,7 +31,7 @@
 
 GLREF_C void CallTestsL();
 
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[]);
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[]);
 #define TEST_FOR_VALUE( r, expected ) TestIfEqual( r, expected, __LINE__, __FILE__)
 
 #endif //__TMSMAIN_H__
--- a/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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"
@@ -45,7 +45,7 @@
 	}
 
 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[])
 	{
 	if( aExpected != aValue )
 		{
--- a/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/smassstorage/scsiprot/t_ms_main.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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"
@@ -34,7 +34,7 @@
 GLDEF_C void t_scsi_prot();
 
 
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[]);
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[]);
 #define TEST_FOR_VALUE( r, expected ) TestIfEqual( r, expected, __LINE__, __FILE__)
 
 #define TEST_SENSE_CODE( aSensePtr, aExpKey, aExtAddCode ) 		\
--- a/kerneltest/f32test/smassstorage/src/t_gml_tur.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/smassstorage/src/t_gml_tur.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -13,12 +13,13 @@
 // Description:
 //
 
+#define __E32TEST_EXTENSION__
 #include <e32std.h>
-#include <e32std_private.h>
 #include <e32test.h>
 #include <testusbc.h>
 #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();
     
--- a/kerneltest/f32test/smassstorage/src/t_ms_main.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/kerneltest/f32test/smassstorage/src/t_ms_main.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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"
@@ -38,7 +38,7 @@
 
 
 _LIT( KValueTestFailMsg, "ERROR Got %d expected %d" );
-GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, char aFileName[])
+GLDEF_C void TestIfEqual( TInt aValue, TInt aExpected, TInt aLine, const char aFileName[])
 	{
 	if( aExpected != aValue )
 		{
--- a/userlibandfileserver/fileserver/group/release.txt	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/group/release.txt	Mon Oct 04 02:35:35 2010 +0300
@@ -1,3 +1,33 @@
+Version 2.00.3061
+=================
+(Made by fadhliM 31/08/2010)
+
+1.	h14jiang
+	1.	ou1cimx1#536014 [MCL] ENV : SIROCCO - Vasco - T_FMAN Fails when Removing a Directory
+
+2.	fagortz
+	1.	ou1cimx1#547797 "No such file or directory" breaks in f32test Linux build
+	2.	ou1cimx1#551018 [GCCE] deprecated conversion from string constant to 'char*' in f32test build
+
+
+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)
--- a/userlibandfileserver/fileserver/inc/f32ver.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/inc/f32ver.h	Mon Oct 04 02:35:35 2010 +0300
@@ -58,6 +58,6 @@
 
 @see TVersion
 */
-const TInt KF32BuildVersionNumber=3059;
+const TInt KF32BuildVersionNumber=3061;
 //
 #endif
--- a/userlibandfileserver/fileserver/sfat32/common_constants.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/common_constants.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_fatcache32.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_fatcache32.h	Mon Oct 04 02:35:35 2010 +0300
@@ -83,7 +83,6 @@
     typedef TDblQue<CFat32LruCachePage> TPageList;
     typedef TDblQueIter<CFat32LruCachePage> 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.
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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<TInt> iBadClusters;  ///< Array of bad cluster numbers
     RArray<TInt> iBadSectors;   ///< Array of bad sector numbers
     TBool   iDiskCorrupt;       ///< Disk is corrupt when format or not
--- a/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/inc/sl_std.inl	Mon Oct 04 02:35:35 2010 +0300
@@ -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;
+    }
 
 
 //---------------------------------------------------------------------------------------------------------------------------------
--- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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;
 
--- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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)
--- a/userlibandfileserver/fileserver/sfat32/sl_fatcache.inl	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache.inl	Mon Oct 04 02:35:35 2010 +0300
@@ -72,6 +72,17 @@
     return iFatClustSzLog2;
     }
     
+TUint32 CFatCacheBase::MaxFatEntries() const 
+    {
+    return iMaxFatEntries;
+    }
+
+TBool CFatCacheBase::FatIndexValid(TUint32 aIndex) const 
+    {
+    return (aIndex >= KFatFirstSearchCluster &&  aIndex < iMaxFatEntries);
+    }
+
+    
 
 //-----------------------------------------------------------------------------
 
--- a/userlibandfileserver/fileserver/sfat32/sl_fatcache32.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatcache32.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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
--- a/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_fatmisc32.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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<<Log2(iSectorsPerCluster), KMaxSecPerCluster);
-	    }
-
-    //-----------------------------------------
-
-    if (aDiskSizeInSectors < 4096) // < 2MB
-        {
-        iSectorsPerCluster = 1;
-		iRootDirEntries = 128;
-        }
-	else if (aDiskSizeInSectors < 8192) // < 4MB
-        {
-        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)2);
-		iRootDirEntries = 256;
-        }
-	else if (aDiskSizeInSectors < 32768) // < 16MB
-        {
-        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)4);
-		iRootDirEntries = 512;
-        }
-	else if (aDiskSizeInSectors < 1048576) // < 512MB
-        {
-        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)8);
-		iRootDirEntries = 512;
-        }
-    else // FAT32
-		{
-        iRootDirEntries = 512;
-        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)KMaxSecPerCluster);
-        }
-
-
-    //-----------------------------------------
-
-	TLDFormatInfo::TFATBits fatBits = iSpecialInfo().iFATBits;
-	if (fatBits == TLDFormatInfo::EFBDontCare)
-		{
-        const TFatType fatType = SuggestFatType();
-		switch(fatType)
-			{
-			case EFat12:
-				fatBits = TLDFormatInfo::EFB12;
-				break;
-			case EFat16:
-				fatBits = TLDFormatInfo::EFB16;
-				break;
-			case EFat32:
-				fatBits = TLDFormatInfo::EFB32;
-				break;
-			case EInvalid:
-				ASSERT(0);
-			}
-		}
-
-    TFatType reqFatType(EInvalid); //-- requested FAT type
-
-    switch (fatBits)
-		{
-		case TLDFormatInfo::EFB12:
-			iFileSystemName=KFileSystemName12;
-			iSectorsPerFat=MaxFat12Sectors();
-			reqFatType = EFat12;
-            break;
-
-		case TLDFormatInfo::EFB16:
-			iFileSystemName=KFileSystemName16;
-			iSectorsPerFat=MaxFat16Sectors();
-			reqFatType = EFat16;
-            break;
-
-		case TLDFormatInfo::EFB32:
-			iFileSystemName=KFileSystemName32;
-			iSectorsPerFat=MaxFat32Sectors();
-	        
-			iRootDirEntries = 0;
-			iRootClusterNum = 2;
-			
-            if(iSpecialInfo().iReservedSectors == 0)
-                iReservedSectors = KDefFat32ResvdSec; //-- user hasn't specified reserved sectors count, use default (FAT32)
-            else
-                iReservedSectors = iSpecialInfo().iReservedSectors;
-
-			reqFatType = EFat32;
-            break;
-
-        default:
-            __PRINT(_L("CFatFormatCB::InitFormatDataForFixedSizeDiskUser() Incorrect FAT type specifier!"));
-            return KErrArgument;
-		}
-	
-        //-- check if we can format the volume with requested FAT type
-        const TFatType fatType = SuggestFatType();
-        if(fatType != reqFatType)
-			{
-			//-- volume metrics don't correspond to the requested FAT type
-            __PRINT(_L("CFatFormatCB::InitFormatDataForFixedSizeDiskUser() FAT type mismatch!"));
-            return KErrArgument;
-			}
-
-        return KErrNone;
-    }
-
-/**
-    Initialize the format parameters for a custom fixed sized disk
-
-    @param  aFormatInfo The custom format parameters
-    @return system-wide error code
-*/
-TInt CFatFormatCB::InitFormatDataForFixedSizeDiskCustom(const TLDFormatInfo& aFormatInfo)
-	{
-    __PRINT(_L("CFatFormatCB::InitFormatDataForFixedSizeDiskCustom()"));
-    Dump_TLDFormatInfo(aFormatInfo);
-
-	if(aFormatInfo.iFlags & TLDFormatInfo::EOneFatTable)
-		iNumberOfFats = 1;
-    else if(aFormatInfo.iFlags & TLDFormatInfo::ETwoFatTables)
-		iNumberOfFats = 2;
-    else if(Drive().IsRemovable())
-		iNumberOfFats = KNumberOfFatsExternal;
-	else
-		iNumberOfFats = KNumberOfFatsInternal;	
-
-	iRootDirEntries=512;
-
-	iSectorsPerCluster = aFormatInfo.iSectorsPerCluster;
-	iSectorsPerTrack   = aFormatInfo.iSectorsPerTrack;
-	iNumberOfHeads	   = aFormatInfo.iNumberOfSides;
-	iReservedSectors   = aFormatInfo.iReservedSectors ? aFormatInfo.iReservedSectors : KDefFatResvdSec;
-	
-    switch (aFormatInfo.iFATBits)
-		{
-		case TLDFormatInfo::EFB12:
-			iFileSystemName = KFileSystemName12;
-			iSectorsPerFat  = MaxFat12Sectors();
-			break;
-
-		case TLDFormatInfo::EFB16:
-			iFileSystemName = KFileSystemName16;
-			iSectorsPerFat  = MaxFat16Sectors();
-            break;
-
-		case TLDFormatInfo::EFB32:
-			iFileSystemName  = KFileSystemName32;
-			iReservedSectors = aFormatInfo.iReservedSectors ? aFormatInfo.iReservedSectors : KDefFat32ResvdSec;
-			iSectorsPerFat   = MaxFat32Sectors();
-			iRootDirEntries  = 0;
-			iRootClusterNum  = 2;
-            break;
-
-		default:
-			{
-			TInt64 clusters64 = (aFormatInfo.iCapacity / KDefaultSectorSize) / iSectorsPerCluster;
-			TInt clusters = I64LOW(clusters64);
-			if (clusters < 4085)
-				{
-				iFileSystemName = KFileSystemName12;
-				iSectorsPerFat  = MaxFat12Sectors();
-				}
-			else if(clusters < 65525)
-				{
-				iFileSystemName = KFileSystemName16;
-				iSectorsPerFat  = MaxFat16Sectors();
-                }
-			else
-				{
-				iFileSystemName  = KFileSystemName32;
-				iReservedSectors = aFormatInfo.iReservedSectors ? aFormatInfo.iReservedSectors : KDefFat32ResvdSec;
-				iSectorsPerFat   = MaxFat32Sectors();
-				iRootDirEntries  = 0;
-				iRootClusterNum  = 2;
-				}
-			}
-		}
-
-    return KErrNone;
-	}
 
 void CFatFormatCB::RecordOldInfoL()
     {
@@ -819,7 +492,8 @@
 TInt CFatFormatCB::BadSectorToCluster()
     {
     TInt sizeofFatAndRootDir;
-    if (iFileSystemName != KFileSystemName32)
+    
+    if(!Is32BitFat())
 		sizeofFatAndRootDir = iSectorsPerFat*iNumberOfFats + ((iRootDirEntries*KSizeOfFatDirEntry+(1<<iSectorSizeLog2)-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<<Log2(iSectorsPerCluster), KMaxSecPerCluster);
+	    }
+
+    //-----------------------------------------
+
+    if (iMaxDiskSectors < 4096) // < 2MB
+        {
+        iSectorsPerCluster = 1;
+		iRootDirEntries = 128;
+        }
+	else if (iMaxDiskSectors < 8192) // < 4MB
+        {
+        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)2);
+		iRootDirEntries = 256;
+        }
+	else if (iMaxDiskSectors < 32768) // < 16MB
+        {
+        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)4);
+		iRootDirEntries = 512;
+        }
+	else if (iMaxDiskSectors < 1048576) // < 512MB
+        {
+        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)8);
+		iRootDirEntries = 512;
+        }
+    else // FAT32
+		{
+        iRootDirEntries = 512;
+        iSectorsPerCluster = Min((TUint32)iSectorsPerCluster, (TUint32)KMaxSecPerCluster);
+        }
 
 
+    //-----------------------------------------
+
+	TLDFormatInfo::TFATBits fatBits = iSpecialInfo().iFATBits;
+	if (fatBits == TLDFormatInfo::EFBDontCare)
+		{//-- the user hasn't specified FAT type, need to work it out according to volume geometry
+        const TFatType fatType = SuggestFatType();
+		switch(fatType)
+			{
+			case EFat12:
+				fatBits = TLDFormatInfo::EFB12;
+				break;
+			case EFat16:
+				fatBits = TLDFormatInfo::EFB16;
+				break;
+			case EFat32:
+				fatBits = TLDFormatInfo::EFB32;
+				break;
+			case EInvalid:
+				ASSERT(0);
+			}
+		}
+
+    TFatType reqFatType(EInvalid); //-- requested FAT type
+
+    switch (fatBits)
+		{
+		case TLDFormatInfo::EFB12:
+            SetFatType(EFat12);
+			iSectorsPerFat=MaxFat12Sectors();
+			reqFatType = EFat12;
+            break;
+
+		case TLDFormatInfo::EFB16:
+            SetFatType(EFat16);
+			iSectorsPerFat=MaxFat16Sectors();
+			reqFatType = EFat16;
+            break;
+
+		case TLDFormatInfo::EFB32:
+            SetFatType(EFat32);
+			iSectorsPerFat=MaxFat32Sectors();
+	        
+			iRootDirEntries = 0;
+			iRootClusterNum = 2;
+			
+            if(iSpecialInfo().iReservedSectors == 0)
+                iReservedSectors = KDefFat32ResvdSec; //-- user hasn't specified reserved sectors count, use default (FAT32)
+            else
+                iReservedSectors = iSpecialInfo().iReservedSectors;
+
+			reqFatType = EFat32;
+            break;
+
+        default:
+            __PRINT(_L("CFatFormatCB::InitFormatDataForFixedSizeDiskUser() Incorrect FAT type specifier!"));
+            return KErrArgument;
+		}
+	
+        //-- check if we can format the volume with requested FAT type
+        const TFatType fatType = SuggestFatType();
+        if(fatType != reqFatType)
+			{
+			//-- volume metrics don't correspond to the requested FAT type
+            __PRINT(_L("CFatFormatCB::InitFormatDataForFixedSizeDiskUser() FAT type mismatch!"));
+            return KErrArgument;
+			}
+
+        return KErrNone;
+}
+
+//-------------------------------------------------------------------------------------------------------------------
+/**
+    Initialize format parameters from the information provided by the media driver.
+    This method is mostly called for SD cards formatting
+*/
+TInt CFatFormatCB::ProcessVolParam_Custom(const TLocalDriveCapsV6& aCaps)
+{
+    __PRINT(_L("CFatFormatCB::ProcessVolParam_Custom()"));
+    
+    //-- TLDFormatInfo structure is filled by the media driver, it decides the media formatting parameters
+    const TLDFormatInfo& fmtInfo = aCaps.iFormatInfo;
+    Dump_TLDFormatInfo(fmtInfo);
+
+	if(fmtInfo.iFlags & TLDFormatInfo::EOneFatTable)
+		iNumberOfFats = 1;
+    else if(fmtInfo.iFlags & TLDFormatInfo::ETwoFatTables)
+		iNumberOfFats = 2;
+    else if(Drive().IsRemovable())
+		iNumberOfFats = KNumberOfFatsExternal;
+	else
+		iNumberOfFats = KNumberOfFatsInternal;	
+
+	iRootDirEntries=512;
+
+	iSectorsPerCluster = fmtInfo.iSectorsPerCluster;
+	iSectorsPerTrack   = fmtInfo.iSectorsPerTrack;
+	iNumberOfHeads	   = fmtInfo.iNumberOfSides;
+	iReservedSectors   = fmtInfo.iReservedSectors ? fmtInfo.iReservedSectors : KDefFatResvdSec;
+	
+    switch (fmtInfo.iFATBits)
+		{
+		case TLDFormatInfo::EFB12:
+            SetFatType(EFat12);
+			iSectorsPerFat  = MaxFat12Sectors();
+			break;
+
+		case TLDFormatInfo::EFB16:
+            SetFatType(EFat16);
+			iSectorsPerFat  = MaxFat16Sectors();
+            break;
+
+		case TLDFormatInfo::EFB32:
+            SetFatType(EFat32);
+			iReservedSectors = fmtInfo.iReservedSectors ? fmtInfo.iReservedSectors : KDefFat32ResvdSec;
+			iSectorsPerFat   = MaxFat32Sectors();
+			iRootDirEntries  = 0;
+			iRootClusterNum  = 2;
+            break;
+
+		default:
+			{
+			TInt64 clusters64 = (fmtInfo.iCapacity / KDefaultSectorSize) / iSectorsPerCluster;
+			TInt clusters = I64LOW(clusters64);
+			if (clusters < 4085)
+				{
+                SetFatType(EFat12);
+				iSectorsPerFat  = MaxFat12Sectors();
+				}
+			else if(clusters < 65525)
+				{
+                SetFatType(EFat16);
+				iSectorsPerFat  = MaxFat16Sectors();
+                }
+			else
+				{
+                SetFatType(EFat32);
+				iReservedSectors = fmtInfo.iReservedSectors ? fmtInfo.iReservedSectors : KDefFat32ResvdSec;
+				iSectorsPerFat   = MaxFat32Sectors();
+				iRootDirEntries  = 0;
+				iRootClusterNum  = 2;
+				}
+			}
+		}
+
+    return KErrNone;
+
+}
+
+//-------------------------------------------------------------------------------------------------------------------
+/**
+    Initialize format parameters by defult.
+    This method is called if the used has not specified any formatting parameters (all default)
+*/
+TInt CFatFormatCB::ProcessVolParam_Default(const TLocalDriveCapsV6& aCaps)
+{
+	__PRINT1(_L("CFatFormatCB::ProcessVolParam_Default sectors:%d"), iMaxDiskSectors);
+    
+    if( Drive().IsRemovable() )
+		iNumberOfFats = KNumberOfFatsExternal;
+	else
+		iNumberOfFats = KNumberOfFatsInternal;	
+ 	
+	iReservedSectors=KDefFatResvdSec;		
+	if (iMaxDiskSectors <=4084*1)	// 2MB
+		{
+		iRootDirEntries=128;
+		iSectorsPerCluster=1;
+        SetFatType(EFat12);
+		iSectorsPerFat=MaxFat12Sectors();
+   		}
+	else if (iMaxDiskSectors<4084*2) // < 4MB (8168 sectors)
+		{
+		iRootDirEntries=256; 
+		iSectorsPerCluster=2;
+        SetFatType(EFat12);
+		iSectorsPerFat=MaxFat12Sectors();
+		}
+	else if (iMaxDiskSectors<4084*4) // < 8MB (16336 sectors)
+		{
+		iRootDirEntries=512;
+		iSectorsPerCluster=4;
+        SetFatType(EFat12);
+		iSectorsPerFat=MaxFat12Sectors();
+		}
+	else if (iMaxDiskSectors<4084*8) // < 16MB (32672 sectors)
+		{
+		iRootDirEntries=512;
+		iSectorsPerCluster=8;
+        SetFatType(EFat12);
+		iSectorsPerFat=MaxFat12Sectors();
+		}
+	else if(iMaxDiskSectors<1048576) // >= 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;
+	}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
--- a/userlibandfileserver/fileserver/sfat32/sl_fmt.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfat32/sl_fmt.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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<TErrorInfo> 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;
--- a/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfile/sf_memory_man.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -42,6 +42,7 @@
 		delete iRegisteredClients[i];
 		}
 	iRegisteredClients.Close();
+	iChunk.Close();
 	}
 
 /**
--- a/userlibandfileserver/fileserver/sfile/sf_thread.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfile/sf_thread.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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);
 
--- a/userlibandfileserver/fileserver/sfile/traces/OstTraceDefinitions.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfile/traces/OstTraceDefinitions.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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 <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfsrv/cl_fman.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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()<sessionPath.Length())
 		iSessionPath=iSessionPath->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);
--- a/userlibandfileserver/fileserver/sfsrv/traces/OstTraceDefinitions.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/sfsrv/traces/OstTraceDefinitions.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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 <OpenSystemTrace.h>
+#include <opensystemtrace.h>
 #endif
--- a/userlibandfileserver/fileserver/smassstorage/cbulkonlytransport.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/smassstorage/cbulkonlytransport.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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();
-		}
 	}
 
 
--- a/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcldd.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcldd.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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;
 		}
--- a/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/smassstorage/cbulkonlytransportusbcscldd.cpp	Mon Oct 04 02:35:35 2010 +0300
@@ -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 ;
--- a/userlibandfileserver/fileserver/smassstorage/inc/cbulkonlytransport.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/smassstorage/inc/cbulkonlytransport.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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();
--- a/userlibandfileserver/fileserver/smassstorage/inc/mldddevicestatenotification.h	Fri Sep 17 08:37:04 2010 +0300
+++ b/userlibandfileserver/fileserver/smassstorage/inc/mldddevicestatenotification.h	Mon Oct 04 02:35:35 2010 +0300
@@ -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() {};
     };