userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmslogicalunit.cpp
changeset 297 b2826f67641f
parent 0 a41df078684a
--- a/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmslogicalunit.cpp	Tue Oct 26 11:12:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/server/controller/cusbhostmslogicalunit.cpp	Tue Oct 26 12:49:20 2010 +0100
@@ -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"
@@ -31,69 +31,65 @@
 
 #include "cusbhostmslogicalunit.h"
 #include "usbmshostpanic.h"
-#include "msdebug.h"
-#include "debug.h"
 
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "cusbhostmslogicalunitTraces.h"
+#endif
 
 CUsbHostMsLogicalUnit* CUsbHostMsLogicalUnit::NewL(TLun aLun)
     {
-    __MSFNSLOG
-	CUsbHostMsLogicalUnit* r = new (ELeave) CUsbHostMsLogicalUnit(aLun);
-	CleanupStack::PushL(r);
-	r->ConstructL();
-	CleanupStack::Pop();
-	return r;
-	}
+    CUsbHostMsLogicalUnit* r = new (ELeave) CUsbHostMsLogicalUnit(aLun);
+    CleanupStack::PushL(r);
+    r->ConstructL();
+    CleanupStack::Pop();
+    return r;
+    }
 
 
 void CUsbHostMsLogicalUnit::ConstructL()
     {
-    __MSFNLOG
     const TInt KInitialDataBufSize = 0x200;
-	iDataBuf.CreateL(KInitialDataBufSize);
+    iDataBuf.CreateL(KInitialDataBufSize);
     }
 
 
 CUsbHostMsLogicalUnit::CUsbHostMsLogicalUnit(TLun aLun)
 :   iProtocol(NULL),
     iLun(aLun),
-	iSuspendRequest(EFalse)
+    iSuspendRequest(EFalse)
     {
-    __MSFNLOG
-	}
+    }
 
 CUsbHostMsLogicalUnit::~CUsbHostMsLogicalUnit()
     {
-    __MSFNLOG
     iDataBuf.Close();
-	delete iProtocol;
-	}
+    delete iProtocol;
+    }
 
 
 void CUsbHostMsLogicalUnit::InitL()
     {
-    __MSFNLOG
-	iProtocol->InitialiseUnitL();
+    iProtocol->InitialiseUnitL();
     }
 
 void CUsbHostMsLogicalUnit::UnInitL()
     {
-    __MSFNLOG
-	iProtocol->UninitialiseUnitL();
+    iProtocol->UninitialiseUnitL();
     }
 
 void CUsbHostMsLogicalUnit::ReadL(const RMessage2& aMessage)
     {
-    __MSFNLOG
-	TReadWrite p;
-	TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite));
-	aMessage.ReadL(0, pReadWrite);
-    __HOSTPRINT2(_L("pos = 0x%lx len = %08x"), p.iPos, p.iLen);
+    TReadWrite p;
+    TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite));
+    aMessage.ReadL(0, pReadWrite);
+    OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_10,
+                 "pos = 0x%x %x len = %08x", I64HIGH(p.iPos), I64LOW(p.iPos), p.iLen);
 
     User::LeaveIfError(CheckPosition(p));
 
-	// check if buffer can hold requested data and resize if not
-	if (iDataBuf.MaxLength() < p.iLen)
+    // check if buffer can hold requested data and resize if not
+    if (iDataBuf.MaxLength() < p.iLen)
         iDataBuf.ReAllocL(p.iLen);
 
     iProtocol->ReadL(p.iPos, iDataBuf, p.iLen);
@@ -103,11 +99,11 @@
 
 void CUsbHostMsLogicalUnit::WriteL(const RMessage2& aMessage)
     {
-    __MSFNLOG
-	TReadWrite p;
-	TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite));
-	aMessage.ReadL(1, pReadWrite);
-    __HOSTPRINT2(_L("pos = 0x%lx len = %08x"), p.iPos, p.iLen);
+    TReadWrite p;
+    TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite));
+    aMessage.ReadL(1, pReadWrite);
+    OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_11,
+                 "pos = 0x%x %x len = %08x", I64HIGH(p.iPos), I64LOW(p.iPos), p.iLen);
 
     User::LeaveIfError(CheckPosition(p));
 
@@ -115,18 +111,18 @@
     if (iDataBuf.MaxLength() < p.iLen)
         iDataBuf.ReAllocL(p.iLen);
 
-	aMessage.ReadL(0, iDataBuf);
-	iProtocol->WriteL(p.iPos, iDataBuf, p.iLen);
+    aMessage.ReadL(0, iDataBuf);
+    iProtocol->WriteL(p.iPos, iDataBuf, p.iLen);
     }
 
 
 void CUsbHostMsLogicalUnit::EraseL(const RMessage2& aMessage)
     {
-    __MSFNLOG
-	TReadWrite p;
-	TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite));
-	aMessage.ReadL(0, pReadWrite);
-    __HOSTPRINT2(_L("pos = 0x%lx len = %08x"), p.iPos, p.iLen);
+    TReadWrite p;
+    TPtr8 pReadWrite((TUint8*)&p,sizeof(TReadWrite));
+    aMessage.ReadL(0, pReadWrite);
+    OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_12,
+                 "pos = 0x%x %x len = %08x", I64HIGH(p.iPos), I64LOW(p.iPos), p.iLen);
 
     User::LeaveIfError(CheckPosition(p));
 
