backupandrestore/backupengine/src/sbebufferhandler.cpp
changeset 47 63cf70d3ecd8
parent 33 883e91c086aa
--- a/backupandrestore/backupengine/src/sbebufferhandler.cpp	Thu Sep 02 21:21:26 2010 +0300
+++ b/backupandrestore/backupengine/src/sbebufferhandler.cpp	Fri Sep 17 08:34:51 2010 +0300
@@ -21,8 +21,12 @@
 
 
 #include "sbebufferhandler.h"
-#include "sblog.h"
 #include "sbepanic.h"
+#include "OstTraceDefinitions.h"
+#include "sbtrace.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "sbebufferhandlerTraces.h"
+#endif
 
 namespace conn
 	{
@@ -36,6 +40,7 @@
 	@return ETrue if read succesfully. EFalse if a retry is needed.
 	*/
 		{
+		OstTraceFunctionEntry0( _CONN_READFROMBUFFERF_ENTRY );
 		static TBuf8<sizeof(T)> SBuffer; // Static buffer used for buffering!
 		TBool ret = EFalse;
 		
@@ -79,6 +84,7 @@
 			SBuffer.SetLength(0);
 			}
 			
+		OstTraceFunctionExit0( _CONN_READFROMBUFFERF_EXIT );
 		return ret;
 		}
 
@@ -96,6 +102,7 @@
 	@return ETrue on success. EFalse on failure.
 	*/
 		{
+		OstTraceFunctionEntry0( _CONN_WRITETOBUFFERF_ENTRY );
 		TBool ret = EFalse;
 		
 		if ((aPtr.MaxSize() - aPtr.Size()) >= static_cast<TInt>(sizeof(T)))
@@ -104,6 +111,7 @@
 			ret = ETrue;
 			} // if
 		
+		OstTraceFunctionExit0( _CONN_WRITETOBUFFERF_EXIT );
 		return ret;
 		}
 		
@@ -117,6 +125,7 @@
 	@return ETrue on success. EFalse on failure.
 	*/
 		{
+		OstTraceFunctionEntry0( _CONN_READFROMBUFFERV_ENTRY );
 		TBool ret = EFalse;
 		
 		// Does into already contain data?
@@ -143,6 +152,7 @@
 				} // else
 			} // else
 		
+		OstTraceFunctionExit0( _CONN_READFROMBUFFERV_EXIT );
 		return ret;
 		}
 		
@@ -157,6 +167,7 @@
 	@return ETrue on success. EFalse on failure.
 	*/
 		{
+		OstTraceFunctionEntry0( _CONN_WRITETOBUFFERV_ENTRY );
 		TBool ret = EFalse;
 		
 		if ((aBuffer.MaxSize() - aBuffer.Size()) >= aSize)
@@ -166,6 +177,7 @@
 			} // if
 		
 		
+		OstTraceFunctionExit0( _CONN_WRITETOBUFFERV_EXIT );
 		return ret;
 		}
 		
@@ -177,11 +189,13 @@
 	@return a CBufferFileWriter.
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEWRITER_NEWL_ENTRY );
 		CBufferFileWriter* self = new(ELeave) CBufferFileWriter(aFs, aFileNames);
 		CleanupStack::PushL(self);
 		self->ConstructL();
 		CleanupStack::Pop(self);
 		
+		OstTraceFunctionExit0( CBUFFERFILEWRITER_NEWL_EXIT );
 		return self;
 		} // NewL
 		
@@ -192,14 +206,18 @@
 	@param aFs an RFS to use in this class.
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEWRITER_CBUFFERFILEWRITER_CONS_ENTRY );
+		OstTraceFunctionExit0( CBUFFERFILEWRITER_CBUFFERFILEWRITER_CONS_EXIT );
 		} // CBufferFileWriter
 		
 	CBufferFileWriter::~CBufferFileWriter()
 	/** Standard C++ destructor
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEWRITER_CBUFFERFILEWRITER_DES_ENTRY );
 		delete iFileNames;
 		iFileHandle.Close();
+		OstTraceFunctionExit0( CBUFFERFILEWRITER_CBUFFERFILEWRITER_DES_EXIT );
 		}
 		
 	void CBufferFileWriter::ConstructL()
@@ -208,18 +226,18 @@
 	@param aFileNames list of files to write
 	*/
 		{
-		#if defined(SBE_LOGGING_ENABLED)
+		OstTraceFunctionEntry0( CBUFFERFILEWRITER_CONSTRUCTL_ENTRY );
 		if (iFileNames)
 			{
 			TUint count = iFileNames->Count();
 			while(count--)
 				{
 				const TDesC& fileName = (*iFileNames)[count];
-            	__LOG2("CBufferFileWriter::ConstructL() - file[%04d] is: %S", count, &fileName);
+				OstTraceExt2(TRACE_NORMAL, CBUFFERFILEWRITER_CONSTRUCTL, "file[%04d] is: %S", static_cast<TInt32>(count), fileName);
 				}
 			}
 		
-		#endif
+		OstTraceFunctionExit0( CBUFFERFILEWRITER_CONSTRUCTL_EXIT );
 		}
 		
 	void CBufferFileWriter::StartL(TPtr8& aBuffer, TBool& aCompleted)
@@ -229,9 +247,9 @@
 	@param aCompleted on return if we have finished.
 	*/
 		{
-        __LOG("CBufferFileWriter::StartL() - START");
-		WriteToBufferL(aBuffer, aCompleted);
-        __LOG("CBufferFileWriter::StartL() - END");
+        OstTraceFunctionEntry0( CBUFFERFILEWRITER_STARTL_ENTRY );        
+		WriteToBufferL(aBuffer, aCompleted);        
+		OstTraceFunctionExit0( CBUFFERFILEWRITER_STARTL_EXIT );
 		} // StartL
 		
 	void CBufferFileWriter::ContinueL(TPtr8& aBuffer, TBool& aCompleted)
@@ -241,9 +259,9 @@
 	@param aCompleted on return if we have finished.
 	*/
 		{
-        __LOG("CBufferFileWriter::ContinueL() - START");
-		WriteToBufferL(aBuffer, aCompleted);
-        __LOG("CBufferFileWriter::ContinueL() - END");
+        OstTraceFunctionEntry0( CBUFFERFILEWRITER_CONTINUEL_ENTRY );        
+		WriteToBufferL(aBuffer, aCompleted);        
+		OstTraceFunctionExit0( CBUFFERFILEWRITER_CONTINUEL_EXIT );
 		}
 
 	void CBufferFileWriter::WriteToBufferL(TPtr8& aBuffer, TBool& aCompleted)
@@ -253,6 +271,7 @@
 	@param aCompleted on return if we have finished.
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEWRITER_WRITETOBUFFERL_ENTRY );
 		aCompleted = EFalse;
 		
 		const TUint count = iFileNames->Count();
