smsprotocols/smsstack/gsmu/src/gsmustor.cpp
branchRCL_3
changeset 65 630d2f34d719
parent 14 7ef16719d8cb
child 66 07a122eea281
--- a/smsprotocols/smsstack/gsmu/src/gsmustor.cpp	Thu Aug 19 11:03:36 2010 +0300
+++ b/smsprotocols/smsstack/gsmu/src/gsmustor.cpp	Tue Aug 31 16:23:08 2010 +0300
@@ -1,4 +1,4 @@
-// Copyright (c) 1999-2009 Nokia Corporation and/or its subsidiary(-ies).
+// Copyright (c) 1999-2010 Nokia Corporation and/or its subsidiary(-ies).
 // All rights reserved.
 // This component and the accompanying materials are made available
 // under the terms of "Eclipse Public License v1.0"
@@ -19,6 +19,12 @@
  @file
 */
 
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "gsmustorTraces.h"
+#endif
+
 #include <e32svr.h>
 
 #include "gsmustor.h"
@@ -33,7 +39,7 @@
  */
 void CSARStoreCloseObject(TAny* aObj)
     {
-    LOGGSMU2("WARNING! Hey, CSARStoreCloseObject called by Untrapper! [0x%08x]", aObj);
+    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORECLOSEOBJECT_1, "WARNING! Hey, CSARStoreCloseObject called by Untrapper! [0x%08x]", aObj);
     ((CSARStore*)aObj)->Revert();
     }
 
@@ -125,11 +131,7 @@
  */
 EXPORT_C void CSARStore::OpenL(const TDesC& aFullName, const TUid& aThirdUid)
 	{
-#ifdef _SMS_LOGGING_ENABLED
-	TBuf8<80> buf8;
-	buf8.Copy(aFullName);
-	LOGGSMU2("CSARStore::OpenL(): '%S'", &buf8);
-#endif
+	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_OPENL_1, "CSARStore::OpenL(): '%S'", aFullName);
 
 	// sanity check
 	__ASSERT_DEBUG(iFileStore==NULL,Panic(KGsmuPanicSARStoreAlreadyOpen));
@@ -145,7 +147,7 @@
  	TRAPD(ret, InternalizeEntryArrayL());
 	if (ret != KErrNone)
 		{
-		LOGGSMU2("WARNING: InteralizeEntryArrayL left with %d", ret);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_OPENL_2, "WARNING: InteralizeEntryArrayL left with %d", ret);
 		}
 
  	if(ret == KErrCorrupt || ret == KErrEof || ret == KErrNotFound)
@@ -166,17 +168,16 @@
 EXPORT_C void CSARStore::CommitTransactionL()
 // This function does the real work of updating the filestore
 	{
-    LOGGSMU4("CSARStore::CommitTransactionL(): this=0x%08X iInTransaction=%d iFileStore=0x%08X",
-    		 this, iInTransaction, iFileStore);
+    OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_COMMITTRANSACTIONL_1, "CSARStore::CommitTransactionL(): this=0x%08X iInTransaction=%d iFileStore=0x%08X",(TUint)this, iInTransaction, (TUint)iFileStore);
 
 	__ASSERT_DEBUG(iFileStore!=NULL, Panic(KGsmuPanicSARStoreNotOpen));
 	__ASSERT_DEBUG(iInTransaction, Panic(KGsmuPanicSARStoreTransaction));
 
-#ifdef _SMS_LOGGING_ENABLED
+#ifdef OST_TRACE_COMPILER_IN_USE
 	TRAPD(err, DoCommitAndCompactL());
 	if (err != KErrNone)
 		{
-		LOGGSMU2("WARNING! could not CommitL/CompactL due to %d", err);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_COMMITTRANSACTIONL_2, "WARNING! could not CommitL/CompactL due to %d", err);
 		User::Leave(err);
 		}
 #else
@@ -199,11 +200,7 @@
  */
 EXPORT_C void CSARStore::Close()
 	{
-#ifdef _SMS_LOGGING_ENABLED
-	TBuf8<80> buf8;
-	buf8.Copy(iFullName);
-	LOGGSMU2("CSARStore::Close(): '%S'", &buf8);
-#endif
+	OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_CLOSE_1, "CSARStore::Close(): '%S'", iFullName);
 
 	__ASSERT_DEBUG(!iInTransaction, Panic(KGsmuPanicSARStoreTransaction));
 
