userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp
changeset 297 b2826f67641f
parent 33 0173bcd7697c
--- a/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.cpp	Tue Oct 26 11:12:58 2010 +0100
+++ b/userlibandfileserver/fileserver/shostmassstorage/client/rusbhostmslogicalunit.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"
@@ -23,19 +23,24 @@
 #include "msgservice.h"
 #include "rusbhostmsdevice.h"
 #include "rusbhostmslogicalunit.h"
-#include "debug.h"
+
+#include "OstTraceDefinitions.h"
+#ifdef OST_TRACE_COMPILER_IN_USE
+#include "rusbhostmslogicalunitTraces.h"
+#endif
+
 
 TVersion RUsbHostMsLogicalUnit::Version() const
-	{
-	return(TVersion(KUsbHostMsSrvMajorVersionNumber,
+    {
+    return(TVersion(KUsbHostMsSrvMajorVersionNumber,
                     KUsbHostMsSrvMinorVersionNumber,
                     KUsbHostMsSrvBuildVersionNumber));
-	}
+    }
 
 EXPORT_C RUsbHostMsLogicalUnit::RUsbHostMsLogicalUnit()
-	{
-	// Intentionally left blank
-	}
+    {
+    // Intentionally left blank
+    }
 
 /**
 Send a command to initialise the Mass Storage device.
@@ -48,24 +53,25 @@
 */
 EXPORT_C TInt RUsbHostMsLogicalUnit::Initialise(const RMessage2& aMsg,
                                                 TInt aDevHandleIndex,
-												TUint32 aLun)
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::Initialise");
-	TInt r = dev.Open(aMsg, aDevHandleIndex);
-	if (r != KErrNone)
-		{
-		__PRINT1(_L("Session handle can not be opened %d"),r);
-		return r;
-		}
+                                                TUint32 aLun)
+    {
+    TInt r = dev.Open(aMsg, aDevHandleIndex);
+    if (r != KErrNone)
+        {
+        OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_11,
+                  "Session handle can not be opened %d", r);
+        return r;
+        }
 
-	r = CreateSubSession(dev, EUsbHostMsRegisterLun, TIpcArgs(aLun));
-	if (r != KErrNone)
-		{
-		__PRINT1(_L("SubSession creation failed %d"),r);
-		return r;
-		}
-	return r;
-	}
+    r = CreateSubSession(dev, EUsbHostMsRegisterLun, TIpcArgs(aLun));
+    if (r != KErrNone)
+        {
+        OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_12,
+                  "SubSession creation failed %d", r);
+        return r;
+        }
+    return r;
+    }
 
 
 /**
@@ -76,27 +82,27 @@
 @param aTrg Buffer to copy data to
 
 @return TInt KErrNone, if the send operation is successful;
-	KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
-	KErrNoMemory, if there is insufficient memory available.
+    KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
+    KErrNoMemory, if there is insufficient memory available.
 */
 EXPORT_C TInt RUsbHostMsLogicalUnit::Read(TInt64 aPos, TInt aLength, TDes8& aTrg)
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::Read");
+    {
+    TReadWrite data;
+    data.iPos = aPos;
+    data.iLen = aLength;
 
-	TReadWrite data;
-	data.iPos = aPos;
-	data.iLen = aLength;
-
-	__PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen);
+    OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_21,
+                 "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen);
 
-	TPckg<TReadWrite> pckg(data);
-	/* We handle the message asynchronously in the thread modelled MSC */
-	TRequestStatus	status;
-	SendReceive(EUsbHostMsRead, TIpcArgs(&pckg, &aTrg), status);
-	User::WaitForRequest(status);
-    __PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen);
-	return status.Int();
-	}
+    TPckg<TReadWrite> pckg(data);
+    /* We handle the message asynchronously in the thread modelled MSC */
+    TRequestStatus  status;
+    SendReceive(EUsbHostMsRead, TIpcArgs(&pckg, &aTrg), status);
+    User::WaitForRequest(status);
+    OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_22,
+                 "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen);
+    return status.Int();
+    }
 
 
 /**
@@ -107,27 +113,27 @@
 @param aTrg Buffer to copy data from
 
 @return TInt KErrNone, if the send operation is successful;
-	KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
-	KErrNoMemory, if there is insufficient memory available.
+    KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
+    KErrNoMemory, if there is insufficient memory available.
 available.
 */
 EXPORT_C TInt RUsbHostMsLogicalUnit::Write(TInt64 aPos, TInt aLength, const TDesC8& aTrg)
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::Write");
+    {
+    TReadWrite data;
+    data.iPos = aPos;
+    data.iLen = aLength;
 
-	TReadWrite data;
-	data.iPos = aPos;
-	data.iLen = aLength;
+    OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_23,
+                 "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen);
 
-	__PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen);
 