@@ -264,13 +283,13 @@
             if (name.Right(1) == KTrailingBackSlash() )
             	{
              	// Directory entry
- 	           	__LOG1("CBufferFileWriter::WriteToBufferL() - empty directory: %S ", &name);
+                OstTraceExt1(TRACE_NORMAL, CBUFFERFILEWRITER_WRITETOBUFFERL, "empty directory: %S ", name);
  	           	if(!iHeaderWritten)
  	        	   {
  	        	   TFileFixedHeader header(name.Length(), 0, 0, 0);
  	        	   if (WriteToBufferF(header, aBuffer) == EFalse)
  	        		   {
- 	        		   __LOG("CBufferFileReader::WriteToBufferL() - WriteToBufferF() returned False so breaking!");
+ 	        	       OstTrace0(TRACE_NORMAL, DUP1_CBUFFERFILEWRITER_WRITETOBUFFERL, "WriteToBufferF() returned False so breaking!");
  	        		   break;
  	        		   }
  	        	   iHeaderWritten = ETrue;
@@ -280,7 +299,7 @@
 				
 				if (WriteToBufferV(ptr, ptr.Size(), aBuffer) == EFalse)
 					{
-					__LOG("CBufferFileReader::WriteToBufferL() - WriteToBufferV() returned False so breaking!");
+				    OstTrace0(TRACE_NORMAL, DUP2_CBUFFERFILEWRITER_WRITETOBUFFERL, "WriteToBufferV() returned False so breaking!");
 					break;
 					}
 
@@ -291,11 +310,11 @@
             	{
 				if (!iFileOpen) // File needs to be opened
 					{
-	                __LOG1("CBufferFileWriter::WriteToBufferL() - trying to open: %S for reading", &name);
+				    OstTraceExt1(TRACE_NORMAL, DUP3_CBUFFERFILEWRITER_WRITETOBUFFERL, "trying to open: %S for reading", name);
 					const TInt error = iFileHandle.Open(iFs, name, EFileRead | EFileShareReadersOnly);
 	                if  (error != KErrNone)
 	                    {
-	                    __LOG2("CBufferFileWriter::WriteToBufferL() - opening: %S for reading failed with error: %d", &name, error);
+	                    OstTraceExt2(TRACE_ERROR, DUP4_CBUFFERFILEWRITER_WRITETOBUFFERL, "opening: %S for reading failed with error: %d", name, error);
 	                    User::Leave(error);
 	                    }
 
@@ -307,17 +326,17 @@
 					// File size
 					TInt size;
 					TInt err = iFileHandle.Size(size);
-	                __LOG2("CBufferFileWriter::WriteToBufferL() - size of file is: %d (err: %d)", size, err);
+					OstTraceExt2(TRACE_NORMAL, DUP5_CBUFFERFILEWRITER_WRITETOBUFFERL, "size of file is: %d (err: %d)", size, err);
 					TUint att;
 					err = iFileHandle.Att(att);
-					__LOG2("CBufferFileWriter::WriteToBufferL() - attributes: %d (err: %d)", size, err);
+					OstTraceExt2(TRACE_NORMAL, DUP6_CBUFFERFILEWRITER_WRITETOBUFFERL, "attributes: %d (err: %d)", att, err);
 					TTime modified;
-					err = iFileHandle.Modified(modified);
-					__LOG2("CBufferFileWriter::WriteToBufferL() - modified: %d (err: %d)", size, err);
+					err = iFileHandle.Modified(modified);					
+					OstTraceExt4(TRACE_NORMAL, DUP7_CBUFFERFILEWRITER_WRITETOBUFFERL, "modified: %d-%d-%d (err: %d)", static_cast<TInt>(modified.DateTime().Year()), static_cast<TInt>(modified.DateTime().Month() + 1), static_cast<TInt>(modified.DateTime().Day()), err);
 					TFileFixedHeader header((*iFileNames)[iCurrentFile].Length(), size, att, modified.Int64());
 					if (WriteToBufferF(header, aBuffer) == EFalse)
 						{
-						__LOG("CBufferFileReader::WriteToBufferL() - WriteToBufferF() returned False so breaking!");
+					    OstTrace0(TRACE_NORMAL, DUP8_CBUFFERFILEWRITER_WRITETOBUFFERL, "WriteToBufferF() returned False so breaking!");
 						break;
 						}
 						
@@ -332,13 +351,13 @@
 					
 					if (WriteToBufferV(ptr, ptr.Size(), aBuffer) == EFalse)
 						{
-						__LOG("CBufferFileReader::WriteToBufferV() - WriteToBufferF() returned False so breaking!");
+					    OstTrace0(TRACE_NORMAL, DUP9_CBUFFERFILEWRITER_WRITETOBUFFERL, "WriteToBufferF() returned False so breaking!");
 						break;
 						}
 					iFileNameWritten = ETrue;
 					}
 
-	            __LOG1("CBufferFileWriter::WriteToBufferL() - buffer is of length: %d", aBuffer.Length());
+				OstTrace1(TRACE_NORMAL, DUP10_CBUFFERFILEWRITER_WRITETOBUFFERL, "buffer is of length: %d", aBuffer.Length());
 					
 				TInt bufferLeft = aBuffer.MaxSize() - aBuffer.Size();
 				TPtr8 ptr(const_cast<TUint8*>(aBuffer.Ptr()) + aBuffer.Size(), bufferLeft);
@@ -347,24 +366,26 @@
 				TInt fileLeft = fileSize - iOffset;
 				if (bufferLeft < fileLeft)
 					{
-	                __LOG("CBufferFileWriter::WriteToBufferL() - buffer space available is less than file size!");
+				    OstTrace0(TRACE_NORMAL, DUP11_CBUFFERFILEWRITER_WRITETOBUFFERL, "buffer space available is less than file size!");
 
 	                // Write buffer size
-					User::LeaveIfError(iFileHandle.Read(iOffset, ptr, bufferLeft)); // TODO: Is this correct?
+				    TInt err = iFileHandle.Read(iOffset, ptr, bufferLeft); // TODO: Is this correct?
+					LEAVEIFERROR(err, OstTrace1(TRACE_ERROR, DUP14_CBUFFERFILEWRITER_WRITETOBUFFERL, "Leave: %d", err));
 					aBuffer.SetLength(aBuffer.Length() + bufferLeft);
 					iOffset += bufferLeft;
 					break;
 					} // if
 				else
 					{
-	                __LOG("CBufferFileWriter::WriteToBufferL() - enough space in buffer for whole file...");
+				    OstTrace0(TRACE_NORMAL, DUP12_CBUFFERFILEWRITER_WRITETOBUFFERL, "enough space in buffer for whole file...");
 
 	                // Write file size
-					User::LeaveIfError(iFileHandle.Read(ptr, fileLeft)); // TODO: Is this correct?
+				    TInt err = iFileHandle.Read(ptr, fileLeft); // TODO: Is this correct?
+					LEAVEIFERROR(err, OstTrace1(TRACE_ERROR, DUP15_CBUFFERFILEWRITER_WRITETOBUFFERL, "Leave: %d", err));
 					aBuffer.SetLength(aBuffer.Length() + fileLeft);
 					} // else
 
-	            __LOG1("CBufferFileWriter::WriteToBufferL() - After read from file, buffer is now of length: %d", aBuffer.Length());
+				OstTrace1(TRACE_NORMAL, DUP13_CBUFFERFILEWRITER_WRITETOBUFFERL, "After read from file, buffer is now of length: %d", aBuffer.Length());
 	            
 				iFileHandle.Close();
 				iFileOpen = EFalse;
@@ -379,6 +400,7 @@
 			{
 			aCompleted = ETrue;
 			} // if
+		OstTraceFunctionExit0( CBUFFERFILEWRITER_WRITETOBUFFERL_EXIT );
 		} // WriteToBufferL
 		
 	CBufferFileReader* CBufferFileReader::NewL(RFs& aFs, RSnapshots* apSnapshots, MValidationHandler* aValidationHandler)
@@ -388,29 +410,26 @@
 	@param apSnapshots list of snapshots.
 	*/
 		{
-        __LOG("CBufferFileReader::NewL() - START");
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_NEWL_ENTRY );        
 		CBufferFileReader* self = new(ELeave) CBufferFileReader(aFs, apSnapshots, aValidationHandler);
 		
 		CleanupStack::PushL( self );
 		
-	#ifdef SBE_LOGGING_ENABLED
         if  (apSnapshots)
             {
 		    const TInt count = apSnapshots->Count();
-            __LOG1("CBufferFileReader::NewL() - Got %d snapshots to compare against during restore...", count);
+		    OstTrace1(TRACE_NORMAL, CBUFFERFILEREADER_NEWL, "Got %d snapshots to compare against during restore...", count);
 
 		    for(TInt x = 0; x < count; ++x)
 			    {
                 const TDesC& snapshot = (*apSnapshots)[x]->FileName();
-                __LOG3("CBufferFileReader::NewL() -    snapshot[%4d/%4d] is: %S", x+1, count, &snapshot);
+                OstTraceExt3(TRACE_NORMAL, DUP1_CBUFFERFILEREADER_NEWL, "snapshot[%4d/%4d] is: %S", x+1, count, snapshot);
 			    } // for x
 
 		    }
-	#endif
-        
-        __LOG("CBufferFileReader::NewL() - END");
         
         CleanupStack::Pop( self );
+		OstTraceFunctionExit0( CBUFFERFILEREADER_NEWL_EXIT );
 		return self;
 		} // NewL
 		
@@ -422,6 +441,8 @@
 	@param apSnapshots list of snapshots.
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEREADER_CBUFFERFILEREADER_CONS_ENTRY );
+		OstTraceFunctionExit0( CBUFFERFILEREADER_CBUFFERFILEREADER_CONS_EXIT );
 		} // CBufferFileReader
 		
 	void CBufferFileReader::StartL(const TDesC8& aBuffer, TBool aLastSection)