@@ -263,8 +260,7 @@
 // storing it in the reassembly store.
 //
 	{
-	LOGGSMU3("CSARStore::PurgeL(): aTimeIntervalMinutes=%d, aPurgeIncompleteOnly=%d",
-			 aTimeIntervalMinutes.Int(), aPurgeIncompleteOnly);
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_PURGEL_1, "CSARStore::PurgeL(): aTimeIntervalMinutes=%d, aPurgeIncompleteOnly=%d",aTimeIntervalMinutes.Int(), aPurgeIncompleteOnly);
 
 	// TODO - flag
 	// we could also save the call of the method from the consruction of the smsprot
@@ -272,7 +268,7 @@
 		return;
 
 	TInt count=iEntryArray.Count();
-	LOGGSMU2("CSARStore::PurgeL(): count=%d", count);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_PURGEL_2, "CSARStore::PurgeL(): count=%d", count);
 
 	TTime time;
 	time.UniversalTime();
@@ -313,11 +309,10 @@
  */
 EXPORT_C void CSARStore::PurgeL(TInt aKSegmentationLifetimeMultiplier,TBool aPurgeIncompleteOnly)
 	{
-	LOGGSMU3("CSARStore::PurgeL(): aKSegmentationLifetimeMultiplier=%d, aPurgeIncompleteOnly=%d",
-			 aKSegmentationLifetimeMultiplier, aPurgeIncompleteOnly);
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_PURGEL1_1, "CSARStore::PurgeL(): aKSegmentationLifetimeMultiplier=%d, aPurgeIncompleteOnly=%d",aKSegmentationLifetimeMultiplier, aPurgeIncompleteOnly);
 
 	TInt count=Entries().Count();
-	LOGGSMU2("CSARStore::PurgeL(): count=%d", count);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_PURGEL1_2, "CSARStore::PurgeL(): count=%d", count);
 	TTime time;
 	time.UniversalTime();
 
@@ -375,7 +370,7 @@
 	    
 	ExternalizeEntryArrayL();
 	CommitTransactionL();
-	LOGGSMU1("CSmsSegmentationStore::PurgeL End");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_PURGEL1_3, "CSmsSegmentationStore::PurgeL End");
 	} // CSARStore::PurgeL
 
 
@@ -389,7 +384,7 @@
  */
 EXPORT_C void CSARStore::DeleteEntryL(TInt aIndex)
 	{
-	LOGGSMU2("CSARStore::DeleteEntryL(): aIndex=%d", aIndex);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_DELETEENTRYL_1, "CSARStore::DeleteEntryL(): aIndex=%d", aIndex);
 
 	DoDeleteEntryL(aIndex);
 	ExternalizeEntryArrayL();
@@ -427,7 +422,7 @@
  */
 EXPORT_C CFileStore& CSARStore::FileStore()
 	{
-	LOGGSMU1("CSARStore::FileStore()");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_FILESTORE_1, "CSARStore::FileStore()");
 
 	__ASSERT_DEBUG(iFileStore!=NULL,Panic(KGsmuPanicSARStoreNotOpen));
 	return *iFileStore;
@@ -444,7 +439,7 @@
     {
     // Ignore in code coverage - not used in SMS stack.
     BULLSEYE_OFF
-    LOGGSMU1("CSARStore::FileStore()");
+    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_FILESTORE1_1, "CSARStore::FileStore()");
     __ASSERT_DEBUG(iFileStore!=NULL,Panic(KGsmuPanicSARStoreNotOpen));
     return *iFileStore;
     BULLSEYE_RESTORE
@@ -463,7 +458,7 @@
  */
 EXPORT_C void CSARStore::AddEntryL(const TSAREntry& aEntry)
 	{
-	LOGGSMU1("CSARStore::AddEntryL()");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_ADDENTRYL_1, "CSARStore::AddEntryL()");
 
 	__ASSERT_DEBUG(iFileStore!=NULL,Panic(KGsmuPanicSARStoreNotOpen));
 	__ASSERT_DEBUG(aEntry.DataStreamId()!=KNullStreamId,Panic(KGsmuPanicSAREntryDataStreamIdNotSet));