@@ -135,99 +131,88 @@
         iDataBuf.ReAllocL(p.iLen);
 
     iDataBuf.FillZ(p.iLen);
-	iProtocol->WriteL(p.iPos, iDataBuf, p.iLen);
+    iProtocol->WriteL(p.iPos, iDataBuf, p.iLen);
     }
 
 
 void CUsbHostMsLogicalUnit::CapsL(const RMessage2& aMessage)
     {
-    __MSFNLOG
-
     TCapsInfo capsInfo;
     TPckg<TCapsInfo> pckg(capsInfo);
-	iProtocol->GetCapacityL(capsInfo);
+    iProtocol->GetCapacityL(capsInfo);
     iSize = static_cast<TInt64>(capsInfo.iNumberOfBlocks) * capsInfo.iBlockLength;
-	aMessage.WriteL(0, pckg);
+    aMessage.WriteL(0, pckg);
     }
 
 void CUsbHostMsLogicalUnit::NotifyChange(const RMessage2& aMessage)
     {
-    __MSFNLOG
-	iProtocol->NotifyChange(aMessage);
+    iProtocol->NotifyChange(aMessage);
     }
 
 
 void CUsbHostMsLogicalUnit::ForceCompleteNotifyChangeL()
     {
-    __MSFNLOG
-	iProtocol->ForceCompleteNotifyChangeL();
+    iProtocol->ForceCompleteNotifyChangeL();
     }
 
 void CUsbHostMsLogicalUnit::CancelChangeNotifierL()
     {
-    __MSFNLOG
-	iProtocol->CancelChangeNotifierL();
+    iProtocol->CancelChangeNotifierL();
     }
 
 TBool CUsbHostMsLogicalUnit::IsConnected()
-	{
-	return iProtocol->IsConnected() ? ETrue : EFalse;
-	}
+    {
+    return iProtocol->IsConnected() ? ETrue : EFalse;
+    }
 
 TBool CUsbHostMsLogicalUnit::IsReadyToSuspend()
     {
-    __MSFNLOG
-	return iSuspendRequest ? ETrue : EFalse;
-	}
+    return iSuspendRequest ? ETrue : EFalse;
+    }
 
 void CUsbHostMsLogicalUnit::ReadyToSuspend()
     {
-    __MSFNLOG
-	iSuspendRequest = ETrue;
+    iSuspendRequest = ETrue;
     }
 
 void CUsbHostMsLogicalUnit::CancelReadyToSuspend()
     {
-    __MSFNLOG
-	iSuspendRequest = EFalse;
+    iSuspendRequest = EFalse;
     }
 
 void CUsbHostMsLogicalUnit::SuspendL()
     {
-    __MSFNLOG
-	iProtocol->SuspendL();
+    iProtocol->SuspendL();
     }
 
 void CUsbHostMsLogicalUnit::ResumeL()
-	{
-    __MSFNLOG
-	// We do not cancel iSuspendRequest here
-	iProtocol->ResumeL();
-	}
+    {
+    // We do not cancel iSuspendRequest here
+    iProtocol->ResumeL();
+    }
 
 void CUsbHostMsLogicalUnit::DoLunReadyCheckL()
     {
-    __MSFNLOG
-	iProtocol->DoScsiReadyCheckEventL();
+    iProtocol->DoScsiReadyCheckEventL();
     }
 
 TInt CUsbHostMsLogicalUnit::InitialiseProtocolL(TLun aLun,
                                                 THostMassStorageConfig& aConfig,
                                                 MTransport& aTransport)
     {
-    __MSFNLOG
     __ASSERT_DEBUG(iProtocol == NULL, User::Panic(KUsbMsHostPanicCat, EProtocolNotFree));
-	switch(aConfig.iProtocolId)
+    switch(aConfig.iProtocolId)
         {
-	case ScsiProtocol:
-		iProtocol = CScsiProtocol::NewL(aLun, aTransport);
-		break;
-	default:
-		__HOSTPRINT(_L("Unsupported Transport class requested"));
-		iProtocol = NULL;
-		return KErrNotSupported;
+    case ScsiProtocol:
+        iProtocol = CScsiProtocol::NewL(aLun, aTransport);
+        break;
+    default:
+        OstTrace0(TRACE_SHOSTMASSSTORAGE_HOST, CUSBHOSTMSLOGICALUNIT_13,
+                  "Unsupported Transport class requested");
+        iProtocol = NULL;
+        return KErrNotSupported;
         }
-	return KErrNone;
+    return KErrNone;
     }
 
 TInt CUsbHostMsLogicalUnit::CheckPosition(const TReadWrite& aReadWrite)
@@ -240,9 +225,9 @@
             return KErrArgument;
         }
 
-	// detect drive not present
-	if (iSize == 0)
-		return KErrNotReady;
+    // detect drive not present
+    if (iSize == 0)
+        return KErrNotReady;
 
     if (aReadWrite.iPos >= iSize)
         return KErrArgument;