@@ -431,13 +452,13 @@
 	@param aLastSection Is this the last section?
 	*/
 		{
-        __LOG("CBufferFileReader::StartL() - START");
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_STARTL_ENTRY );        
         if (iSnapshots)
         	{
         	iSnapshots->Sort(CSnapshot::Compare);
         	}
-		ReadFromBufferL(aBuffer, aLastSection);
-        __LOG("CBufferFileReader::StartL() - END");
+		ReadFromBufferL(aBuffer, aLastSection);        
+		OstTraceFunctionExit0( CBUFFERFILEREADER_STARTL_EXIT );
 		} // StartL
 	
 	void CBufferFileReader::ContinueL(const TDesC8& aBuffer, TBool aLastSection)
@@ -447,9 +468,9 @@
 	@param aLastSection Is this the last section?
 	*/
 		{
-        __LOG("CBufferFileReader::ContinueL() - START");
-		ReadFromBufferL(aBuffer, aLastSection);
-        __LOG("CBufferFileReader::ContinueL() - END");
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_CONTINUEL_ENTRY );        
+		ReadFromBufferL(aBuffer, aLastSection);        
+		OstTraceFunctionExit0( CBUFFERFILEREADER_CONTINUEL_EXIT );
 		} // ContinueL
 	
 	void CBufferFileReader::CheckFileInSnapshotL()
@@ -457,7 +478,8 @@
 	Checks to see if a given file is in a snapshot.
 	*/
 		{
-        __LOG2("CBufferFileReader::CheckFileInSnapshot() - START - ipSnapshots: 0x%08x, iSnapshotChecked: %d", iSnapshots, iSnapshotChecked);
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_CHECKFILEINSNAPSHOTL_ENTRY );
+        OstTraceExt2(TRACE_NORMAL, CBUFFERFILEREADER_CHECKFILEINSNAPSHOTL, "ipSnapshots: 0x%08x, iSnapshotChecked: %d", reinterpret_cast<TInt32>(iSnapshots), static_cast<TInt32>(iSnapshotChecked));
 
 		iRestore = ETrue;
 		
@@ -474,7 +496,8 @@
 		
 		iSnapshotChecked = ETrue;
 
-        __LOG2("CBufferFileReader::CheckFileInSnapshot() - END - iSnapshotChecked: %d, iRestore: %d", iSnapshotChecked, iRestore);
+		OstTraceExt2(TRACE_NORMAL, DUP1_CBUFFERFILEREADER_CHECKFILEINSNAPSHOTL, "iSnapshotChecked: %d, iRestore: %d", iSnapshotChecked, iRestore);
+		OstTraceFunctionExit0( CBUFFERFILEREADER_CHECKFILEINSNAPSHOTL_EXIT );
 		}
 		
 	void CBufferFileReader::RecreateDirL()
@@ -482,16 +505,17 @@
 	Recreates a directory path on disk.
 	*/
 		{
-        __LOG1("CBufferFileReader::RecreateDirL() - START - iFileName: %S", &iFileName);
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_RECREATEDIRL_ENTRY );
+        OstTraceExt1(TRACE_NORMAL, CBUFFERFILEREADER_RECREATEDIRL, "iFileName: %S", iFileName);
 		// Create the path
 		TInt err = iFs.MkDirAll(iFileName);
 		if ((err != KErrNone) && (err != KErrAlreadyExists))
 			{
-            __LOG1("CBufferFileReader::WriteToFile() - making directory resulted in fatal error: %d", err);
+		    OstTrace1(TRACE_ERROR, DUP1_CBUFFERFILEREADER_RECREATEDIRL, "making directory resulted in fatal error: %d", err);
 			User::Leave(err);
 			} // if
         
-        __LOG("CBufferFileReader::RecreateDirL() - END");
+		OstTraceFunctionExit0( CBUFFERFILEREADER_RECREATEDIRL_EXIT );
 		}
 		
 	
@@ -500,12 +524,13 @@
 	Recreates a file on disk. Deletes the original if it still exists.
 	*/
 		{
-        __LOG1("CBufferFileReader::RecreateFileL() - START - iFileName: %S", &iFileName);
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_RECREATEFILEL_ENTRY );
+        OstTraceExt1(TRACE_NORMAL, CBUFFERFILEREADER_RECREATEFILEL, "iFileName: %S", iFileName);
 		// Create the path
 		TInt err = iFs.MkDirAll(iFileName);
 		if ((err != KErrNone) && (err != KErrAlreadyExists))
 			{
-            __LOG1("CBufferFileReader::WriteToFile() - making directory resulted in fatal error: %d", err);
+		    OstTrace1(TRACE_ERROR, DUP1_CBUFFERFILEREADER_RECREATEFILEL, "making directory resulted in fatal error: %d", err);
 			User::Leave(err);
 			} // if
 		
@@ -523,8 +548,8 @@
 			}				
 				
         err = iFileHandle.Replace(iFs, iFileName, EFileWrite);
-        __LOG1("CBufferFileReader::WriteToFile() - replacing file returned err: %d", err);
-        User::LeaveIfError( err );
+        OstTrace1(TRACE_NORMAL, DUP2_CBUFFERFILEREADER_RECREATEFILEL, "CBufferFileReader::WriteToFile() - replacing file returned err: %d", err);
+        LEAVEIFERROR( err, OstTrace1(TRACE_ERROR, DUP3_CBUFFERFILEREADER_RECREATEFILEL, "Leave: %d", err) );
         
         if(isReadOnly)
         	{
@@ -532,8 +557,8 @@
         	iFs.SetAtt(iFileName, entry.iAtt, ~entry.iAtt);
         	}
 			