@@ -485,7 +480,7 @@
  */
 EXPORT_C void CSARStore::ChangeEntryL(TInt aIndex,const TSAREntry& aNewEntry)
 	{
-	LOGGSMU2("CSARStore::ChangeEntryL(): aIndex=%d", aIndex);
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_CHANGEENTRYL_1, "CSARStore::ChangeEntryL(): aIndex=%d", aIndex);
 
 	__ASSERT_DEBUG(iFileStore!=NULL,Panic(KGsmuPanicSARStoreNotOpen));
 	__ASSERT_DEBUG(iEntryArray[aIndex].DataStreamId()==aNewEntry.DataStreamId(),Panic(KGsmuPanicSAREntryDataStreamIdChanged));
@@ -506,7 +501,7 @@
  */
 EXPORT_C TStreamId CSARStore::ExtraStreamId() const
 	{
-	LOGGSMU1("CSARStore::ExtraStreamId");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_EXTRASTREAMID_1, "CSARStore::ExtraStreamId");
 	return iExtraStreamId;
 	} // CSARStore::ExtraStreamId
 
@@ -522,7 +517,7 @@
  */
 EXPORT_C void CSARStore::SetExtraStreamIdL(const TStreamId& aExtraStreamId)
 	{
-	LOGGSMU2("CSARStore::SetExtraStreamIdL(): id=%d", aExtraStreamId.Value());
+	OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_SETEXTRASTREAMIDL_1, "CSARStore::SetExtraStreamIdL(): id=%d", aExtraStreamId.Value());
 
 	__ASSERT_DEBUG(iFileStore!=NULL,Panic(KGsmuPanicSARStoreNotOpen));
 	TStreamId streamid=iExtraStreamId;
@@ -530,7 +525,7 @@
 	TRAPD(ret, ExternalizeEntryArrayL());
 	if (ret!=KErrNone)
 		{
-		LOGGSMU2("WARNING! CSARStore::DoExternalizeEntryArrayL left with %d", ret);
+		OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_SETEXTRASTREAMIDL_2, "WARNING! CSARStore::DoExternalizeEntryArrayL left with %d", ret);
 		iExtraStreamId=streamid;	//  Roll back
 		User::Leave(ret);			//  re-leave to allow caller to also roll back
 		}
@@ -548,14 +543,14 @@
  */
 EXPORT_C void CSARStore::CompactL()
 	{
-    LOGGSMU1("CSARStore::CompactL Start");
+    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_COMPACTL_1, "CSARStore::CompactL Start");
 	__ASSERT_DEBUG(iFileStore!=NULL, Panic(KGsmuPanicSARStoreNotOpen));
 	__ASSERT_DEBUG(iInTransaction, Panic(KGsmuPanicSARStoreTransaction));
 
 	TInt space = iFileStore->CompactL();
 	iFileStore->CommitL();
 
-    LOGGSMU2("CSARStore::CompactL End [space=%d]", space);
+    OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_COMPACTL_2, "CSARStore::CompactL End [space=%d]", space);
 	(void)space;
 	} // CSARStore::CompactL
 
@@ -569,11 +564,11 @@
  */
 EXPORT_C void CSARStore::BeginTransactionLC()
 	{
-    LOGGSMU4("CSARStore::BeginTransactionLC [this=0x%08X iInTransaction=%d iFileStore=0x%08X]", this, iInTransaction, iFileStore);
+    OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_BEGINTRANSACTIONLC_1, "CSARStore::BeginTransactionLC [this=0x%08X iInTransaction=%d iFileStore=0x%08X]", (TUint)this, iInTransaction, (TUint)iFileStore);
 
 	if (iFileStore == NULL || iInTransaction)
 		{
-	    LOGGSMU1("WARNING CSARStore::BeginTransactionLC leaving with KErrAccessDenied");
+	    OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_BEGINTRANSACTIONLC_2, "WARNING CSARStore::BeginTransactionLC leaving with KErrAccessDenied");
 		User::Leave(KErrAccessDenied);
 		}
 
