author | Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com> |
Tue, 26 Jan 2010 13:13:38 +0200 | |
changeset 14 | 5d2844f35677 |
parent 6 | 0173bcd7697c |
permissions | -rw-r--r-- |
0 | 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". |
|
7 |
// |
|
8 |
// Initial Contributors: |
|
9 |
// Nokia Corporation - initial contribution. |
|
10 |
// |
|
11 |
// Contributors: |
|
12 |
// |
|
13 |
// Description: |
|
14 |
// e32\include\memmodel\epoc\mmubase\kblockmap.h |
|
15 |
// Kernel-side functionality for processing block maps |
|
16 |
// |
|
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. |
|
20 |
// |
|
21 |
||
22 |
#ifndef __KBLOCKMAP_H__ |
|
23 |
#define __KBLOCKMAP_H__ |
|
24 |
||
25 |
#include <e32ldr.h> |
|
6
0173bcd7697c
Revision: 201001
Dremov Kirill (Nokia-D-MSW/Tampere) <kirill.dremov@nokia.com>
parents:
0
diff
changeset
|
26 |
#include <e32ldr_private.h> |
0 | 27 |
|
28 |
/** |
|
29 |
The kernel-side representation of a block map. |
|
30 |
*/ |
|
31 |
class TBlockMap |
|
32 |
{ |
|
33 |
public: |
|
34 |
TBlockMap(); |
|
35 |
~TBlockMap(); |
|
36 |
||
37 |
/** |
|
38 |
Initialise and populate kernel-side representation from a user-side block map |
|
39 |
||
40 |
@param aBlockMapInfo The user-side block map info structure. |
|
41 |
||
42 |
@param aBlockMapEntries Pointer to a buffer containg the user-side block map entries. |
|
43 |
This object takes ownership of the buffer. |
|
44 |
||
45 |
@param aBlockMapEntriesSize The size of the user-side block map entries in bytes. |
|
46 |
||
47 |
@param aReadUnitShift Log2 of the paging device's read unit size. |
|
48 |
||
49 |
@param aDataLengthInFile The length of the (possibly compressed) code in the file. |
|
50 |
*/ |
|
51 |
TInt Initialise(const SBlockMapInfoBase& aBlockMapInfo, |
|
52 |
TBlockMapEntryBase* aBlockMapEntries, |
|
53 |
TInt aBlockMapEntriesSize, |
|
54 |
TInt aReadUnitShift, |
|
55 |
TInt aDataLengthInFile); |
|
56 |
||
57 |
/** |
|
58 |
A function supplied to Read that is called to read the actual data. |
|
59 |
||
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. |
|
65 |
*/ |
|
66 |
typedef TInt (*TReadFunc)(TAny* aArg1, TAny* aArg2, TLinAddr aBuffer, TInt aBlockNumber, TInt aBlockCount); |
|
67 |
||
68 |
/** |
|
69 |
Read data from the file described by the block map into a buffer. |
|
70 |
||
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. |
|
78 |
||
79 |
@return The offset into the buffer at which the data starts, or one of the system-wide error |
|
80 |
codes. |
|
81 |
*/ |
|
82 |
TInt Read(TLinAddr aBuffer, TInt aPos, TInt aLength, TInt aReadUnitShift, TReadFunc aReadFunc, TAny* aArg1, TAny* aArg2) const; |
|
83 |
||
84 |
/** |
|
85 |
A contiguous area of media containing (possibly compressed) code. |
|
86 |
*/ |
|
87 |
struct SExtent |
|
88 |
{ |
|
89 |
TInt iDataOffset; // position in file from, counting from start of code data |
|
90 |
TUint iBlockNumber; // block number containg this position |
|
91 |
}; |
|
92 |
||
93 |
inline TInt Count() const; |
|
94 |
inline const SExtent& Extent(TInt aIndex) const; |
|
95 |
inline TInt DataLength() const; |
|
96 |
||
97 |
/** |
|
98 |
Print out the contents of this object for debugging purposes. |
|
99 |
This method is only implemented in debug builds. |
|
100 |
*/ |
|
101 |
void Dump() const; |
|
102 |
||
103 |
private: |
|
104 |
||
105 |
TInt FindFirstExtent(TInt aPos) const; |
|
106 |
||
107 |
private: |
|
108 |
||
109 |
TInt iDataLength; |
|
110 |
TInt iExtentCount; |
|
111 |
SExtent* iExtents; |
|
112 |
}; |
|
113 |
||
114 |
inline TInt TBlockMap::Count() const |
|
115 |
{ |
|
116 |
return iExtentCount; |
|
117 |
} |
|
118 |
||
119 |
inline const TBlockMap::SExtent& TBlockMap::Extent(TInt aIndex) const |
|
120 |
{ |
|
121 |
return iExtents[aIndex]; |
|
122 |
} |
|
123 |
||
124 |
inline TInt TBlockMap::DataLength() const |
|
125 |
{ |
|
126 |
return iDataLength; |
|
127 |
} |
|
128 |
||
129 |
#endif |