-		iFileOpen = ETrue;
-        __LOG("CBufferFileReader::RecreateFileL() - END");
+		iFileOpen = ETrue;        
+		OstTraceFunctionExit0( CBUFFERFILEREADER_RECREATEFILEL_EXIT );
 		}
 	
 		
@@ -546,25 +571,26 @@
 	@return ETrue if write finished. EFalse if there is more data to write.
 	*/
 		{
-        __LOG2("CBufferFileReader::WriteToFile() - START - iFileHandle: 0x%08x, iFixedHeader.iFileSize: %d", iFileHandle.SubSessionHandle(), iFixedHeader.iFileSize);
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_WRITETOFILEL_ENTRY );
+        OstTraceExt2(TRACE_NORMAL, CBUFFERFILEREADER_WRITETOFILEL, "iFileHandle: 0x%08x, iFixedHeader.iFileSize: %d", iFileHandle.SubSessionHandle(), iFixedHeader.iFileSize);
 		TBool retVal = ETrue;
 		TInt filesize;
 		const TInt err1 = iFileHandle.Size(filesize);
-        __LOG2("CBufferFileReader::WriteToFile() - fileSize: %d (err: %d)", filesize, err1);
-		User::LeaveIfError(err1);
+		OstTraceExt2(TRACE_NORMAL, DUP1_CBUFFERFILEREADER_WRITETOFILEL, "fileSize: %d (err: %d)", filesize, err1);
+		LEAVEIFERROR(err1, OstTrace1(TRACE_ERROR, DUP6_CBUFFERFILEREADER_WRITETOFILEL, "Leave: %d", err1));
 		if ((aEnd - aCurrent) >= (iFixedHeader.iFileSize - filesize))
 			{
 			TPtr8 ptr(aCurrent, iFixedHeader.iFileSize -filesize, iFixedHeader.iFileSize - filesize);
 			const TInt err2 = iFileHandle.Write(ptr);
-            __LOG2("CBufferFileReader::WriteToFile() - writing %d bytes returned error: %d", ptr.Length(), err2);
-			User::LeaveIfError(err2);
+			OstTraceExt2(TRACE_NORMAL, DUP2_CBUFFERFILEREADER_WRITETOFILEL, "writing %d bytes returned error: %d", ptr.Length(), err2);
+			LEAVEIFERROR(err2, OstTrace1(TRACE_ERROR, DUP7_CBUFFERFILEREADER_WRITETOFILEL, "Leave: %d", err2));
 
 			// Write the attributes & modified time
 			const TInt err3 = iFileHandle.Set(iFixedHeader.iModified, 
 					iFixedHeader.iAttributes, KEntryAttNormal);
 
-            __LOG1("CBufferFileReader::WriteToFile() - setting attribs returned error: %d", err3);
-			User::LeaveIfError(err3);
+			OstTrace1(TRACE_NORMAL, DUP3_CBUFFERFILEREADER_WRITETOFILEL, "setting attribs returned error: %d", err3);
+			LEAVEIFERROR(err3, OstTrace1(TRACE_ERROR, DUP8_CBUFFERFILEREADER_WRITETOFILEL, "Leave: %d", err3));
 			
 			// Move current along
 			aCurrent += iFixedHeader.iFileSize - filesize;
@@ -577,12 +603,13 @@
 			TInt size = aEnd - aCurrent;
 			TPtr8 ptr(aCurrent, size, size);
 			const TInt err2 = iFileHandle.Write(ptr);
-            __LOG2("CBufferFileReader::WriteToFile() - writing %d bytes returned error: %d", ptr.Length(), err2);
+			OstTraceExt2(TRACE_NORMAL, DUP4_CBUFFERFILEREADER_WRITETOFILEL, "writing %d bytes returned error: %d", ptr.Length(), err2);
 
 			retVal = EFalse;
 			} // else
 			
-        __LOG1("CBufferFileReader::WriteToFile() - END - finished: %d", retVal);
+		OstTrace1(TRACE_NORMAL, DUP5_CBUFFERFILEREADER_WRITETOFILEL, "finished: %d", retVal);
+		OstTraceFunctionExit0( CBUFFERFILEREADER_WRITETOFILEL_EXIT );
 		return retVal;
 		}
 
