Update contrib.
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 "Eclipse Public License v1.0"
5 // which accompanies this distribution, and is available
6 // at the URL "http://www.eclipse.org/legal/epl-v10.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
17 // WARNING: This file contains some APIs which are internal and are subject
18 // to change without notice. Such APIs should therefore not be used
19 // outside the Kernel and Hardware Services package.
22 #ifndef __KBLOCKMAP_H__
23 #define __KBLOCKMAP_H__
26 #include <e32ldr_private.h>
29 The kernel-side representation of a block map.
38 Initialise and populate kernel-side representation from a user-side block map
40 @param aBlockMapInfo The user-side block map info structure.
42 @param aBlockMapEntries Pointer to a buffer containg the user-side block map entries.
43 This object takes ownership of the buffer.
45 @param aBlockMapEntriesSize The size of the user-side block map entries in bytes.
47 @param aReadUnitShift Log2 of the paging device's read unit size.
49 @param aDataLengthInFile The length of the (possibly compressed) code in the file.
51 TInt Initialise(const SBlockMapInfoBase& aBlockMapInfo,
52 TBlockMapEntryBase* aBlockMapEntries,
53 TInt aBlockMapEntriesSize,
55 TInt aDataLengthInFile);
58 A function supplied to Read that is called to read the actual data.
60 @param aArg1 An argument parameter passed to read.
61 @param aArg2 Another argument parameter passed to read.
62 @param aBuffer The address of the buffer to read the data into.
63 @param aBlockNumber The block number to read.
64 @param aBlockCount The number of blocks to read.
66 typedef TInt (*TReadFunc)(TAny* aArg1, TAny* aArg2, TLinAddr aBuffer, TInt aBlockNumber, TInt aBlockCount);
69 Read data from the file described by the block map into a buffer.
71 @param aBuffer The buffer into which to read the data.
72 @param aPos The offset from the start of the data at which to read.
73 @param aLength The length of data to read in bytes.
74 @param aReadUnitShift Log2 of the paging device's read unit size.
75 @param aReadFunc The function to call to read the blocks of data.
76 @param aArg1 An argument parameter passed to read.
77 @param aArg2 Another argument parameter passed to read.
79 @return The offset into the buffer at which the data starts, or one of the system-wide error
82 TInt Read(TLinAddr aBuffer, TInt aPos, TInt aLength, TInt aReadUnitShift, TReadFunc aReadFunc, TAny* aArg1, TAny* aArg2) const;
85 A contiguous area of media containing (possibly compressed) code.
89 TInt iDataOffset; // position in file from, counting from start of code data
90 TUint iBlockNumber; // block number containg this position
93 inline TInt Count() const;
94 inline const SExtent& Extent(TInt aIndex) const;
95 inline TInt DataLength() const;
98 Print out the contents of this object for debugging purposes.
99 This method is only implemented in debug builds.
105 TInt FindFirstExtent(TInt aPos) const;
114 inline TInt TBlockMap::Count() const
119 inline const TBlockMap::SExtent& TBlockMap::Extent(TInt aIndex) const
121 return iExtents[aIndex];
124 inline TInt TBlockMap::DataLength() const