1.1 --- a/epoc32/include/memmodel/epoc/mmubase/kblockmap.h Wed Mar 31 12:27:01 2010 +0100
1.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000
1.3 @@ -1,125 +0,0 @@
1.4 -// Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
1.5 -// All rights reserved.
1.6 -// This component and the accompanying materials are made available
1.7 -// under the terms of the License "Symbian Foundation License v1.0" to Symbian Foundation members and "Symbian Foundation End User License Agreement v1.0" to non-members
1.8 -// which accompanies this distribution, and is available
1.9 -// at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
1.10 -//
1.11 -// Initial Contributors:
1.12 -// Nokia Corporation - initial contribution.
1.13 -//
1.14 -// Contributors:
1.15 -//
1.16 -// Description:
1.17 -// e32\include\memmodel\epoc\mmubase\kblockmap.h
1.18 -// Kernel-side functionality for processing block maps
1.19 -//
1.20 -//
1.21 -
1.22 -#ifndef __KBLOCKMAP_H__
1.23 -#define __KBLOCKMAP_H__
1.24 -
1.25 -#include <e32ldr.h>
1.26 -
1.27 -/**
1.28 -The kernel-side representation of a block map.
1.29 -*/
1.30 -class TBlockMap
1.31 - {
1.32 -public:
1.33 - TBlockMap();
1.34 - ~TBlockMap();
1.35 -
1.36 - /**
1.37 - Initialise and populate kernel-side representation from a user-side block map
1.38 -
1.39 - @param aBlockMapInfo The user-side block map info structure.
1.40 -
1.41 - @param aBlockMapEntries Pointer to a buffer containg the user-side block map entries.
1.42 - This object takes ownership of the buffer.
1.43 -
1.44 - @param aBlockMapEntriesSize The size of the user-side block map entries in bytes.
1.45 -
1.46 - @param aReadUnitShift Log2 of the paging device's read unit size.
1.47 -
1.48 - @param aDataLengthInFile The length of the (possibly compressed) code in the file.
1.49 - */
1.50 - TInt Initialise(const SBlockMapInfoBase& aBlockMapInfo,
1.51 - TBlockMapEntryBase* aBlockMapEntries,
1.52 - TInt aBlockMapEntriesSize,
1.53 - TInt aReadUnitShift,
1.54 - TInt aDataLengthInFile);
1.55 -
1.56 - /**
1.57 - A function supplied to Read that is called to read the actual data.
1.58 -
1.59 - @param aArg1 An argument parameter passed to read.
1.60 - @param aArg2 Another argument parameter passed to read.
1.61 - @param aBuffer The address of the buffer to read the data into.
1.62 - @param aBlockNumber The block number to read.
1.63 - @param aBlockCount The number of blocks to read.
1.64 - */
1.65 - typedef TInt (*TReadFunc)(TAny* aArg1, TAny* aArg2, TLinAddr aBuffer, TInt aBlockNumber, TInt aBlockCount);
1.66 -
1.67 - /**
1.68 - Read data from the file described by the block map into a buffer.
1.69 -
1.70 - @param aBuffer The buffer into which to read the data.
1.71 - @param aPos The offset from the start of the data at which to read.
1.72 - @param aLength The length of data to read in bytes.
1.73 - @param aReadUnitShift Log2 of the paging device's read unit size.
1.74 - @param aReadFunc The function to call to read the blocks of data.
1.75 - @param aArg1 An argument parameter passed to read.
1.76 - @param aArg2 Another argument parameter passed to read.
1.77 -
1.78 - @return The offset into the buffer at which the data starts, or one of the system-wide error
1.79 - codes.
1.80 - */
1.81 - TInt Read(TLinAddr aBuffer, TInt aPos, TInt aLength, TInt aReadUnitShift, TReadFunc aReadFunc, TAny* aArg1, TAny* aArg2) const;
1.82 -
1.83 - /**
1.84 - A contiguous area of media containing (possibly compressed) code.
1.85 - */
1.86 - struct SExtent
1.87 - {
1.88 - TInt iDataOffset; // position in file from, counting from start of code data
1.89 - TUint iBlockNumber; // block number containg this position
1.90 - };
1.91 -
1.92 - inline TInt Count() const;
1.93 - inline const SExtent& Extent(TInt aIndex) const;
1.94 - inline TInt DataLength() const;
1.95 -
1.96 - /**
1.97 - Print out the contents of this object for debugging purposes.
1.98 - This method is only implemented in debug builds.
1.99 - */
1.100 - void Dump() const;
1.101 -
1.102 -private:
1.103 -
1.104 - TInt FindFirstExtent(TInt aPos) const;
1.105 -
1.106 -private:
1.107 -
1.108 - TInt iDataLength;
1.109 - TInt iExtentCount;
1.110 - SExtent* iExtents;
1.111 - };
1.112 -
1.113 -inline TInt TBlockMap::Count() const
1.114 - {
1.115 - return iExtentCount;
1.116 - }
1.117 -
1.118 -inline const TBlockMap::SExtent& TBlockMap::Extent(TInt aIndex) const
1.119 - {
1.120 - return iExtents[aIndex];
1.121 - }
1.122 -
1.123 -inline TInt TBlockMap::DataLength() const
1.124 - {
1.125 - return iDataLength;
1.126 - }
1.127 -
1.128 -#endif