-	TPckg<TReadWrite> pckg(data);
-	/* We handle the message asynchronously in the thread modelled MSC */
-	TRequestStatus	status;
-	SendReceive(EUsbHostMsWrite, TIpcArgs(&aTrg, &pckg), status);
-	User::WaitForRequest(status);
-	return status.Int();
-	}
+    TPckg<TReadWrite> pckg(data);
+    /* We handle the message asynchronously in the thread modelled MSC */
+    TRequestStatus  status;
+    SendReceive(EUsbHostMsWrite, TIpcArgs(&aTrg, &pckg), status);
+    User::WaitForRequest(status);
+    return status.Int();
+    }
 
 
 /**
@@ -137,27 +143,26 @@
 @param aLength Number of Bytes
 
 @return TInt KErrNone, if the send operation is successful;
-	KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
-	KErrNoMemory, if there is insufficient memory available.
+    KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
+    KErrNoMemory, if there is insufficient memory available.
 available.
 */
 EXPORT_C TInt RUsbHostMsLogicalUnit::Erase(TInt64 aPos, TInt aLength)
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::Erase");
+    {
+    TReadWrite data;
+    data.iPos = aPos;
+    data.iLen = aLength;
 
-	TReadWrite data;
-	data.iPos = aPos;
-	data.iLen = aLength;
+    OstTraceExt3(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_24,
+                 "pos = 0x%x %x, len = x%x", I64HIGH(data.iPos), I64LOW(data.iPos), data.iLen);
 
-	__PRINT2(_L("pos = 0x%lx, len = x%x"), data.iPos, data.iLen);
-
-	TPckg<TReadWrite> pckg(data);
-	/* We handle the message asynchronously in the thread modelled MSC */
-	TRequestStatus	status;
-	SendReceive(EUsbHostMsErase, TIpcArgs(&pckg), status);
-	User::WaitForRequest(status);
-	return status.Int();
-	}
+    TPckg<TReadWrite> pckg(data);
+    /* We handle the message asynchronously in the thread modelled MSC */
+    TRequestStatus  status;
+    SendReceive(EUsbHostMsErase, TIpcArgs(&pckg), status);
+    User::WaitForRequest(status);
+    return status.Int();
+    }
 
 
 /**
@@ -171,17 +176,15 @@
 available.
 */
 EXPORT_C TInt RUsbHostMsLogicalUnit::Caps(TCapsInfo& aCapsInfo)
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::Caps");
-
+    {
     TPckg<TCapsInfo> data(aCapsInfo);
 
-	/* We handle the message asynchronously in the thread modelled MSC */
-	TRequestStatus	status;
-	SendReceive(EUsbHostMsCapacity, TIpcArgs(&data),status);
-	User::WaitForRequest(status);
-	return status.Int();
-	}
+    /* We handle the message asynchronously in the thread modelled MSC */
+    TRequestStatus  status;
+    SendReceive(EUsbHostMsCapacity, TIpcArgs(&data),status);
+    User::WaitForRequest(status);
+    return status.Int();
+    }
 
 /**
 Request notification of media change to the file server
@@ -189,26 +192,22 @@
 @param aChanged The descriptor pointing to iChanged flag in TDrive to be updated
 when error occurs during read or write.
 @param aStatus The request status This is set to KErrNone on completion, or KErrCancel when the logical unit is closed;
-	KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
-	KErrNoMemory, if there is insufficient memory available.
+    KErrServerTerminated, if the server no longer present; KErrServerBusy, if there are no message slots available;
+    KErrNoMemory, if there is insufficient memory available.
 @return None
 */
 EXPORT_C void RUsbHostMsLogicalUnit::NotifyChange(TDes8& aChanged, TRequestStatus &aStatus)
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::NotifyChange");
-
-	SendReceive(EUsbHostMsNotifyChange, TIpcArgs(&aChanged), aStatus);
-	}
+    {
+    SendReceive(EUsbHostMsNotifyChange, TIpcArgs(&aChanged), aStatus);
+    }
 
 /**
 Request to suspend the logical unit associated with this drive
 */
 EXPORT_C void RUsbHostMsLogicalUnit::SuspendLun()
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::SuspendLun");
-
-	SendReceive(EUsbHostMsSuspendLun, TIpcArgs(NULL));
-	}
+    {
+    SendReceive(EUsbHostMsSuspendLun, TIpcArgs(NULL));
+    }
 
 /**
 Close the sub-session.
@@ -216,13 +215,11 @@
 @return TInt KErrNone
 */
 EXPORT_C TInt RUsbHostMsLogicalUnit::UnInitialise()
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::UnInitialise");
-
-	CloseSubSession(EUsbHostMsUnRegisterLun);
-	dev.Close();
-	return KErrNone;
-	}
+    {
+    CloseSubSession(EUsbHostMsUnRegisterLun);
+    dev.Close();
+    return KErrNone;
+    }
 
 
 /**
@@ -236,19 +233,17 @@
 available.
 */
 EXPORT_C TInt RUsbHostMsLogicalUnit::ForceRemount(TUint aFlags)
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::ForceRemount");
-
-	__PRINT1(_L("flags = %d"), aFlags);
+    {
+    OstTrace1(TRACE_SHOSTMASSSTORAGE_HOST, RUSBHOSTMSLOGICALUNIT_25,
+              "flags = %d", aFlags);
 
-	TRequestStatus	status;
-	SendReceive(EUsbHostMsForceRemount, TIpcArgs(aFlags), status);
-	User::WaitForRequest(status);
-	return status.Int();
-	}
+    TRequestStatus  status;
+    SendReceive(EUsbHostMsForceRemount, TIpcArgs(aFlags), status);
+    User::WaitForRequest(status);
+    return status.Int();
+    }
 
 EXPORT_C void RUsbHostMsLogicalUnit::NotifyChangeCancel()
-	{
-	__FNLOG("RUsbHostMsLogicalUnit::NotifyChangeCancel");
-	SendReceive(EUsbHostMsCancelChangeNotifier, TIpcArgs(NULL));
-	}
+    {
+    SendReceive(EUsbHostMsCancelChangeNotifier, TIpcArgs(NULL));
+    }