@@ -584,8 +579,7 @@
 
 void CSARStore::Revert()
 	{
-    LOGGSMU3("CSARStore::Revert(): this=0x%08X, iInTransaction=%d",
-    		 this, iInTransaction);
+    OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_REVERT_1, "CSARStore::Revert(): this=0x%08X, iInTransaction=%d", (TUint)this, iInTransaction);
 
 	__ASSERT_DEBUG(iInTransaction, Panic(KGsmuPanicSARStoreTransaction));
 
@@ -604,11 +598,8 @@
  */
 EXPORT_C void CSARStore::DoOpenL()
 	{
-#ifdef _SMS_LOGGING_ENABLED
-	TBuf8<80> buf8;
-	buf8.Copy(iFullName);
-	LOGGSMU3("CSARStore::DoOpenL(): '%S' this=0x%08X", &buf8, this);
-#endif
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_DOOPENL_1, "CSARStore::DoOpenL(): '%S' this=0x%08X", iFullName, (TUint)this);
+
 
 	TUidType uidtype(KPermanentFileStoreLayoutUid,KSARStoreUid,iThirdUid);
 	TEntry entry;
@@ -626,7 +617,7 @@
 		TRAP(ret,(iFileStore=CPermanentFileStore::OpenL(iFs,iFullName,EFileShareExclusive|EFileStream|EFileRead|EFileWrite)));
 		if(ret != KErrNone)
 			{
-			LOGGSMU2("WARNING! CPermanentFileStore::OpenLC left with %d", ret);
+			OstTraceDef1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_DOOPENL_2, "WARNING! CPermanentFileStore::OpenLC left with %d", ret);
 			}
 		}
 
@@ -638,11 +629,8 @@
 		{
 		// create a new file and push the close function on the cleanup stack,
 		// so that the trap handler will close the file automatically
-#ifdef _SMS_LOGGING_ENABLED
-		TBuf8<80> buf8;
-		buf8.Copy(iFullName);
-		LOGGSMU2("CSARStore::DoOpenL(): New file created '%S'", &buf8);
-#endif
+
+		OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_DOOPENL_3, "CSARStore::DoOpenL(): New file created '%S'", iFullName);
 		TInt kerr(iFs.MkDirAll(iFullName)); //the directory may not exist, So create one.
 		if(kerr != KErrAlreadyExists)
 			{
@@ -666,18 +654,14 @@
  */
 void CSARStore::DoDeleteEntryL(TInt aIndex)
 	{
-#ifdef _SMS_LOGGING_ENABLED
+#ifdef OST_TRACE_COMPLIER_IN_USE
 	const TSmsSegmentationEntry& entry = (const TSmsSegmentationEntry&)iEntryArray[aIndex];
 
-	LOGGSMU3("CSARStore::DoDeleteEntryL [aIndex=%d Count=%d]",
-			 aIndex, iEntryArray.Count());
-	LOGGSMU4("CSARStore::DoDeleteEntryL [aIndex=%d Delivered=%d Failed=%d]",
-			 aIndex, entry.Delivered(), entry.Failed());
-	LOGGSMU4("CSARStore::DoDeleteEntryL [aIndex=%d Count=%d Total=%d]",
-			 aIndex, entry.Count(), entry.Total());
-	LOGGSMU4("CSARStore::DoDeleteEntryL [aIndex=%d logId=%d StreamId=%d]",
-			 aIndex, entry.LogServerId(), entry.DataStreamId().Value());
-#endif // _SMS_LOGGING_ENABLED
+	OstTraceDefExt2(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_DODELETEENTRYL_1, "CSARStore::DoDeleteEntryL [aIndex=%d Count=%d]",aIndex, iEntryArray.Count());
+	OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_DODELETEENTRYL_2, "CSARStore::DoDeleteEntryL [aIndex=%d Delivered=%d Failed=%d]",aIndex, entry.Delivered(), entry.Failed());
+	OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_DODELETEENTRYL_3, "CSARStore::DoDeleteEntryL [aIndex=%d Count=%d Total=%d]",aIndex, entry.Count(), entry.Total());
+	OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_DODELETEENTRYL_4, "CSARStore::DoDeleteEntryL [aIndex=%d logId=%d StreamId=%u]",aIndex, entry.LogServerId(), (TUint) entry.DataStreamId().Value());
+#endif // OST_TRACE_COMPLIER_IN_USE
 
 	__ASSERT_DEBUG(iFileStore!=NULL,Panic(KGsmuPanicSARStoreNotOpen));
 	TRAPD(err, iFileStore->DeleteL(iEntryArray[aIndex].DataStreamId()));