@@ -594,7 +621,8 @@
 	@leave KErrUnderflow More data is needed.
 	*/	
         {
-        __LOG5("CBufferFileReader::ReadFromBufferL() - START - iFileNameRead: %d, iSnapshotChecked: %d, iRestore: %d, iFileOpen: %d, iFileName: %S", iFileNameRead, iSnapshotChecked, iRestore, iFileOpen, &iFileName);
+        OstTraceFunctionEntry0( CBUFFERFILEREADER_READFROMBUFFERL_ENTRY );
+        OstTraceExt5(TRACE_NORMAL, CBUFFERFILEREADER_READFROMBUFFERL, "iFileNameRead: %d, iSnapshotChecked: %d, iRestore: %d, iFileOpen: %d, iFileName: %S", iFileNameRead, iSnapshotChecked, iRestore, iFileOpen, iFileName);
 
         TUint8* current = const_cast<TUint8*>(aBuffer.Ptr());
 		const TUint8* end = current + aBuffer.Size();
@@ -616,31 +644,31 @@
 
 			if(workAroundNeeded)
 				{
-				__LOG("CBufferFileReader::ReadFromBufferL() - Dual header was detected, workaround!!!");
+			    OstTrace0(TRACE_NORMAL, DUP1_CBUFFERFILEREADER_READFROMBUFFERL, "Dual header was detected, workaround!!!");
 				iFixedHeaderRead = EFalse; // Mark that the processing loop reads the fixed header again
 				}
 			}
 		
 		while (current < end)
 			{
-            __LOG2("CBufferFileReader::ReadFromBufferL() - iFixedHeaderRead: %d, iLeftToSkip: %d", iFixedHeaderRead, iLeftToSkip);
+		    OstTraceExt2(TRACE_NORMAL, DUP2_CBUFFERFILEREADER_READFROMBUFFERL, "iFixedHeaderRead: %d, iLeftToSkip: %d", iFixedHeaderRead, iLeftToSkip);
 
 			// Do we have the fixed header?
 			if (!iFixedHeaderRead)
 				{
 				if (ReadFromBufferF(iFixedHeader, current, end) == EFalse)
 					{
-					__LOG("CBufferFileReader::ReadFromBufferL() - ReadFromBufferF() returned False so breaking!");
+				    OstTrace0(TRACE_NORMAL, DUP3_CBUFFERFILEREADER_READFROMBUFFERL, "ReadFromBufferF() returned False so breaking!");
 					break;
 					} // if
 				
-                __LOG1("CBufferFileReader::ReadFromBufferL() - fixed header - iFileNameLength:  %d", iFixedHeader.iFileNameLength);
-                __LOG1("CBufferFileReader::ReadFromBufferL() - fixed header - iFileSize:        %d", iFixedHeader.iFileSize);
-                __LOG1("CBufferFileReader::ReadFromBufferL() - fixed header - iAttributes:      %d", iFixedHeader.iAttributes);
+				OstTrace1(TRACE_NORMAL, DUP4_CBUFFERFILEREADER_READFROMBUFFERL, "fixed header - iFileNameLength:  %d", iFixedHeader.iFileNameLength);
+				OstTrace1(TRACE_NORMAL, DUP5_CBUFFERFILEREADER_READFROMBUFFERL, "fixed header - iFileSize:        %d", iFixedHeader.iFileSize);
+				OstTrace1(TRACE_NORMAL, DUP6_CBUFFERFILEREADER_READFROMBUFFERL, "fixed header - iAttributes:      %d", iFixedHeader.iAttributes);
                 
                 if ((iFixedHeader.iFileNameLength > KMaxFileName) || (!iFixedHeader.iFileNameLength))
 					{
-					__LOG1("CBufferFileReader::ReadFromBufferL() - Leaving - iFileNameLength: %d more then MaxLength", iFixedHeader.iFileNameLength);
+                    OstTrace1(TRACE_ERROR, DUP7_CBUFFERFILEREADER_READFROMBUFFERL, "Leaving - iFileNameLength: %d more then MaxLength", iFixedHeader.iFileNameLength);
 					User::Leave(KErrOverflow);
 					}
                 
@@ -648,7 +676,7 @@
 				} // if
 
 				
-            __LOG1("CBufferFileReader::ReadFromBufferL() - iFileNameRead: %d", iFileNameRead);
+			OstTrace1(TRACE_NORMAL, DUP8_CBUFFERFILEREADER_READFROMBUFFERL, "iFileNameRead: %d", iFileNameRead);
 			if (!iFileNameRead)
 				{
 				TPtr8 ptr(reinterpret_cast<TUint8*>(const_cast<TUint16*>(iFileName.Ptr())), iBytesRead, iFixedHeader.iFileNameLength * KCharWidthInBytes);
@@ -656,46 +684,46 @@
 				if (ReadFromBufferV(ptr, iFixedHeader.iFileNameLength * KCharWidthInBytes, current, end) == EFalse)
 					{
 					iBytesRead = ptr.Size();
-					__LOG1("CBufferFileReader::ReadFromBufferL() - ReadFromBufferV() returned False - Filename bytes read: %d", iBytesRead);
+					OstTrace1(TRACE_NORMAL, DUP9_CBUFFERFILEREADER_READFROMBUFFERL, "ReadFromBufferV() returned False - Filename bytes read: %d", iBytesRead);
 					break;
 					} // if
 				
 				iFileName.SetLength(iFixedHeader.iFileNameLength);
 				iFileNameRead = ETrue;
-                __LOG1("CBufferFileReader::ReadFromBufferL() - Got filename: %S", &iFileName);
+				OstTraceExt1(TRACE_NORMAL, DUP10_CBUFFERFILEREADER_READFROMBUFFERL, "Got filename: %S", iFileName);
 				}
 			
 			// Is the file in the snapshot, if not it was deleted in an increment and does not need restoring
-            __LOG1("CBufferFileReader::ReadFromBufferL() - iSnapshotChecked: %d", iSnapshotChecked);
+			OstTrace1(TRACE_NORMAL, DUP11_CBUFFERFILEREADER_READFROMBUFFERL, "iSnapshotChecked: %d", iSnapshotChecked);
 			if (!iSnapshotChecked)
 				{
 				CheckFileInSnapshotL();
 				} // if
 			
-            __LOG2("CBufferFileReader::ReadFromBufferL() - iValidationHandler: 0x%08x, iRestore: %d", iValidationHandler, iRestore);
+			OstTraceExt2(TRACE_NORMAL, DUP12_CBUFFERFILEREADER_READFROMBUFFERL, "iValidationHandler: 0x%08x, iRestore: %d", reinterpret_cast<TInt32>(iValidationHandler), static_cast<TInt32>(iRestore));
 			if (iValidationHandler != NULL)
 				{
 				if (iRestore)
 					{
 					iRestore = iValidationHandler->ValidFileL(iFileName);
-                    __LOG1("CBufferFileReader::ReadFromBufferL() - validation handler result: %d", iRestore);
+					OstTrace1(TRACE_NORMAL, DUP13_CBUFFERFILEREADER_READFROMBUFFERL, "validation handler result: %d", iRestore);
 					}
 				}
 			
 			if (!iRestore && !iLeftToSkip)
 				{
-                __LOG1("CBufferFileReader::ReadFromBufferL() - restore not permitted, skipping file data (%d bytes)", iFixedHeader.iFileSize);
+			    OstTrace1(TRACE_NORMAL, DUP14_CBUFFERFILEREADER_READFROMBUFFERL, "restore not permitted, skipping file data (%d bytes)", iFixedHeader.iFileSize);
 				iLeftToSkip = iFixedHeader.iFileSize; // So we can skip the bytes
 				}
 			
-            __LOG1("CBufferFileReader::ReadFromBufferL() - iFileOpen: %d", iFileOpen);
+			OstTrace1(TRACE_NORMAL, DUP15_CBUFFERFILEREADER_READFROMBUFFERL, "iFileOpen: %d", iFileOpen);
 			if (iRestore)
 				{
 				// Check if it is a directory or file
 				_LIT( KTrailingBackSlash, "\\" );
 				if (iFileName.Right(1) == KTrailingBackSlash())
 					{
-					__LOG("CBufferFileReader::ReadFromBufferL() - Attempting to recreate directory path...");
+				    OstTrace0(TRACE_NORMAL, DUP16_CBUFFERFILEREADER_READFROMBUFFERL, "Attempting to recreate directory path...");
 					RecreateDirL();
 					Reset();
 					}
@@ -704,15 +732,15 @@
 					// Have we opened the file?
 					if (!iFileOpen)
 						{
-						__LOG("CBufferFileReader::ReadFromBufferL() - Attempting to recreate file...");
+					    OstTrace0(TRACE_NORMAL, DUP17_CBUFFERFILEREADER_READFROMBUFFERL, "Attempting to recreate file...");
 						RecreateFileL();		
 						}
 					
 					// Write to the file
-	                __LOG("CBufferFileReader::ReadFromBufferL() - Attempting to write to file...");
+					OstTrace0(TRACE_NORMAL, DUP18_CBUFFERFILEREADER_READFROMBUFFERL, "Attempting to write to file...");
 					if (!WriteToFileL(current, end))
 						{
-						__LOG("CBufferFileReader::ReadFromBufferL() - WriteToFileL() returned False so breaking!");
+					    OstTrace0(TRACE_NORMAL, DUP19_CBUFFERFILEREADER_READFROMBUFFERL, "WriteToFileL() returned False so breaking!");
 						break;
 						}	
 					}//if
@@ -720,34 +748,34 @@
 			else
 				{
 				// We need to skip the bytes in the data
-                __LOG2("CBufferFileReader::ReadFromBufferL() - We\'re in skip mode. EndPos: %8d, CurrentPos: %8d", end, current);
+			    OstTraceExt2(TRACE_NORMAL, DUP20_CBUFFERFILEREADER_READFROMBUFFERL, "We\'re in skip mode. EndPos: %8d, CurrentPos: %8d", reinterpret_cast<TInt32>(end), reinterpret_cast<TInt32>(current));
 				if ((end - current) >= iLeftToSkip)
 					{
 					current += iLeftToSkip;
 
 					// Finished reset state
-                    __LOG("CBufferFileReader::ReadFromBufferL() - Finished skipping");
+					OstTrace0(TRACE_NORMAL, DUP21_CBUFFERFILEREADER_READFROMBUFFERL, "Finished skipping");
 					Reset();
 					} // if
 				else
 					{
-                    __LOG1("CBufferFileReader::ReadFromBufferL() - Still more data to skip...: %d bytes", iLeftToSkip);
+				    OstTrace1(TRACE_NORMAL, DUP22_CBUFFERFILEREADER_READFROMBUFFERL, "Still more data to skip...: %d bytes", iLeftToSkip);
 					iLeftToSkip = iLeftToSkip - (end - current);
 					break;
 					} // else
 				} // else
 			} // while
 			
