1 // Copyright (c) 2006-2009 Nokia Corporation and/or its subsidiary(-ies).
2 // All rights reserved.
3 // This component and the accompanying materials are made available
4 // 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
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.symbianfoundation.org/legal/licencesv10.html".
8 // Initial Contributors:
9 // Nokia Corporation - initial contribution.
14 // e32\include\memmodel\epoc\mmubase\kblockmap.h
15 // Kernel-side functionality for processing block maps
19 #ifndef __KBLOCKMAP_H__
20 #define __KBLOCKMAP_H__
25 The kernel-side representation of a block map.
34 Initialise and populate kernel-side representation from a user-side block map
36 @param aBlockMapInfo The user-side block map info structure.
38 @param aBlockMapEntries Pointer to a buffer containg the user-side block map entries.
39 This object takes ownership of the buffer.
41 @param aBlockMapEntriesSize The size of the user-side block map entries in bytes.
43 @param aReadUnitShift Log2 of the paging device's read unit size.
45 @param aDataLengthInFile The length of the (possibly compressed) code in the file.
47 TInt Initialise(const SBlockMapInfoBase& aBlockMapInfo,
48 TBlockMapEntryBase* aBlockMapEntries,
49 TInt aBlockMapEntriesSize,
51 TInt aDataLengthInFile);
54 A function supplied to Read that is called to read the actual data.
56 @param aArg1 An argument parameter passed to read.
57 @param aArg2 Another argument parameter passed to read.
58 @param aBuffer The address of the buffer to read the data into.
59 @param aBlockNumber The block number to read.
60 @param aBlockCount The number of blocks to read.
62 typedef TInt (*TReadFunc)(TAny* aArg1, TAny* aArg2, TLinAddr aBuffer, TInt aBlockNumber, TInt aBlockCount);
65 Read data from the file described by the block map into a buffer.
67 @param aBuffer The buffer into which to read the data.
68 @param aPos The offset from the start of the data at which to read.
69 @param aLength The length of data to read in bytes.
70 @param aReadUnitShift Log2 of the paging device's read unit size.
71 @param aReadFunc The function to call to read the blocks of data.
72 @param aArg1 An argument parameter passed to read.
73 @param aArg2 Another argument parameter passed to read.
75 @return The offset into the buffer at which the data starts, or one of the system-wide error
78 TInt Read(TLinAddr aBuffer, TInt aPos, TInt aLength, TInt aReadUnitShift, TReadFunc aReadFunc, TAny* aArg1, TAny* aArg2) const;
81 A contiguous area of media containing (possibly compressed) code.
85 TInt iDataOffset; // position in file from, counting from start of code data
86 TUint iBlockNumber; // block number containg this position
89 inline TInt Count() const;
90 inline const SExtent& Extent(TInt aIndex) const;
91 inline TInt DataLength() const;
94 Print out the contents of this object for debugging purposes.
95 This method is only implemented in debug builds.
101 TInt FindFirstExtent(TInt aPos) const;
110 inline TInt TBlockMap::Count() const
115 inline const TBlockMap::SExtent& TBlockMap::Extent(TInt aIndex) const
117 return iExtents[aIndex];
120 inline TInt TBlockMap::DataLength() const