@@ -693,7 +677,7 @@
  */
 void CSARStore::InternalizeEntryArrayL()
 	{
-	LOGGSMU1("CSARStore::InternalizeEntryArrayL()");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_INTERNALIZEENTRYARRAYL_1, "CSARStore::InternalizeEntryArrayL()");
 
 	__ASSERT_DEBUG(iFileStore!=NULL, Panic(KGsmuPanicSARStoreNotOpen));
 
@@ -714,7 +698,7 @@
 
 void CSARStore::RemoveDeletedEntries()
 	{
-	LOGGSMU1("CSARStore::RemoveDeletedEntries()");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_REMOVEDELETEDENTRIES_1, "CSARStore::RemoveDeletedEntries()");
 
 	TInt count=iEntryArray.Count();
 	while (count--)
@@ -731,7 +715,7 @@
 
 void CSARStore::ReinstateDeletedEntries()
 	{
-	LOGGSMU1("CSARStore::ReinstateDeletedEntries()");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_REINSTATEDELETEDENTRIES_1, "CSARStore::ReinstateDeletedEntries()");
 
 	TInt count=iEntryArray.Count();
 	while (count--)
@@ -754,8 +738,7 @@
 	__ASSERT_DEBUG(iFileStore!=NULL, Panic(KGsmuPanicSARStoreNotOpen));
 	__ASSERT_DEBUG(iInTransaction, Panic(KGsmuPanicSARStoreTransaction));
 
-	LOGGSMU4("CSARStore::ExternalizeEntryArrayL(): this=0x%08X count=%d headerid=%d]",
-			 this, iEntryArray.Count(), iFileStore->Root().Value());
+	OstTraceDefExt3(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_EXTERNALIZEENTRYARRAYL_1, "CSARStore::ExternalizeEntryArrayL(): this=0x%08X count=%d headerid=%u]",(TUint)this, iEntryArray.Count(), (TUint)iFileStore->Root().Value());
 
 	TStreamId headerid=iFileStore->Root();
 	RStoreWriteStream stream;
@@ -802,11 +785,18 @@
  */
 void CSARStore::DoCommitAndCompactL()
 	{
-	LOGGSMU1("CSARStore::DoCommitAndCompactL()");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS, CSARSTORE_DOCOMMITANDCOMPACTL_1, "CSARStore::DoCommitAndCompactL()");
 
-	LOGGSMUTIMESTAMP();
+#if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG) 
+    TBuf<40> timestamp;
+    SmsTimeStampL(timestamp);
+    OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS,CSARSTORE_DOCOMMITANDCOMPACTL_2, "%S",timestamp);
+#endif
 	iFileStore->CommitL();
-	LOGGSMUTIMESTAMP();
+#if (OST_TRACE_CATEGORY & OST_TRACE_CATEGORY_DEBUG) 
+    SmsTimeStampL(timestamp);
+    OstTraceDefExt1(OST_TRACE_CATEGORY_DEBUG, TRACE_INTERNALS,CSARSTORE_DOCOMMITANDCOMPACTL_3, "%S",timestamp);
+#endif
 
 	iCommitCount--;
 	if (iCommitCount < 0)
@@ -826,7 +816,7 @@
  */
 EXPORT_C void CSARStore::PrivatePath(TDes& aPath)
 	{
-	LOGGSMU1("CSARStore::PrivatePath()");
+	OstTraceDef0(OST_TRACE_CATEGORY_DEBUG, TRACE_BORDER, CSARSTORE_PRIVATEPATH_1, "CSARStore::PrivatePath()");
 
 	TDriveUnit driveUnit(KStoreDrive);
 	TDriveName drive=driveUnit.Name();