-            __LOG3("CBufferFileReader::ReadFromBufferL() - aLastSection: %d, iFileOpen: %d, iLeftToSkip: %d", aLastSection, iFileOpen, iLeftToSkip);
+            OstTraceExt3(TRACE_NORMAL, DUP23_CBUFFERFILEREADER_READFROMBUFFERL, "aLastSection: %d, iFileOpen: %d, iLeftToSkip: %d", aLastSection, iFileOpen, iLeftToSkip);
 
 			if ((aLastSection && iFileOpen) ||
 			    (aLastSection && (iLeftToSkip > 0)))
 				{
-                __LOG("CBufferFileReader::ReadFromBufferL() - Leaving with KErrUnderflow because not all skipped data was consumed!");
+			    OstTrace0(TRACE_ERROR, DUP24_CBUFFERFILEREADER_READFROMBUFFERL, "Leaving with KErrUnderflow because not all skipped data was consumed!");
 				User::Leave(KErrUnderflow);
 			} // if
-
-        __LOG("CBufferFileReader::ReadFromBufferL() - END");
+        
+		OstTraceFunctionExit0( CBUFFERFILEREADER_READFROMBUFFERL_EXIT );
 		} // ReadFromBufferL
 		
 	void CBufferFileReader::RedirectMIDletRestorePathL(const TDesC& aOriginal, CDesCArray& aRedirected)
@@ -757,6 +785,7 @@
 	@param aRedirected the redirected path
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEREADER_REDIRECTMIDLETRESTOREPATHL_ENTRY );
 		TFileName redirectedFilename(KMIDletTempRestorePath);
 		// Backslash used to isolate the filename from aOriginal's absolute path
 		const TChar KTCharBackslash('\\');
@@ -764,6 +793,7 @@
 		// Isolate the filename from aOriginal and Append it to our temp path
 		redirectedFilename.Append(aOriginal.Mid(aOriginal.LocateReverseF(KTCharBackslash) + 1));
 		aRedirected.AppendL(redirectedFilename);
+		OstTraceFunctionExit0( CBUFFERFILEREADER_REDIRECTMIDLETRESTOREPATHL_EXIT );
 		}
 
 	void CBufferFileReader::ReadMIDletsFromBufferL(const TDesC8& aBuffer, TBool aLastSection, 
@@ -775,6 +805,7 @@
 	@leave KErrUnderflow More data is needed.
 	*/	
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEREADER_READMIDLETSFROMBUFFERL_ENTRY );
 		TUint8* current = const_cast<TUint8*>(aBuffer.Ptr());
 		const TUint8* end = current + aBuffer.Size();
 		TInt fileIndex = 0;
@@ -785,16 +816,16 @@
 				{
 				if (ReadFromBufferF(iFixedHeader, current, end) == EFalse)
 					{
-					__LOG("CBufferFileReader::ReadMIDletsFromBufferL() - ReadFromBufferF() returned False so breaking!");
+				    OstTrace0(TRACE_NORMAL, CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "ReadFromBufferF() returned False so breaking!");
 					break;
 					} // if
-				__LOG1("CBufferFileReader::ReadMIDletsFromBufferL() - fixed header - iFileNameLength:  %d", iFixedHeader.iFileNameLength);
-                __LOG1("CBufferFileReader::ReadMIDletsFromBufferL() - fixed header - iFileSize:        %d", iFixedHeader.iFileSize);
-                __LOG1("CBufferFileReader::ReadMIDletsFromBufferL() - fixed header - iAttributes:      %d", iFixedHeader.iAttributes);	
+				OstTrace1(TRACE_NORMAL, DUP1_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "fixed header - iFileNameLength:  %d", iFixedHeader.iFileNameLength);
+				OstTrace1(TRACE_NORMAL, DUP2_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "fixed header - iFileSize:        %d", iFixedHeader.iFileSize);
+				OstTrace1(TRACE_NORMAL, DUP3_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "fixed header - iAttributes:      %d", iFixedHeader.iAttributes);	
 					
 				if ((iFixedHeader.iFileNameLength > KMaxFileName) || (!iFixedHeader.iAttributes) || (!iFixedHeader.iFileNameLength))
 					{
-					__LOG1("CBufferFileReader::ReadMIDletsFromBufferL() - Leaving - iFileNameLength: %d more then MaxLength", iFixedHeader.iFileNameLength);
+				    OstTrace1(TRACE_ERROR, DUP4_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "Leaving - iFileNameLength: %d more then MaxLength", iFixedHeader.iFileNameLength);
 					User::Leave(KErrOverflow);
 					}
 				
@@ -808,7 +839,7 @@
 				if (ReadFromBufferV(ptr, iFixedHeader.iFileNameLength * KCharWidthInBytes, current, end) == EFalse)
 					{
 					iBytesRead = ptr.Size();
-					__LOG1("CBufferFileReader::ReadMIDletsFromBufferL() - ReadFromBufferV() returned False - Filename bytes read: %d", iBytesRead);
+					OstTrace1(TRACE_NORMAL, DUP5_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "ReadFromBufferV() returned False - Filename bytes read: %d", iBytesRead);
 					break;
 					} // if
 				
@@ -835,7 +866,7 @@
 			
 			if (!iRestore && !iLeftToSkip)
 				{
-                __LOG1("CBufferFileReader::ReadMIDletsFromBufferL() - restore not permitted, skipping file data (%d bytes)", iFixedHeader.iFileSize);
+			    OstTrace1(TRACE_NORMAL, DUP6_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "restore not permitted, skipping file data (%d bytes)", iFixedHeader.iFileSize);
 				iLeftToSkip = iFixedHeader.iFileSize; // So we can skip the bytes
 				}
 
@@ -850,7 +881,7 @@
 				// Write to the file
 				if (!WriteToFileL(current, end))
 					{
-					__LOG("CBufferFileReader::ReadMIDletsFromBufferL() - WriteToFileL() returned False so breaking!");
+				    OstTrace0(TRACE_NORMAL, DUP7_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "WriteToFileL() returned False so breaking!");
 					break;
 					}
 				} // if
@@ -866,7 +897,7 @@
 					} // if
 				else
 					{
-					__LOG1("CBufferFileReader::ReadMIDletsFromBufferL() - Still more data to skip...: %d bytes", iLeftToSkip);
+				    OstTrace1(TRACE_NORMAL, DUP8_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "Still more data to skip...: %d bytes", iLeftToSkip);
 					iLeftToSkip = iLeftToSkip - (end - current);
 					break;
 					} // else
@@ -876,14 +907,17 @@
 			if ((aLastSection && iFileOpen) ||
 			    (aLastSection && (iLeftToSkip > 0)))
 				{
+			    OstTrace0(TRACE_ERROR, DUP9_CBUFFERFILEREADER_READMIDLETSFROMBUFFERL, "Leave: KErrUnderflow");
 				User::Leave(KErrUnderflow);
 				} // if
