userlibandfileserver/fileserver/shostmassstorage/msproxy/tmsmemmap.h
changeset 109 b3a1d9898418
parent 0 a41df078684a
equal deleted inserted replaced
102:ef2a444a7410 109:b3a1d9898418
     1 // Copyright (c) 2008-2009 Nokia Corporation and/or its subsidiary(-ies).
     1 // Copyright (c) 2008-2010 Nokia Corporation and/or its subsidiary(-ies).
     2 // All rights reserved.
     2 // All rights reserved.
     3 // This component and the accompanying materials are made available
     3 // This component and the accompanying materials are made available
     4 // under the terms of the License "Eclipse Public License v1.0"
     4 // under the terms of the License "Eclipse Public License v1.0"
     5 // which accompanies this distribution, and is available
     5 // which accompanies this distribution, and is available
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
     6 // at the URL "http://www.eclipse.org/legal/epl-v10.html".
    24 
    24 
    25 
    25 
    26 class TMsDataMemMap
    26 class TMsDataMemMap
    27 	{
    27 	{
    28 public:
    28 public:
    29     static const TInt KSectorSize = 0x200; // 512
       
    30     static const TInt KFormatSectorShift = 9;
       
    31 
    29 
    32 	TMsDataMemMap();
    30 	TMsDataMemMap();
    33     void Reset();
    31     void Reset();
    34 
    32 
    35     void InitDataArea(TUint32 aFirstDataSector, TUint32 aNumSectors);
    33     void InitDataArea(TUint32 aFirstDataSector, TUint32 aNumSectors, TUint32 aSectorSize);
    36     void InitDataArea(TUint64 aSize);
    34     void InitDataArea(TUint64 aSize);
    37 
    35 
    38     TInt BlockLength() const;
    36     TUint32 BlockLength() const;
    39     TUint64 DataSize() const;
    37     TUint64 DataSize() const;
    40 
    38 
    41     TInt64 GetDataPos(TInt64 aPos) const;
    39     TInt64 GetDataPos(TInt64 aPos) const;
    42     TInt TranslateDataPos(TInt64& aPos, TInt& aLength) const;
    40     TInt TranslateDataPos(TInt64& aPos, TInt& aLength) const;
    43     TInt CheckBlockInRange(TInt64& aPos, TInt aLength) const;
    41     TInt CheckBlockInRange(TInt64& aPos, TInt aLength) const;
       
    42     TInt FormatSectorShift() const;
    44 
    43 
    45 private:
    44 private:
    46     // Whole media
    45     // Whole media
    47     // Size
    46     // Size
    48     TUint64 iSize;
    47     TUint64 iSize;
    49 
    48 
    50     // Data Area
    49     // Data Area
    51     // Offset
    50     // Offset
    52     TInt64 iDataOffset;
    51     TInt64 iDataOffset;
       
    52 
       
    53     // Sector Size (Media Block Size)
       
    54     TUint32 iSectorSize;
       
    55     
       
    56     // Sector-size dependant
       
    57     TInt iFormatSectorShift;
    53 	};
    58 	};
    54 
    59 
    55 #include "tmsmemmap.inl"
    60 #include "tmsmemmap.inl"
    56 
    61 
    57 #endif // TMSMEMMAP_H
    62 #endif // TMSMEMMAP_H