userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.cpp
changeset 300 1d28c8722707
parent 33 0173bcd7697c
equal deleted inserted replaced
293:0659d0e1a03c 300:1d28c8722707
    26 
    26 
    27 #include <e32def.h>
    27 #include <e32def.h>
    28 #include <e32err.h>
    28 #include <e32err.h>
    29 
    29 
    30 #include "tmsmemmap.h"
    30 #include "tmsmemmap.h"
    31 #include "debug.h"
    31 #include "OstTraceDefinitions.h"
       
    32 #ifdef OST_TRACE_COMPILER_IN_USE
       
    33 #include "tmsmemmapTraces.h"
       
    34 #endif
    32 
    35 
    33 
    36 
    34 TMsDataMemMap::TMsDataMemMap()
    37 TMsDataMemMap::TMsDataMemMap()
    35 	{
    38     {
    36 	__MSFNSLOG
       
    37     Reset();
    39     Reset();
    38 	}
    40     }
    39 
    41 
    40 
    42 
    41 /**
    43 /**
    42     Checks that the block is within the limits of the media memory address space
    44     Checks that the block is within the limits of the media memory address space
    43     and truncates the length if block extends beyond media size.
    45     and truncates the length if block extends beyond media size.
    50    @return TInt KErrNone if block fits. KErrArgument if start position is
    52    @return TInt KErrNone if block fits. KErrArgument if start position is
    51    greater than the media size. KErrEof if block extends beyond media size.
    53    greater than the media size. KErrEof if block extends beyond media size.
    52  */
    54  */
    53 TInt TMsDataMemMap::TranslateDataPos(TInt64& aPos, TInt& aLength) const
    55 TInt TMsDataMemMap::TranslateDataPos(TInt64& aPos, TInt& aLength) const
    54     {
    56     {
    55 	__MSFNSLOG
       
    56     // Map to the actual position on the media
    57     // Map to the actual position on the media
    57     aPos += iDataOffset;
    58     aPos += iDataOffset;
    58 
    59 
    59     if (aPos > iSize)
    60     if (aPos > iSize)
    60         {
    61         {
    80    @return TInt KErrNone if block fits. KErrArgument if start position is
    81    @return TInt KErrNone if block fits. KErrArgument if start position is
    81    greater than the media size. KErrEof if block extends beyond media size.
    82    greater than the media size. KErrEof if block extends beyond media size.
    82  */
    83  */
    83 TInt TMsDataMemMap::CheckBlockInRange(TInt64& aPos, TInt aLength) const
    84 TInt TMsDataMemMap::CheckBlockInRange(TInt64& aPos, TInt aLength) const
    84     {
    85     {
    85 	__MSFNSLOG
       
    86     // Map to the actual position on the media
    86     // Map to the actual position on the media
    87     aPos += iDataOffset;
    87     aPos += iDataOffset;
    88 
    88 
    89     if (aPos > iSize)
    89     if (aPos > iSize)
    90         {
    90         {
    92         }
    92         }
    93 
    93 
    94     TInt64 endPos = aPos + aLength;
    94     TInt64 endPos = aPos + aLength;
    95     if (endPos > iSize)
    95     if (endPos > iSize)
    96         {
    96         {
    97         __PXYPRINT2(_L("EOF found 0x%lx x%x"), aPos, aLength);
    97         OstTraceExt3(TRACE_SHOSTMASSSTORAGE_PROXY, TMSMEMMAP_1,
       
    98                      "EOF found Pos=0x%x %x Len=0x%x", I64HIGH(aPos), I64LOW(aPos), aLength);
    98         return KErrEof;
    99         return KErrEof;
    99         }
   100         }
   100 
   101 
   101     return KErrNone;
   102     return KErrNone;
   102     }
   103     }