+		OstTraceFunctionExit0( CBUFFERFILEREADER_READMIDLETSFROMBUFFERL_EXIT );
 		} // ReadMIDletsFromBufferL
 		
 	void CBufferFileReader::Reset()
 	/** Resets the state of the object.
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEREADER_RESET_ENTRY );
 		iFileHandle.Close();
 		iFileOpen = EFalse;
 		iFileNameRead = EFalse;
@@ -892,13 +926,16 @@
 		iFileName.SetLength(0);
 		iFixedHeaderRead = EFalse;
 		iBytesRead = 0;
+		OstTraceFunctionExit0( CBUFFERFILEREADER_RESET_EXIT );
 		}
 		
 	CBufferFileReader::~CBufferFileReader()
 	/** destructor
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERFILEREADER_CBUFFERFILEREADER_DES_ENTRY );
 		iFileHandle.Close();
+		OstTraceFunctionExit0( CBUFFERFILEREADER_CBUFFERFILEREADER_DES_EXIT );
 		}
 		
 	
@@ -909,11 +946,13 @@
 	@param aFiles File information to write to the buffer.ownernship transfer
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERSNAPSHOTWRITER_NEWL_ENTRY );
 		CBufferSnapshotWriter* self = new(ELeave) CBufferSnapshotWriter(aSnapshots);
 		CleanupStack::PushL(self);
 		self->ConstructL();
 		CleanupStack::Pop(self);
 		
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTWRITER_NEWL_EXIT );
 		return self;
 		} // NewL
 		
@@ -921,6 +960,8 @@
 	/** Standard C++ constructor
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERSNAPSHOTWRITER_CBUFFERSNAPSHOTWRITER_CONS_ENTRY );
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTWRITER_CBUFFERSNAPSHOTWRITER_CONS_EXIT );
 		}
 		
 	void CBufferSnapshotWriter::ConstructL()
@@ -929,29 +970,32 @@
 	@param aFiles File information to write to the buffer.
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERSNAPSHOTWRITER_CONSTRUCTL_ENTRY );
 		__ASSERT_DEBUG(iSnapshots, Panic(KErrArgument));
-		#ifdef SBE_LOGGING_ENABLED
+
         const TInt count = iSnapshots->Count();
-        __LOG1("CBufferFileReader::NewL() - Got %d snapshots to compare against during restore...", count);
+        OstTrace1(TRACE_NORMAL, CBUFFERSNAPSHOTWRITER_CONSTRUCTL, "Got %d snapshots to compare against during restore...", count);
 
 	    for(TInt x = 0; x < count; ++x)
 		    {
             const TDesC& snapshot = (*iSnapshots)[x]->FileName();
-            __LOG3("CBufferFileReader::NewL() -    snapshot[%4d/%4d] is: %S", x+1, count, &snapshot);
+            OstTraceExt3(TRACE_NORMAL, DUP1_CBUFFERSNAPSHOTWRITER_CONSTRUCTL, "snapshot[%4d/%4d] is: %S", x+1, count, snapshot);
 		    } // for x
 
-		#endif
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTWRITER_CONSTRUCTL_EXIT );
 		} // ConstructL
 		
 	CBufferSnapshotWriter::~CBufferSnapshotWriter()
 	/** Standard C++ destructor
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERSNAPSHOTWRITER_CBUFFERSNAPSHOTWRITER_DES_ENTRY );
 		if(iSnapshots)
 			{
 			iSnapshots->ResetAndDestroy();
 			delete iSnapshots;
 			}
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTWRITER_CBUFFERSNAPSHOTWRITER_DES_EXIT );
 		} // ~CBufferSnapshotWriter
 		
 	void CBufferSnapshotWriter::StartL(TPtr8& aBuffer, TBool& aCompleted)
@@ -961,9 +1005,9 @@
 	@param aCompleted On return if we have finished writing data.
 	*/
 		{
-        __LOG("CBufferSnapshotWriter::StartL() - START");
-		WriteToBufferL(aBuffer, aCompleted);
-        __LOG("CBufferSnapshotWriter::StartL() - END");
+        OstTraceFunctionEntry0( CBUFFERSNAPSHOTWRITER_STARTL_ENTRY );        
+		WriteToBufferL(aBuffer, aCompleted);        
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTWRITER_STARTL_EXIT );
 		} // WriteToBufferL
 
 	void CBufferSnapshotWriter::ContinueL(TPtr8& aBuffer, TBool& aCompleted)
@@ -973,9 +1017,9 @@
 	@param aCompleted On return if we have finished writing data.
 	*/
 		{
-        __LOG("CBufferSnapshotWriter::ContinueL() - START");
-		WriteToBufferL(aBuffer, aCompleted);
-        __LOG("CBufferSnapshotWriter::ContinueL() - END");
+        OstTraceFunctionEntry0( CBUFFERSNAPSHOTWRITER_CONTINUEL_ENTRY );        
+		WriteToBufferL(aBuffer, aCompleted);        
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTWRITER_CONTINUEL_EXIT );
 		} // WriteToBufferL
 		
 	void CBufferSnapshotWriter::WriteToBufferL(TPtr8& aBuffer, TBool& aCompleted)
@@ -985,25 +1029,26 @@
 	@param aCompleted On return if we have finished writing data.
 	*/
 		{
-        __LOG1("CBufferSnapshotWriter::WriteToBufferL() - START - aBuffer length: %d", aBuffer.Length());
+        OstTraceFunctionEntry0( CBUFFERSNAPSHOTWRITER_WRITETOBUFFERL_ENTRY );
+        OstTrace1(TRACE_NORMAL, CBUFFERSNAPSHOTWRITER_WRITETOBUFFERL, "aBuffer length: %d", aBuffer.Length());
 		aCompleted = EFalse;
 		
 		const TUint count = iSnapshots->Count();
 		while (iCurrentSnapshot < count)
 			{
-            __LOG1("CBufferSnapshotWriter::WriteToBufferL() - iCurrentSnapshot: %d", iCurrentSnapshot);
+		    OstTrace1(TRACE_NORMAL, DUP1_CBUFFERSNAPSHOTWRITER_WRITETOBUFFERL, "iCurrentSnapshot: %d", iCurrentSnapshot);
 
 			// Check there is enough room
 			if (sizeof(TSnapshot) > static_cast<TUint>(aBuffer.MaxSize() - aBuffer.Size()))
 				{
-				__LOG("CBufferSnapshotWriter::WriteToBufferL() - Snapshot size is more than buffer available - break");
+			    OstTrace0(TRACE_NORMAL, DUP2_CBUFFERSNAPSHOTWRITER_WRITETOBUFFERL, "Snapshot size is more than buffer available - break");
 				break;
 				} // if
 				
 			// Write modified
 			TSnapshot snapshot;
 			(*iSnapshots)[iCurrentSnapshot]->Snapshot(snapshot);
-            __LOG1("CBufferSnapshotWriter::WriteToBufferL() - writing snapshot for file: %S", &snapshot.iFileName);
+			OstTraceExt1(TRACE_NORMAL, DUP3_CBUFFERSNAPSHOTWRITER_WRITETOBUFFERL, "writing snapshot for file: %S", snapshot.iFileName);
 
 			WriteToBufferF(snapshot, aBuffer);
 			
@@ -1015,7 +1060,8 @@
 			aCompleted = ETrue;
 			} // if
 
-        __LOG1("CBufferSnapshotWriter::WriteToBufferL() - END - aCompleted: %d", aCompleted);
+		OstTrace1(TRACE_NORMAL, DUP4_CBUFFERSNAPSHOTWRITER_WRITETOBUFFERL, "aCompleted: %d", aCompleted);
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTWRITER_WRITETOBUFFERL_EXIT );
 		} // WriteToBufferL
 	
 	CBufferSnapshotReader* CBufferSnapshotReader::NewL(RSnapshots& aSnapshots)
@@ -1024,7 +1070,10 @@
 	@param aFiles Locaton to store files read from buffer.
 	*/
 		{
-		return new (ELeave) CBufferSnapshotReader(aSnapshots);
+		OstTraceFunctionEntry0( CBUFFERSNAPSHOTREADER_NEWL_ENTRY );
+		CBufferSnapshotReader* reader = new (ELeave) CBufferSnapshotReader(aSnapshots); 
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTREADER_NEWL_EXIT );
+		return reader;
 		}
 		
 	CBufferSnapshotReader::CBufferSnapshotReader(RSnapshots& aSnapshots) :
@@ -1034,6 +1083,8 @@
 	@param aSnapshots snapshots of files.
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERSNAPSHOTREADER_CBUFFERSNAPSHOTREADER_CONS_ENTRY );
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTREADER_CBUFFERSNAPSHOTREADER_CONS_EXIT );
 		}
 		
 	CBufferSnapshotReader::~CBufferSnapshotReader()
@@ -1041,6 +1092,8 @@
 	C++ destructor
 	*/
 		{
+		OstTraceFunctionEntry0( CBUFFERSNAPSHOTREADER_CBUFFERSNAPSHOTREADER_DES_ENTRY );
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTREADER_CBUFFERSNAPSHOTREADER_DES_EXIT );
 		}
 		
 	void CBufferSnapshotReader::StartL(const TDesC8& aBuffer, TBool aLastSection)
@@ -1050,11 +1103,12 @@
 	@param aLastSection is this the last section.
 	*/
 		{
-        __LOG2("CBufferSnapshotReader::StartL() - START - buffer len: %d, aLastSection: %d", aBuffer.Length(), aLastSection);
+        OstTraceFunctionEntry0( CBUFFERSNAPSHOTREADER_STARTL_ENTRY );
+        OstTraceExt2(TRACE_NORMAL, CBUFFERSNAPSHOTREADER_STARTL, "buffer len: %d, aLastSection: %d", aBuffer.Length(), aLastSection);
 
 		ReadFromBufferL(aBuffer, aLastSection);
-
-        __LOG("CBufferSnapshotReader::StartL() - END");
+        
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTREADER_STARTL_EXIT );
 		}
 		
 	void CBufferSnapshotReader::ContinueL(const TDesC8& aBuffer, TBool aLastSection)
@@ -1064,11 +1118,12 @@
 	@param aLastSection is this the last section.
 	*/
 		{
-        __LOG2("CBufferSnapshotReader::ContinueL() - START - buffer len: %d, aLastSection: %d", aBuffer.Length(), aLastSection);
+        OstTraceFunctionEntry0( CBUFFERSNAPSHOTREADER_CONTINUEL_ENTRY );
+        OstTraceExt2(TRACE_NORMAL, CBUFFERSNAPSHOTREADER_CONTINUEL, "buffer len: %d, aLastSection: %d", aBuffer.Length(), aLastSection);
 
 		ReadFromBufferL(aBuffer, aLastSection);
 
-        __LOG("CBufferSnapshotReader::ContinueL() - END");
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTREADER_CONTINUEL_EXIT );
 		}
 		
 	void CBufferSnapshotReader::ReadFromBufferL(const TDesC8& aBuffer, TBool /*aLastSection*/)
@@ -1078,7 +1133,7 @@
 	@param aLastSection is this the last section.
 	*/
 		{
-        __LOG("CBufferSnapshotReader::ReadFromBufferL() - START");
+        OstTraceFunctionEntry0( CBUFFERSNAPSHOTREADER_READFROMBUFFERL_ENTRY );        
 
 		TUint8* current = const_cast<TUint8*>(aBuffer.Ptr());
 		const TUint8* end = current + aBuffer.Size();
@@ -1086,17 +1141,17 @@
 			{
 			if (ReadFromBufferF(iSnapshot, current, end) == EFalse)
 				{
-				__LOG("CBufferSnapshotReader::ReadFromBufferL() - returned EFalse breaking!");
+			    OstTrace0(TRACE_NORMAL, CBUFFERSNAPSHOTREADER_READFROMBUFFERL, "returned EFalse breaking!");
 				break;
 				}
 			
-            __LOG1("CBufferSnapshotReader::ReadFromBufferL() - read snapshot info for file: %S", &iSnapshot.iFileName);
+			OstTraceExt1(TRACE_NORMAL, DUP1_CBUFFERSNAPSHOTREADER_READFROMBUFFERL, "read snapshot info for file: %S", iSnapshot.iFileName);
             CSnapshot* snapshot = CSnapshot::NewLC(iSnapshot);
 			iSnapshots.AppendL(snapshot);
 			CleanupStack::Pop(snapshot);
 			} // while
-
-        __LOG("CBufferSnapshotReader::ReadFromBufferL() - END");
+        
+		OstTraceFunctionExit0( CBUFFERSNAPSHOTREADER_READFROMBUFFERL_EXIT );
 		} // ReadFromBufferL
 		
 	
@@ -1112,9 +1167,11 @@
 	*/
 	CSnapshot* CSnapshot::NewLC(const TInt64& aModified, const TDesC& aFileName)
 		{
+		OstTraceFunctionEntry0( CSNAPSHOT_NEWLC_ENTRY );
 		CSnapshot* self = new (ELeave) CSnapshot(aModified);
 		CleanupStack::PushL(self);
 		self->ConstructL(aFileName);
+		OstTraceFunctionExit0( CSNAPSHOT_NEWLC_EXIT );
 		return self;
 		}
 	
@@ -1127,6 +1184,7 @@
 	*/
 	CSnapshot* CSnapshot::NewLC(const TSnapshot& aSnapshot)
 		{
+		OstTraceFunctionEntry0( DUP1_CSNAPSHOT_NEWLC_ENTRY );
 		return CSnapshot::NewLC(aSnapshot.iModified, aSnapshot.iFileName);
 		}
 	
@@ -1135,7 +1193,9 @@
 	*/
 	CSnapshot::~CSnapshot()
 		{
+		OstTraceFunctionEntry0( CSNAPSHOT_CSNAPSHOT_DES_ENTRY );
 		delete iFileName;
+		OstTraceFunctionExit0( CSNAPSHOT_CSNAPSHOT_DES_EXIT );
 		}
 	
 	/**
@@ -1143,6 +1203,8 @@
 	*/
 	CSnapshot::CSnapshot(const TInt64& aModified) : iModified(aModified)
 		{
+		OstTraceFunctionEntry0( CSNAPSHOT_CSNAPSHOT_CONS_ENTRY );
+		OstTraceFunctionExit0( CSNAPSHOT_CSNAPSHOT_CONS_EXIT );
 		}
 		
 	/**
@@ -1150,7 +1212,9 @@
 	*/
 	void CSnapshot::ConstructL(const TDesC& aFileName)
 		{
+		OstTraceFunctionEntry0( CSNAPSHOT_CONSTRUCTL_ENTRY );
 		iFileName = aFileName.AllocL();
+		OstTraceFunctionExit0( CSNAPSHOT_CONSTRUCTL_EXIT );
 		}
 	
 	/**
@@ -1181,8 +1245,10 @@
 	*/
 	void CSnapshot::Snapshot(TSnapshot& aSnapshot)
 		{
+		OstTraceFunctionEntry0( CSNAPSHOT_SNAPSHOT_ENTRY );
 		aSnapshot.iFileName = *iFileName;
 		aSnapshot.iModified = iModified;
+		OstTraceFunctionExit0( CSNAPSHOT_SNAPSHOT_EXIT );
 		}
 		
 	/**